Skip to content

Commit

Permalink
Migrate bundler from webpack to Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
livewing committed Feb 18, 2025
1 parent 899046b commit fc425f7
Show file tree
Hide file tree
Showing 92 changed files with 6,618 additions and 25,007 deletions.
23 changes: 10 additions & 13 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
"build": {
"dockerfile": "Dockerfile"
},
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash"
"customizations": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash"
}
}
}
},
"extensions": ["biomejs.biome", "EditorConfig.EditorConfig"]
},
"extensions": [
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"eg2.vscode-npm-script",
"esbenp.prettier-vscode"
],
"forwardPorts": [8080],
"forwardPorts": [5173],
"postCreateCommand": "npm i && npm run build:wasm",
"remoteUser": "node"
}
2 changes: 0 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[*.{html,json,svg,ts,tsx,yml}]
indent_style = space
indent_size = 2
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintrc.yml

This file was deleted.

30 changes: 13 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: latest
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
run: |
rustup install stable
- name: Install wasm-pack
uses: actions-rs/install@v0.1
with:
crate: wasm-pack
use-tool-cache: true
uses: taiki-e/install-action@wasm-pack
- name: Prepare cache
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -48,7 +44,7 @@ jobs:
- name: Lint
run: npm run lint
- name: Archive production artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -61,7 +57,7 @@ jobs:
url: ${{ steps.deploy.outputs.NETLIFY_URL }}
steps:
- name: Download production artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
path: dist
Expand All @@ -83,15 +79,15 @@ jobs:
url: https://mahjong-calc.livewing.net/
steps:
- name: Download production artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_DEPLOY_ROLE }}
role-session-name: GitHubActions
aws-region: ap-northeast-1
- name: Deploy to S3
run: aws s3 sync --exact-timestamp --delete dist/ ${{ secrets.AWS_S3_BUCKET_NAME }}
Expand Down
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged && npx tsc --noEmit && npm test
npm run lint && npm test
7 changes: 1 addition & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"eg2.vscode-npm-script",
"esbenp.prettier-vscode"
]
"recommendations": ["biomejs.biome", "EditorConfig.EditorConfig"]
}
13 changes: 11 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"css.validate": false,
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm run build:wasm
$ npm run dev
```

`webpack-dev-server` runs on `PORT=8080`.
Vite dev server runs on `PORT=5173`. If you are using Dev Container, run `npm run dev -- --host` instead of `npm run dev`.

## Lint

Expand Down
43 changes: 43 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["wasm", "package.json"]
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedFunctionParameters": "warn",
"noUnusedImports": "warn",
"noUnusedPrivateClassMembers": "warn",
"noUnusedVariables": "warn"
},
"suspicious": {
"noArrayIndexKey": "off"
},
"performance": {
"noAccumulatingSpread": "off"
}
}
},
"formatter": {
"enabled": true,
"useEditorconfig": true
},
"organizeImports": {
"enabled": true
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "none",
"arrowParentheses": "asNeeded"
}
}
}
2 changes: 1 addition & 1 deletion doc/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

#### 役満の複合

- `オフ`: 役満が複合しません。ダブル役満がシングル役満扱いとなります。
- `オフ`: 役満が複合しません。
- `オン`: 役満が複合します。

#### 国士無双十三面待ち・四暗刻単騎待ち・大四喜・純正九蓮宝燈
Expand Down
2 changes: 1 addition & 1 deletion src/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/app.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<title>麻雀得点計算機</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
Loading

0 comments on commit fc425f7

Please sign in to comment.