Skip to content

Commit c9b95bb

Browse files
samunohitoCopilot
andauthored
chore: npm から pnpmへ移行 (#180)
* chore: npm から pnpmへ移行 * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 85deb39 commit c9b95bb

9 files changed

Lines changed: 4312 additions & 7182 deletions

File tree

.github/workflows/api.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,26 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v4
1313

14+
- name: Use pnpm
15+
uses: pnpm/action-setup@v6
16+
1417
- name: Setup Node.js
1518
uses: actions/setup-node@v4
1619
with:
20+
cache: 'pnpm'
1721
node-version: 22.14.0
1822

19-
- name: Cache dependencies
20-
uses: actions/cache@v4
21-
with:
22-
path: ~/.npm
23-
key: npm-${{ hashFiles('package-lock.json') }}
24-
restore-keys: npm-
25-
2623
- name: Install dependencies
27-
run: npm ci
24+
run: pnpm install --frozen-lockfile
2825

2926
- name: Build
30-
run: npm run build
27+
run: pnpm run build
3128

3229
- name: Check files
3330
run: ls built
3431

3532
- name: API report
36-
run: npm run api-prod
33+
run: pnpm run api-prod
3734

3835
- name: Show report
3936
if: always()

.github/workflows/lint.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,17 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v4
1313

14+
- name: Use pnpm
15+
uses: pnpm/action-setup@v6
16+
1417
- name: Setup Node.js
1518
uses: actions/setup-node@v4
1619
with:
20+
cache: 'pnpm'
1721
node-version: 22.14.0
1822

19-
- name: Cache dependencies
20-
uses: actions/cache@v4
21-
with:
22-
path: ~/.npm
23-
key: npm-${{ hashFiles('package-lock.json') }}
24-
restore-keys: npm-
25-
2623
- name: Install dependencies
27-
run: npm ci
24+
run: pnpm install --frozen-lockfile
2825

2926
- name: Lint
30-
run: npm run lint
27+
run: pnpm run lint

.github/workflows/test.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,23 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21+
- name: Use pnpm
22+
uses: pnpm/action-setup@v6
23+
2124
- name: Setup Node.js ${{ matrix.node-version }}
2225
uses: actions/setup-node@v4
2326
with:
27+
cache: 'pnpm'
2428
node-version: ${{ matrix.node-version }}
2529

26-
- name: Cache dependencies
27-
uses: actions/cache@v4
28-
with:
29-
path: ~/.npm
30-
key: npm-${{ hashFiles('package-lock.json') }}
31-
restore-keys: npm-
32-
3330
- name: Install dependencies
34-
run: npm ci
31+
run: pnpm install --frozen-lockfile
3532

3633
- name: Build
37-
run: npm run build
34+
run: pnpm run build
3835

3936
- name: Test
40-
run: npm test
37+
run: pnpm run test
4138
env:
4239
CI: true
4340

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ PRを作成する前に、以下をご確認ください:
2727
- この変更により新たに作成、もしくは更新すべきドキュメントがないか確認してください。
2828
- 機能追加やバグ修正をした場合は、可能であればテストケースを追加してください。
2929
- テスト、Lintが通っていることを予め確認してください。
30-
- `npm run test``npm run lint`でぞれぞれ実施可能です
31-
- `npm run api`を実行してAPIレポートを更新し、差分がある場合はコミットしてください。
30+
- `pnpm run test``pnpm run lint`でそれぞれ実施可能です
31+
- `pnpm run api`を実行してAPIレポートを更新し、差分がある場合はコミットしてください。
3232
- APIレポートの詳細については[こちら](#api-extractor)
3333

3434
ご協力ありがとうございます🤗
@@ -43,24 +43,24 @@ CI上でも自動でチェックされ、ルールに則っていないコード
4343
テストは[`/test`ディレクトリ](/test)に置かれます。
4444

4545
テストはCIにより各コミット/各PRに対して自動で実施されます。
46-
ローカル環境でテストを実施するには、`npm run test`を実行してください。
46+
ローカル環境でテストを実施するには、`pnpm run test`を実行してください。
4747

4848
### tsd
4949
このプロジェクトでは型のテストを行うために[tsd](https://github.com/SamVerschueren/tsd)を導入しています。
5050
Jestによるテストでは「型が期待したものか」というのはチェックすることができません。tsdを使うことで、型が意図したものであることを担保することができます。
5151
tsdによる型テストは[`/test-d`ディレクトリ](/test-d)に置かれます。
5252

5353
テストはCIにより各コミット/各PRに対して自動で実施されます。
54-
ローカル環境でテストを実施するには、`npm run test`を実行してください。
54+
ローカル環境でテストを実施するには、`pnpm run test`を実行してください。
5555

5656
### API Extractor
5757
このプロジェクトでは[API Extractor](https://api-extractor.com/)を導入しています。API ExtractorはAPIレポートを生成する役割を持ちます。
58-
APIレポートはいわばAPIのスナップショットで、このライブラリが外部に公開(export)している各種関数や型の定義が含まれています。`npm run api`コマンドを実行すると、その時点でのレポートが[`/etc`ディレクトリ](/etc)に生成されるようになっています。
58+
APIレポートはいわばAPIのスナップショットで、このライブラリが外部に公開(export)している各種関数や型の定義が含まれています。`pnpm run api`コマンドを実行すると、その時点でのレポートが[`/etc`ディレクトリ](/etc)に生成されるようになっています。
5959

6060
exportしているAPIに変更があると、当然生成されるレポートの内容も変わるので、例えばdevelopブランチで生成されたレポートとPRのブランチで生成されたレポートを比較することで、意図しない破壊的変更の検出や、破壊的変更の影響確認に用いることができます。
6161
また、各コミットや各PRで実行されるCI内部では、都度APIレポートを生成して既存のレポートと差分が無いかチェックしています。もし差分があるとエラーになります。
6262

63-
PRを作る際は、`npm run api`コマンドを実行してAPIレポートを生成し、差分がある場合はコミットしてください。
63+
PRを作る際は、`pnpm run api`コマンドを実行してAPIレポートを生成し、差分がある場合はコミットしてください。
6464
レポートをコミットすることでその破壊的変更が意図したものであると示すことができるほか、上述したようにレポート間の差分が出ることで影響範囲をレビューしやすくなります。
6565

6666
### Codecov

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,25 @@ git clone https://github.com/misskey-dev/mfm.js.git
4848
### 2. Install packages
4949
```
5050
cd mfm.js
51-
npm i
51+
52+
# This repository uses pnpm as its package manager.
53+
pnpm i
5254
```
5355

5456
### 3. Build
5557
```
56-
npm run build
58+
pnpm run build
5759
```
5860

5961
### Use the interactive CLI parser
6062
full parser:
6163
```
62-
npm run parse
64+
pnpm run parse
6365
```
6466

6567
simple parser:
6668
```
67-
npm run parse-simple
69+
pnpm run parse-simple
6870
```
6971

7072
## License

docs/CONTRIBUTING.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Thank you for your PR! Before creating a PR, please check the following:
2323
- Check if there are any documents that need to be created or updated due to this change.
2424
- If you have added a feature or fixed a bug, please add a test case if possible.
2525
- Please make sure that tests and Lint are passed in advance.
26-
- You can run it with `npm run test` and `npm run lint`.
27-
- Run `npm run api` to update the API report and commit it if there are any diffs.
26+
- You can run it with `pnpm run test` and `pnpm run lint`.
27+
- Run `pnpm run api` to update the API report and commit it if there are any diffs.
2828

2929
Thanks for your cooperation 🤗
3030

0 commit comments

Comments
 (0)