Skip to content

Commit c451918

Browse files
committedJun 28, 2024·
feat(package-manager): migrate from yarn to pnpm
1 parent 5dd3332 commit c451918

13 files changed

+9968
-12098
lines changed
 

‎.github/workflows/cicd.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: "${{ github.repository }}"
12-
12+
HUSKY: 0
1313
jobs:
1414

1515
build:

‎.github/workflows/lint.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
- name: Install dependencies and config
2121
run: |
2222
corepack enable
23-
yarn
24-
yarn graphql
25-
yarn ioc-generate
23+
pnpm install
24+
pnpm graphql
25+
pnpm ioc-generate
2626
2727
- name: Check types
28-
run: yarn check-types
28+
run: pnpm check-types
2929

3030
- name: ESlint
31-
run: yarn lint
31+
run: pnpm lint
3232

3333
- name: Check formatting
34-
run: yarn prettier-check
34+
run: pnpm prettier-check

‎.husky/install.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if (process.env.NODE_ENV === "production" || process.env.CI === "true") {
2+
process.exit(0);
3+
}
4+
const husky = (await import("husky")).default;
5+
console.log(husky());

‎.lintstagedrc.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
"**/*": [() => "just nvm-exec 'yarn check-types'", () => "just nvm-exec 'yarn lint'", "yarn prettier-check"]
2+
"**/*": [() => "just nvm-exec 'pnpm check-types'", () => "just nvm-exec 'pnpm lint'", () => "just nvm-exec 'pnpm prettier-check'"]
33
};

‎.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
build
22
coverage
3-
yarn.lock
3+
./.husky/install.mjs
4+
*.yaml
45
*.yml
56
*.json
67
*.md

‎.yarnrc.yml

-11
This file was deleted.

‎Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ WORKDIR /app
44

55
RUN corepack enable
66

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

9-
RUN yarn install
9+
RUN pnpm install
1010

1111
COPY . .
1212

1313
RUN --mount=type=secret,id=env_variables \
1414
cat /run/secrets/env_variables > .env
1515

16-
RUN yarn ioc-generate
16+
RUN pnpm ioc-generate
1717

1818
# Un comment if using graphql instead of REST
19-
# RUN yarn graphql
19+
# RUN pnpm graphql
2020

21-
RUN yarn build
21+
RUN pnpm build
2222

2323
FROM nginx
2424

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ nvm install
3535
```
3636

3737
Finally, enable [corepack](https://github.com/nodejs/corepack) so the correct
38-
version of yarn is used.
38+
version of pnpm is used.
3939

4040
```shell
4141
just corepack-enable
@@ -72,7 +72,7 @@ just
7272
**Proxy commands through nvm**
7373

7474
```shell
75-
just nvm-exec "yarn add @front_web_mrmilu/hooks"
75+
just nvm-exec "pnpm add @front_web_mrmilu/hooks"
7676
```
7777

7878
### Environment variables

‎justfile

+15-11
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,53 @@ corepack-enable:
77

88
# Installs project package.json dependencies
99
install-deps:
10-
./nvm_exec.sh yarn
10+
./nvm_exec.sh pnpm install
1111

1212
# Starts React development server
1313
dev:
14-
./nvm_exec.sh yarn dev
14+
./nvm_exec.sh pnpm dev
1515

1616
ioc-generate-watch:
17-
./nvm_exec.sh yarn ioc-generate --watch
17+
./nvm_exec.sh pnpm ioc-generate --watch
1818

1919
# Starts React debug server
2020
debug:
21-
./nvm_exec.sh yarn debug
21+
./nvm_exec.sh pnpm debug
2222

2323
# Builds React application
2424
build:
25-
./nvm_exec.sh yarn build
25+
./nvm_exec.sh pnpm build
2626

2727
ioc-generate:
28-
./nvm_exec.sh yarn ioc-generate
28+
./nvm_exec.sh pnpm ioc-generate
2929

3030
# Preview Vite build
3131
preview:
32-
./nvm_exec.sh yarn preview
32+
./nvm_exec.sh pnpm preview
3333

3434
# Clean Vite cache
3535
clean:
3636
rm -rf node_modules/.vite
3737

3838
# Styles files following prettier guidelines
3939
prettier-fix:
40-
./nvm_exec.sh yarn prettier-fix
40+
./nvm_exec.sh pnpm prettier-fix
4141

4242
# Downloads schema and generates corresponding ts types
4343
graphql-codegen:
44-
./nvm_exec.sh yarn graphql
44+
./nvm_exec.sh pnpm graphql
4545

4646
# Runs E2E tests
4747
e2e-run:
48-
./nvm_exec.sh yarn e2e:run
48+
./nvm_exec.sh pnpm e2e:run
4949

5050
# Opens E2E tests UI
5151
e2e-open:
52-
./nvm_exec.sh yarn e2e:open
52+
./nvm_exec.sh pnpm e2e:open
53+
54+
# Opens E2E tests UI
55+
commit:
56+
./nvm_exec.sh pnpm commit
5357

5458
# Proxy comand through nvm
5559
nvm-exec command:

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"ioc-generate": "inversify-generator",
1818
"prettier-fix": "prettier ./src --write --ignore-unknown",
1919
"prettier-check": "prettier ./src --check --ignore-unknown",
20-
"prepare": "husky"
20+
"prepare": "node .husky/install.mjs"
2121
},
2222
"dependencies": {
2323
"@apollo/client": "~3.9.5",
@@ -93,5 +93,5 @@
9393
"vite": "~5.1.3",
9494
"vite-plugin-svgr": "~4.2.0"
9595
},
96-
"packageManager": "yarn@4.1.0"
96+
"packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a"
9797
}

0 commit comments

Comments
 (0)