Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 41504ff

Browse files
Tom Lienardchambo-e
Tom Lienard
andauthored
chore: migrate to pnpm (#137)
* feat: migrate to pnpm * fix: test unit coverage script * ci: use alpine images * ci: pnpm/action-setup version * fix: resolve review * fix: cleanup * fix: cleanup * fix: cleanup * fix: remove manual hoisting * fix: rebase * fix: revert hoisting Co-authored-by: Emmanuel Chambon <[email protected]>
1 parent 041a89d commit 41504ff

17 files changed

+16405
-21741
lines changed

.dockerignore

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,10 @@
33
# dependancies
44

55
node_modules/
6-
.yarn/*
7-
!.yarn/patches
8-
!.yarn/releases
9-
!.yarn/plugins
10-
!.yarn/sdks
11-
!.yarn/versions
12-
.pnp.*
136

14-
# we are using yarn here
7+
# we are using pnpm here
158
package-lock.json
9+
yarn.lock
1610

1711
# misc
1812
.DS_Store

.github/renovate.json

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"reviewersSampleSize": 2,
88
"prHourlyLimit": 5,
99
"prConcurrentLimit": 10,
10-
"postUpdateOptions": ["yarnDedupeHighest"],
1110
"labels": ["dependencies"],
1211
"rangeStrategy": "pin",
1312
"semanticCommitType": "chore",

.github/workflows/ci.yml

+20-15
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,27 @@ jobs:
1212
runs-on: ubuntu-20.04
1313
steps:
1414
- uses: actions/[email protected]
15+
- uses: pnpm/[email protected]
1516
- name: Use Node.js
1617
uses: actions/[email protected]
1718
with:
1819
node-version: 16
19-
cache: 'yarn'
20-
- run: yarn
21-
- run: yarn run build
22-
- run: yarn run tsc --noEmit
20+
cache: 'pnpm'
21+
- run: pnpm install
22+
- run: pnpm run build
23+
- run: pnpm tsc --noEmit
2324
lint:
2425
runs-on: ubuntu-20.04
2526
steps:
2627
- uses: actions/[email protected]
28+
- uses: pnpm/[email protected]
2729
- name: Use Node.js
2830
uses: actions/[email protected]
2931
with:
3032
node-version: 16
31-
cache: 'yarn'
32-
- run: yarn
33-
- run: yarn run lint
33+
cache: 'pnpm'
34+
- run: pnpm install
35+
- run: pnpm run lint
3436
test:
3537
runs-on: ubuntu-20.04
3638
strategy:
@@ -40,13 +42,14 @@ jobs:
4042
- uses: actions/[email protected]
4143
with:
4244
fetch-depth: "0"
45+
- uses: pnpm/[email protected]
4346
- name: Use Node.js
4447
uses: actions/[email protected]
4548
with:
4649
node-version: ${{ matrix.node }}
47-
cache: 'yarn'
48-
- run: yarn
49-
- run: yarn run test:unit:coverage
50+
cache: 'pnpm'
51+
- run: pnpm install
52+
- run: pnpm run test:unit:coverage
5053
- uses: codecov/[email protected]
5154
build:
5255
strategy:
@@ -56,12 +59,13 @@ jobs:
5659
needs: [lint, test]
5760
steps:
5861
- uses: actions/[email protected]
62+
- uses: pnpm/[email protected]
5963
- name: Use Node.js
6064
uses: actions/[email protected]
6165
with:
6266
node-version: ${{ matrix.node }}
63-
- run: yarn install
64-
- run: yarn run build
67+
- run: pnpm install
68+
- run: pnpm run build
6569
deploy:
6670
runs-on: ubuntu-20.04
6771
needs: [build]
@@ -74,13 +78,14 @@ jobs:
7478
with:
7579
fetch-depth: 0
7680
persist-credentials: false
81+
- uses: pnpm/[email protected]
7782
- name: Use Node.js
7883
uses: actions/[email protected]
7984
with:
8085
node-version: 16
81-
- run: yarn install
82-
- run: yarn run build
83-
- run: yarn run semantic-release
86+
- run: pnpm install
87+
- run: pnpm run build
88+
- run: pnpm run semantic-release
8489
env:
8590
HUSKY: 0
8691
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/pull_request_title.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ jobs:
99
runs-on: ubuntu-20.04
1010
steps:
1111
- uses: actions/[email protected]
12+
- uses: pnpm/[email protected]
1213
- name: Use Node.js
1314
uses: actions/[email protected]
1415
with:
1516
node-version: 16
16-
cache: 'yarn'
17-
- run: yarn
18-
- run: echo '${{ github.event.pull_request.title }}' | yarn run commitlint
17+
cache: 'pnpm'
18+
- run: pnpm install
19+
- run: echo '${{ github.event.pull_request.title }}' | pnpm commitlint

.gitignore

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# dependencies
22
node_modules/
3-
.yarn/*
4-
!.yarn/patches
5-
!.yarn/releases
6-
!.yarn/plugins
7-
!.yarn/sdks
8-
!.yarn/versions
9-
.pnp.*
103

11-
# we are using yarn here
4+
# we are using pnpm here
125
package-lock.json
6+
yarn.lock
137

148
# misc
159
.DS_Store

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn run commitlint --edit $1
4+
pnpm commitlint --edit $1

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn run lint-staged
4+
pnpm lint-staged

.husky/pre-push

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn run lint-staged
4+
pnpm lint-staged

.npmrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# rollup-plugin-dts needs packages to be hoisted
2+
# https://pnpm.io/npmrc#public-hoist-pattern
3+
# https://github.com/microsoft/TypeScript/issues/29808
4+
public-hoist-pattern[]='*types*'
5+
public-hoist-pattern[]='*emotion*'
6+
public-hoist-pattern[]='*nivo*'
7+
public-hoist-pattern[]='*xstyled*'
8+
public-hoist-pattern[]='*reakit*'
9+
public-hoist-pattern[]='*scaleway*'
10+
public-hoist-pattern[]='*react-select*'

.yarn/releases/yarn-3.2.0.cjs

-785
This file was deleted.

.yarnrc.yml

-3
This file was deleted.

Dockerfile

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
FROM node:17.7-alpine as builder
55
WORKDIR /usr/src/app
66

7-
COPY package.json yarn.lock .yarnrc.yml ./
8-
COPY .yarn ./.yarn
7+
COPY package.json pnpm-lock.yaml ./
98

10-
11-
RUN yarn --immutable --inline-builds
9+
RUN corepack enable
10+
RUN pnpm install --frozen-lockfile
1211

1312
COPY . .
1413

15-
RUN yarn run build:storybook
14+
RUN pnpm run build:storybook
1615

1716
######################################################################
1817
# This stage download a simple http server and serve the application #
@@ -23,6 +22,6 @@ WORKDIR /workspace
2322

2423
COPY --from=builder /usr/src/app/storybook-static .
2524

26-
RUN yarn global add http-server
25+
RUN npm add -g http-server
2726

2827
CMD http-server -g -b -p 80

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,35 @@
1818
},
1919
"engines": {
2020
"node": ">=14.x",
21-
"yarn": ">=3.x"
21+
"pnpm": ">=6.x"
2222
},
2323
"os": [
2424
"darwin",
2525
"linux"
2626
],
27-
"packageManager": "[email protected].0",
27+
"packageManager": "[email protected].0",
2828
"sideEffects": false,
2929
"main": "dist/index.js",
3030
"module": "dist/index.js",
3131
"jsnext:main": "dist/index.js",
3232
"types": "dist/index.d.ts",
3333
"scripts": {
3434
"build": "rollup -c",
35-
"build:profile": "cross-env PROFILE=true yarn run build",
35+
"build:profile": "cross-env PROFILE=true pnpm run build",
3636
"build:storybook": "STORYBOOK_ENVIRONMENT=production build-storybook",
3737
"check:deps": "npx depcheck . --skip-missing=true --ignores='bin,eslint,webpack,jest,husky,@semantic-release/*,@commitlint/*,@babel/*,babel-*'",
3838
"commit": "npx git-cz -a",
3939
"start": "STORYBOOK_ENVIRONMENT=development start-storybook -p 6006",
4040
"start:production": "STORYBOOK_ENVIRONMENT=production start-storybook -p 6006",
4141
"format": "prettier --write '**/*.{ts,tsx}'",
42-
"lint:fix": "yarn run lint --fix",
42+
"lint:fix": "pnpm run lint -- --fix",
4343
"lint": "eslint --cache --ext ts,tsx .",
4444
"prebuild": "shx rm -rf dist",
45-
"test:unit:coverage": "yarn run test:unit --coverage",
46-
"test:watch": "yarn run test --watch",
47-
"test:update": "yarn run test --updateSnapshot",
45+
"test:unit:coverage": "pnpm run test -- --coverage",
46+
"test:watch": "pnpm run test -- --watch",
47+
"test:update": "pnpm run test -- --updateSnapshot",
4848
"test": "LC_ALL=en_US.UTF-8 jest",
49-
"test:unit": "yarn test",
49+
"test:unit": "pnpm test",
5050
"prepare": "husky install"
5151
},
5252
"lint-staged": {
@@ -88,7 +88,7 @@
8888
]
8989
],
9090
"transformIgnorePatterns": [
91-
"node_modules/(?!@scaleway)"
91+
"node_modules/(?!(.*(@scaleway)))"
9292
],
9393
"setupFilesAfterEnv": [
9494
"@testing-library/jest-dom"

0 commit comments

Comments
 (0)