Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pnpmを使う #2511

Merged
merged 15 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ runs:
echo "ELECTRON_BUILDER_CACHE=${{ runner.temp }}/electron-builder-cache" >> $GITHUB_ENV
echo "cache-version=1" >> $GITHUB_ENV

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
cache: "pnpm"

- name: Cache Electron
uses: actions/cache@v4
Expand All @@ -34,4 +37,4 @@ runs:
${{ env.cache-version }}-${{ runner.os }}--electron-builder-cache-

- shell: bash
run: npm ci
run: pnpm install --frozen-lockfile
17 changes: 10 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,14 @@ jobs:

$sed -i 's/"version": "999.999.999"/"version": "${{ env.VOICEVOX_EDITOR_VERSION }}"/' package.json

- name: Setup pnpm
uses: pnpm/action-setup@v4

Comment on lines +161 to +163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(このプルリクエストに関係ないですが)
あれ、この辺り.github/actions/setup-environment/action.yml使えば不要になる・・・?
なんで共通化してないんだろう。絶対理由があるはずだけど覚えてない。。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 おそらく、共通化したのがテストを速くするための目的で、ビルドも共通化することが目的ではなかったため

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "npm"
cache: "pnpm"

- name: Cache Electron
uses: actions/cache@v4
Expand All @@ -181,7 +184,7 @@ jobs:
${{ env.cache-version }}-${{ runner.os }}--electron-builder-cache-

- name: Install dependencies
run: npm ci
run: pnpm i --frozen-lockfile

- name: Checkout Product Version Resource
uses: actions/checkout@v4
Expand Down Expand Up @@ -221,7 +224,7 @@ jobs:
$sed -i 's/VITE_GTM_CONTAINER_ID=.*/VITE_GTM_CONTAINER_ID='"$gtm_id"'/' .env.production

- name: Generate public/licenses.json
run: npm run license:generate -- -o public/licenses.json
run: pnpm run license:generate -o public/licenses.json

- name: Define Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down Expand Up @@ -251,7 +254,7 @@ jobs:

# https://github.com/electron-userland/electron-builder/issues/3179
USE_HARD_LINKS: false
run: npm run electron:build -- --dir
run: pnpm run electron:build --dir

- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down Expand Up @@ -284,7 +287,7 @@ jobs:
rm "${{ matrix.app_asar_dir }}/app.asar"

mv voicevox_engine/licenses.json engine_licenses.json
npm run license:merge -- -o "${{ matrix.app_asar_dir }}/app/dist/licenses.json" -i engine_licenses.json -i "${{ matrix.app_asar_dir }}/app/dist/licenses.json"
pnpm run license:merge -o "${{ matrix.app_asar_dir }}/app/dist/licenses.json" -i engine_licenses.json -i "${{ matrix.app_asar_dir }}/app/dist/licenses.json"

# Repack asar
npx asar pack "${{ matrix.app_asar_dir }}/app" "${{ matrix.app_asar_dir }}/app.asar"
Expand Down Expand Up @@ -413,14 +416,14 @@ jobs:
LINUX_ARTIFACT_NAME: ${{ matrix.linux_artifact_name }}
LINUX_EXECUTABLE_NAME: ${{ matrix.linux_executable_name }}
run: |
npm run electron:build -- --prepackaged prepackage/
pnpm run electron:build --prepackaged prepackage/

- name: Build Electron (for macOS)
if: endsWith(matrix.installer_artifact_name, '-dmg') # macOS
env:
MACOS_ARTIFACT_NAME: ${{ matrix.macos_artifact_name }}
run: |
npm run electron:build -- --prepackaged prepackage/VOICEVOX.app
pnpm run electron:build --prepackaged prepackage/VOICEVOX.app

- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_preview_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
fi

# Storybookのビルド
npm run storybook:build -- --output-dir $(pwd)/dist_preview/storybook
pnpm run storybook:build --output-dir $(pwd)/dist_preview/storybook

# ブラウザ版エディタのビルド
VITE_EXTRA_VERSION_INFO="${LOCATION} @ ${SHORT_SHA}" \
npm run browser:build -- --base ./ --outDir $(pwd)/dist_preview/editor
pnpm run browser:build --base ./ --outDir $(pwd)/dist_preview/editor

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup-environment
- run: npm run electron:build
- run: pnpm run electron:build

# unit テスト
unit-test:
Expand All @@ -57,7 +57,7 @@ jobs:

- name: Run test
run: |
npm run test:unit
pnpm run test:unit

# e2e テスト
e2e-test:
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
dest: ${{ github.workspace }}/voicevox_engine
target: ${{ matrix.voicevox_engine_asset_name }}

