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: yarn ではなく pnpm を使うように変更 #4186

Merged
merged 8 commits into from
Feb 16, 2024
30 changes: 15 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,50 @@ commands:
# Download and cache dependencies
- restore_cache:
keys:
- dependencies-test-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- dependencies-test-{{ checksum "package.json" }}-{{ checksum "pnpm-lock.yaml" }}
# fallback to using the latest cache if no exact match is found
- modules-cache-
- run: yarn install --frozen-lockfile
- run: pnpm install
- save_cache:
paths:
- node_modules
key: dependencies-test-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
key: dependencies-test-{{ checksum "package.json" }}-{{ checksum "pnpm-lock.yaml" }}
check-source:
steps:
- run: yarn audit --groups dependencies
- run: yarn lint
- run: pnpm audit --prod
Copy link
Member Author

@Tokky0425 Tokky0425 Feb 15, 2024

Choose a reason for hiding this comment

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

yarn audit --groups dependencies と同等のものに変更しています。
https://pnpm.io/ja/cli/audit#--prod--p

- run: pnpm lint
run-npm-test:
steps:
- run: yarn test -w 1
- run: yarn test:build-assets
- run: pnpm test -- -w 1
- run: pnpm test:build-assets
run-a11y-test:
steps:
- checkout
- restore_cache:
keys:
- yarn-packages-reg-{{ checksum "yarn.lock" }}
- run: yarn install --frozen-lockfile
- pnpm-packages-reg-{{ checksum "pnpm-lock.yaml" }}
- run: pnpm install
- save_cache:
paths:
- ~/.cache/yarn
key: yarn-packages-reg-{{ checksum "yarn.lock" }}
- ~/.cache/pnpm
key: pnpm-packages-reg-{{ checksum "pnpm-lock.yaml" }}
- run:
command: yarn build-storybook
command: pnpm build-storybook
- run:
command: npx http-server storybook-static --port 6006 --silent
background: true
- run:
command: yarn test-storybook:ci
command: pnpm test-storybook:ci
- store_test_results:
path: junit.xml
run-chromatic:
steps:
- checkout
- run: yarn run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed
- run: pnpm run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --exit-zero-on-changes --only-changed
run-chromatic-master:
steps:
- checkout
- run: yarn run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed
- run: pnpm run chromatic --project-token=${CHROMATIC_PROJECT_TOKEN} --auto-accept-changes --only-changed
install-noto-sans-cjk-jp:
steps:
- run:
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,16 @@ jobs:
browser: [chrome]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Use yarn cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: 'pnpm'
Copy link
Member Author

Choose a reason for hiding this comment

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

キャッシュに関してはこれだけで良さそうでした。
https://pnpm.io/ja/continuous-integration#github-actions

- name: run
run: |
yarn install --frozen-lockfile
yarn e2e
pnpm install
pnpm e2e
env:
TESTCAFE_BROWSER: ${{ matrix.browser }}
9 changes: 6 additions & 3 deletions .github/workflows/publishRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
with:
ref: release-candidate
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
Expand All @@ -25,10 +28,10 @@ jobs:
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- run: yarn install --frozen-lockfile
- run: yarn release
- run: pnpm install
- run: pnpm release
if: ${{ env.IS_PRERELEASE == 'false' }}
- run: yarn release --prerelease
- run: pnpm release --prerelease
if: ${{ env.IS_PRERELEASE == 'true' }}
- run: npm publish
if: ${{ env.IS_PRERELEASE == 'false' }}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/startRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
Expand All @@ -34,13 +37,13 @@ jobs:
BASE_TAG=v$(npx -c 'echo "$npm_package_version"')
git checkout $BASE_TAG
git merge --no-edit ${{ github.ref }}
- run: yarn install --frozen-lockfile
- run: pnpm install
- name: release dry run
if: ${{ env.IS_PRERELEASE == 'false' }}
run: yarn release:dryrun > ${{ env.RESULT_PATH }}
run: pnpm release:dryrun > ${{ env.RESULT_PATH }}
- name: prerelease dry run
if: ${{ env.IS_PRERELEASE == 'true' }}
run: yarn release:dryrun --prerelease > ${{ env.RESULT_PATH }}
run: pnpm release:dryrun --prerelease > ${{ env.RESULT_PATH }}
- name: wrap dry run log
run: |
echo "Dry Run Log:
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ Thank you for reading this!

## Setup

We use `yarn` for the package manager.
We use `pnpm` for the package manager.

```sh
$ yarn
$ pnpm
```

## Test

```sh
$ yarn test
$ pnpm test
```

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

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

```sh
$ yarn test:update-snapshot
$ pnpm test:update-snapshot
```

## Commit
Expand Down Expand Up @@ -94,7 +94,7 @@ import { ComponentName } from 'smarthr-ui'
## Release

```sh
$ yarn release
$ pnpm release
```

We use `standard-version` to release npm packages.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ npm install smarthr-ui

// with yarn
yarn add smarthr-ui

// with pnpm
pnpm add smarthr-ui
```

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

// with yarn
yarn add react react-dom styled-components

// with pnpm
pnpm add react react-dom styled-components
```

## 使いかた
Expand Down
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@storybook/addon-a11y": "^7.6.15",
"@storybook/addon-actions": "^7.6.15",
"@storybook/addon-essentials": "^7.6.15",
"@storybook/addon-interactions": "^7.6.15",
"@storybook/addon-storysource": "^7.6.15",
Expand Down Expand Up @@ -163,7 +164,7 @@
"test": "jest",
"test:update-snapshot": "jest --updateSnapshot",
"test:build-assets": "node scripts/build-test.ts",
"test-storybook:ci": "wait-on tcp:6006 && yarn test-storybook --maxWorkers=2 --junit",
"test-storybook:ci": "wait-on tcp:6006 && pnpm test-storybook --maxWorkers=2 --junit",
"testcafe": "testcafe",
"e2e": "ts-node scripts/e2e.ts",
"e2e:dev": "testcafe chrome --host localhost --skip-js-errors",
Expand All @@ -176,12 +177,14 @@
"*.css"
],
"typings": "lib/index.d.ts",
"resolutions": {
"@babel/helper-compilation-targets": "^7.23.6",
"@types/react": "^18.2.55",
"minimist": "1.2.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"pnpm": {
"overrides": {
"@babel/helper-compilation-targets": "^7.23.6",
"@types/react": "^18.2.55",
"minimist": "1.2.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
Comment on lines +180 to +187
Copy link
Member Author

@Tokky0425 Tokky0425 Feb 15, 2024

Choose a reason for hiding this comment

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

yarn の resolutions と同等の記述になります。
https://pnpm.io/ja/package_json#pnpmoverrides

},
"standard-version": {
"scripts": {
Expand Down
Loading
Loading