Skip to content

Commit c489824

Browse files
authored
chore: yarn ではなく pnpm を使うように変更 (#4186)
* chore: run pnpm import * chore: yarn -> pnpm * chore: --frozen-lockfile は CI 環境ではデフォルトで true なので不要 * chore: github actions に pnpm/action-setup を追加 * chore: pnpm add -D @storybook/addon-actions * chore: -w が pnpm のオプションとして渡ってしまっていたので修正 * fix: storybook が参照する tsconfig.json では declaration: true を指定しないように変更
1 parent b6d65b7 commit c489824

13 files changed

+16247
-13534
lines changed

.circleci/config.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,50 +26,50 @@ commands:
2626
# Download and cache dependencies
2727
- restore_cache:
2828
keys:
29-
- dependencies-test-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
29+
- dependencies-test-{{ checksum "package.json" }}-{{ checksum "pnpm-lock.yaml" }}
3030
# fallback to using the latest cache if no exact match is found
3131
- modules-cache-
32-
- run: yarn install --frozen-lockfile
32+
- run: pnpm install
3333
- save_cache:
3434
paths:
3535
- node_modules
36-
key: dependencies-test-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
36+
key: dependencies-test-{{ checksum "package.json" }}-{{ checksum "pnpm-lock.yaml" }}
3737
check-source:
3838
steps:
39-
- run: yarn audit --groups dependencies
40-
- run: yarn lint
39+
- run: pnpm audit --prod
40+
- run: pnpm lint
4141
run-npm-test:
4242
steps:
43-
- run: yarn test -w 1
44-
- run: yarn test:build-assets
43+
- run: pnpm test -- -w 1
44+
- run: pnpm test:build-assets
4545
run-a11y-test:
4646
steps:
4747
- checkout
4848
- restore_cache:
4949
keys:
50-
- yarn-packages-reg-{{ checksum "yarn.lock" }}
51-
- run: yarn install --frozen-lockfile
50+
- pnpm-packages-reg-{{ checksum "pnpm-lock.yaml" }}
51+
- run: pnpm install
5252
- save_cache:
5353
paths:
54-
- ~/.cache/yarn
55-
key: yarn-packages-reg-{{ checksum "yarn.lock" }}
54+
- ~/.cache/pnpm
55+
key: pnpm-packages-reg-{{ checksum "pnpm-lock.yaml" }}
5656
- run:
57-
command: yarn build-storybook
57+
command: pnpm build-storybook
5858
- run:
5959
command: npx http-server storybook-static --port 6006 --silent
6060
background: true
6161
- run:
62-
command: yarn test-storybook:ci
62+
command: pnpm test-storybook:ci
6363
- store_test_results:
6464
path: junit.xml
6565
run-chromatic:
6666
steps:
6767
- checkout
68-
- run: yarn run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed
68+
- run: pnpm run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed
6969
run-chromatic-master:
7070
steps:
7171
- checkout
72-
- run: yarn run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed
72+
- run: pnpm run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed
7373
install-noto-sans-cjk-jp:
7474
steps:
7575
- run:

.github/workflows/e2e.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,16 @@ jobs:
1414
browser: [chrome]
1515
steps:
1616
- uses: actions/checkout@v4
17+
- uses: pnpm/action-setup@v2
18+
with:
19+
version: 8
1720
- uses: actions/setup-node@v4
1821
with:
1922
node-version: 20
20-
- name: Get yarn cache directory path
21-
id: yarn-cache-dir-path
22-
run: echo "::set-output name=dir::$(yarn cache dir)"
23-
- name: Use yarn cache
24-
uses: actions/cache@v4
25-
with:
26-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
27-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
28-
restore-keys: |
29-
${{ runner.os }}-yarn-
23+
cache: 'pnpm'
3024
- name: run
3125
run: |
32-
yarn install --frozen-lockfile
33-
yarn e2e
26+
pnpm install
27+
pnpm e2e
3428
env:
3529
TESTCAFE_BROWSER: ${{ matrix.browser }}

.github/workflows/publishRelease.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
with:
1818
ref: release-candidate
1919
fetch-depth: 0
20+
- uses: pnpm/action-setup@v2
21+
with:
22+
version: 8
2023
- uses: actions/setup-node@v4
2124
with:
2225
node-version-file: '.node-version'
@@ -25,10 +28,10 @@ jobs:
2528
run: |
2629
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
2730
git config user.name "github-actions[bot]"
28-
- run: yarn install --frozen-lockfile
29-
- run: yarn release
31+
- run: pnpm install
32+
- run: pnpm release
3033
if: ${{ env.IS_PRERELEASE == 'false' }}
31-
- run: yarn release --prerelease
34+
- run: pnpm release --prerelease
3235
if: ${{ env.IS_PRERELEASE == 'true' }}
3336
- run: npm publish
3437
if: ${{ env.IS_PRERELEASE == 'false' }}

.github/workflows/startRelease.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
- uses: actions/checkout@v4
2222
with:
2323
fetch-depth: 0
24+
- uses: pnpm/action-setup@v2
25+
with:
26+
version: 8
2427
- uses: actions/setup-node@v4
2528
with:
2629
node-version-file: '.node-version'
@@ -34,13 +37,13 @@ jobs:
3437
BASE_TAG=v$(npx -c 'echo "$npm_package_version"')
3538
git checkout $BASE_TAG
3639
git merge --no-edit ${{ github.ref }}
37-
- run: yarn install --frozen-lockfile
40+
- run: pnpm install
3841
- name: release dry run
3942
if: ${{ env.IS_PRERELEASE == 'false' }}
40-
run: yarn release:dryrun > ${{ env.RESULT_PATH }}
43+
run: pnpm release:dryrun > ${{ env.RESULT_PATH }}
4144
- name: prerelease dry run
4245
if: ${{ env.IS_PRERELEASE == 'true' }}
43-
run: yarn release:dryrun --prerelease > ${{ env.RESULT_PATH }}
46+
run: pnpm release:dryrun --prerelease > ${{ env.RESULT_PATH }}
4447
- name: wrap dry run log
4548
run: |
4649
echo "Dry Run Log:

CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ Thank you for reading this!
66

77
## Setup
88

9-
We use `yarn` for the package manager.
9+
We use `pnpm` for the package manager.
1010

1111
```sh
12-
$ yarn
12+
$ pnpm
1313
```
1414

1515
## Test
1616

1717
```sh
18-
$ yarn test
18+
$ pnpm test
1919
```
2020

2121
`smarthr-ui` uses Jest's snapshot testing.
2222

2323
If the test results are what you expect, you can update the snapshot with the following command.
2424

2525
```sh
26-
$ yarn test:update-snapshot
26+
$ pnpm test:update-snapshot
2727
```
2828

2929
## Commit
@@ -94,7 +94,7 @@ import { ComponentName } from 'smarthr-ui'
9494
## Release
9595

9696
```sh
97-
$ yarn release
97+
$ pnpm release
9898
```
9999

100100
We use `standard-version` to release npm packages.

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ npm install smarthr-ui
2626

2727
// with yarn
2828
yarn add smarthr-ui
29+
30+
// with pnpm
31+
pnpm add smarthr-ui
2932
```
3033

3134
peerDependencies として React, React-DOM, styled-components が必要です。
@@ -36,6 +39,9 @@ npm install react react-dom styled-components
3639

3740
// with yarn
3841
yarn add react react-dom styled-components
42+
43+
// with pnpm
44+
pnpm add react react-dom styled-components
3945
```
4046

4147
## 使いかた

package.json

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@commitlint/cli": "^18.6.1",
2525
"@commitlint/config-conventional": "^18.6.2",
2626
"@storybook/addon-a11y": "^7.6.15",
27+
"@storybook/addon-actions": "^7.6.15",
2728
"@storybook/addon-essentials": "^7.6.15",
2829
"@storybook/addon-interactions": "^7.6.15",
2930
"@storybook/addon-storysource": "^7.6.15",
@@ -163,7 +164,7 @@
163164
"test": "jest",
164165
"test:update-snapshot": "jest --updateSnapshot",
165166
"test:build-assets": "node scripts/build-test.ts",
166-
"test-storybook:ci": "wait-on tcp:6006 && yarn test-storybook --maxWorkers=2 --junit",
167+
"test-storybook:ci": "wait-on tcp:6006 && pnpm test-storybook --maxWorkers=2 --junit",
167168
"testcafe": "testcafe",
168169
"e2e": "ts-node scripts/e2e.ts",
169170
"e2e:dev": "testcafe chrome --host localhost --skip-js-errors",
@@ -176,12 +177,14 @@
176177
"*.css"
177178
],
178179
"typings": "lib/index.d.ts",
179-
"resolutions": {
180-
"@babel/helper-compilation-targets": "^7.23.6",
181-
"@types/react": "^18.2.55",
182-
"minimist": "1.2.8",
183-
"react": "^18.2.0",
184-
"react-dom": "^18.2.0"
180+
"pnpm": {
181+
"overrides": {
182+
"@babel/helper-compilation-targets": "^7.23.6",
183+
"@types/react": "^18.2.55",
184+
"minimist": "1.2.8",
185+
"react": "^18.2.0",
186+
"react-dom": "^18.2.0"
187+
}
185188
},
186189
"standard-version": {
187190
"scripts": {

0 commit comments

Comments
 (0)