- name: Run npm run test:browser-e2e
- name: Run pnpm run test:browser-e2e
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
Expand All @@ -107,9 +107,9 @@ jobs:
if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
ARGS="--update-snapshots"
fi
npm run test:browser-e2e -- $ARGS
pnpm run test:browser-e2e $ARGS

- name: Run npm run test:electron-e2e
- name: Run pnpm run test:electron-e2e
run: |
# .env
cp tests/env/.env.test-electron .env
Expand All @@ -123,14 +123,14 @@ jobs:
export DEBUG="pw:browser*"
fi
if [[ ${{ matrix.os }} == ubuntu-* ]]; then
xvfb-run --auto-servernum npm run test:electron-e2e
xvfb-run --auto-servernum pnpm run test:electron-e2e
else
npm run test:electron-e2e
pnpm run test:electron-e2e
fi

rm .env

- name: Run npm run test:storybook-vrt
- name: Run pnpm run test:storybook-vrt
run: |
if [ -n "${{ runner.debug }}" ]; then
export DEBUG="pw:browser*"
Expand All @@ -139,7 +139,7 @@ jobs:
if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
ARGS="--update-snapshots"
fi
npm run test:storybook-vrt -- $ARGS
pnpm run test:storybook-vrt $ARGS

- name: Upload playwright report to artifact
if: failure()
Expand Down Expand Up @@ -239,9 +239,9 @@ jobs:
uses: ./.github/actions/setup-environment

- name: Disallowed licenses check
run: npm run license:generate -- -o voicevox_licenses.json
run: pnpm run license:generate -o voicevox_licenses.json

- run: npm run typecheck
- run: npm run lint
- run: npm run markdownlint
- run: npm run typos
- run: pnpm run typecheck
- run: pnpm run lint
- run: pnpm run markdownlint
- run: pnpm run typos
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
engine-strict=true
save-exact=true
@jsr:registry=https://npm.jsr.io
manage-package-manager-versions=true
32 changes: 19 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ VOICEVOXには、下記のような貢献の仕方があります。
### 2. 開発環境の構築

- 必須ツール

- [Node.js](https://nodejs.org/en/download/releases/)\
[こちら](https://github.com/VOICEVOX/voicevox/blob/main/.node-version)に記載されているバージョンのインストーラを入手し、インストールします。

Expand Down Expand Up @@ -119,8 +120,13 @@ git clone [email protected]:(個人のGitHubアカウント名)/voicevox.git
### 5. 必要なプログラムをダウンロードする

- 手順4で手に入れたフォルダを開いて、コマンドプロンプトを開きます。
- 環境を準備するコマンド `npm ci`
を実行してください。自動的にダウンロードされます。
- 環境を準備する以下のコマンドを実行してください。自動的にダウンロードされます。

```bash
npm install -g pnpm
pnpm i
```

- ツールの組み合わせや実装に関する警告が表示されますが、開発環境を作るうえでは無視して差し支えありません。

### 6. エンジンを指定する
Expand Down Expand Up @@ -150,7 +156,7 @@ VITE_DEFAULT_ENGINE_INFOS=`[

### 7. 始動してみる

- `npm run electron:serve`を実行します。
- `pnpm run electron:serve`を実行します。
- 設定が正しければ、開発環境が起動するはずです。

## プロジェクトへの貢献手順
Expand Down Expand Up @@ -222,46 +228,46 @@ VITE_DEFAULT_ENGINE_INFOS=`[
- 記述コードがコーディングルールに沿っていることを確認します。(特に今回の作業によって警告やエラーが増えていないかどうかに注目してください)

```bash
npm run lint
npm run fmt
pnpm run lint
pnpm run fmt
```

- TypeScriptの型チェックを行います。

```bash
npm run typecheck
pnpm run typecheck
```

- Markdownの記述が正しいことを確認します。

```bash
npm run markdownlint ./*/*.md
pnpm run markdownlint ./*/*.md
```

- 命名に使っている英語が誤っていないことを確認します。

```bash
npm run typos
pnpm run typos
```

- 個人環境でVOICEVOXを実行し、提出前に、一通り動くことを確認します。

```bash
npm run electron:serve
pnpm run electron:serve
```

- 使用するライブラリのライセンスに使用出来ないものが使われていないことを確認します。

```bash
npm run license:generate -- -o voicevox_licenses.json
pnpm run license:generate -- -o voicevox_licenses.json
```

- e2eテストの内容を確認します。

```bash
npm run test:unit
npm run test:browser-e2e
npm run test:electron-e2e
pnpm run test:unit
pnpm run test:browser-e2e
pnpm run test:electron-e2e
```

- e2eテストは実際には自分が提出する範囲外の指摘をしたり、完全に警告が消えないことがあります。
Expand Down
Loading
Loading