Skip to content

Commit 140ff82

Browse files
authored
Move to pnpm (#2345)
* Switch from yarn to pnpm. * Moving from yarn to pnpm. * Try 2 * Try 3 * Try 4 * Try 5 * Try 6 * Adding qs. * Try corepack. * Remove comment. * Adding prebuild:dev. * Some fixes. * Fixing up husky. * Fixing up version and others.
1 parent 1787a77 commit 140ff82

9 files changed

+7769
-10400
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
"plugins": [
1616
"@babel/plugin-transform-runtime",
1717
["babel-plugin-inferno", { "imports": true }],
18-
["@babel/plugin-proposal-class-properties", { "loose": true }]
18+
["@babel/plugin-transform-class-properties", { "loose": true }]
1919
]
2020
}

.husky/pre-commit

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
4-
yarn lint-staged
1+
pnpm lint-staged

.woodpecker.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1+
variables:
2+
- &install_pnpm "corepack enable pnpm"
3+
14
steps:
25
fetch_git_submodules:
36
image: node:20-alpine
47
commands:
58
- apk add git
69
- git submodule init
710
- git submodule update --recursive --remote
8-
# - git fetch --tags
911

10-
yarn:
12+
install:
1113
image: node:20-alpine
1214
commands:
13-
- yarn
15+
- *install_pnpm
16+
- pnpm i
1417

15-
yarn_lint:
18+
lint:
1619
image: node:20-alpine
1720
commands:
18-
- yarn lint
21+
- *install_pnpm
22+
- pnpm lint
1923

20-
yarn_build_dev:
24+
build_dev:
2125
image: node:20-alpine
2226
commands:
23-
- yarn build:dev
27+
- *install_pnpm
28+
- pnpm prebuild:dev
29+
- pnpm build:dev
2430

2531
publish_release_docker:
2632
image: woodpeckerci/plugin-docker-buildx

Dockerfile

+8-11
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,19 @@ FROM node:21-alpine as builder
44
# Done for two reasons:
55
# - libvips binaries are not available for ARM32
66
# - It can break depending on the CPU (https://github.com/LemmyNet/lemmy-ui/issues/1566)
7-
RUN apk update && apk upgrade && apk add --no-cache curl yarn python3 build-base gcc wget git vips-dev pkgconfig
7+
RUN apk update && apk upgrade && apk add --no-cache curl python3 build-base gcc wget git vips-dev pkgconfig
88

9-
# Install node-gyp
10-
RUN npm install -g node-gyp
9+
# Install node-gyp and pnpm
10+
RUN npm install -g pnpm node-gyp
1111

1212
WORKDIR /usr/src/app
1313

1414
ENV npm_config_target_platform=linux
1515
ENV npm_config_target_libc=musl
1616

1717
# Cache deps
18-
COPY package.json yarn.lock ./
19-
20-
RUN yarn --production --prefer-offline --pure-lockfile --network-timeout 100000
21-
18+
COPY package.json pnpm-lock.yaml ./
19+
RUN pnpm i
2220
# Build
2321
COPY generate_translations.js \
2422
tsconfig.json \
@@ -33,15 +31,14 @@ COPY .git .git
3331
# Set UI version
3432
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
3533

36-
RUN yarn --production --prefer-offline --network-timeout 100000
37-
RUN yarn build:prod
34+
RUN pnpm i
35+
RUN pnpm prebuild:prod
36+
RUN pnpm build:prod
3837

3938
RUN rm -rf ./node_modules/import-sort-parser-typescript
4039
RUN rm -rf ./node_modules/typescript
4140
RUN rm -rf ./node_modules/npm
4241

43-
RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'
44-
4542
FROM node:21-alpine as runner
4643
ENV NODE_ENV=production
4744

deploy.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ new_tag="$1"
99
# sudo docker push dessalines/lemmy-ui:$new_tag
1010

1111
# Upgrade version
12-
yarn version --new-version $new_tag
12+
pnpm version $new_tag
1313
git push
1414

1515
git tag $new_tag

dev.dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FROM node:20-alpine as builder
2-
RUN apk update && apk add curl yarn python3 build-base gcc wget git --no-cache
2+
RUN apk update && apk add curl python3 build-base gcc wget git --no-cache
3+
RUN npm install -g pnpm
34

45
WORKDIR /usr/src/app
56

@@ -8,8 +9,8 @@ ENV npm_config_target_platform=linux
89
ENV npm_config_target_libc=musl
910

1011
# Cache deps
11-
COPY package.json yarn.lock ./
12-
RUN yarn --prefer-offline --pure-lockfile
12+
COPY package.json pnpm-lock.yaml ./
13+
RUN pnpm i --prefer-offline
1314

1415
# Build
1516
COPY generate_translations.js \
@@ -25,13 +26,13 @@ COPY .git .git
2526
# Set UI version
2627
RUN echo "export const VERSION = 'dev';" > "src/shared/version.ts"
2728

28-
RUN yarn --prefer-offline
29-
RUN yarn build:dev
29+
RUN pnpm i --prefer-offline
30+
RUN pnpm build:dev
3031

3132
FROM node:20-alpine as runner
3233
COPY --from=builder /usr/src/app/dist /app/dist
3334
COPY --from=builder /usr/src/app/node_modules /app/node_modules
3435

3536
EXPOSE 1234
3637
WORKDIR /app
37-
CMD node dist/js/server.js
38+
CMD node dist/js/server.js

package.json

+41-41
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,49 @@
88
"analyze": "webpack --mode=none",
99
"build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development",
1010
"build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production",
11-
"clean": "yarn run rimraf dist",
12-
"dev": "yarn build:dev --watch",
13-
"lint": "yarn translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
14-
"postinstall": "husky install",
15-
"prebuild:dev": "yarn clean && node generate_translations.js",
16-
"prebuild:prod": "yarn clean && node generate_translations.js",
17-
"prepare": "husky install",
11+
"clean": "pnpm rimraf dist",
12+
"dev": "pnpm build:dev --watch",
13+
"lint": "pnpm translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
14+
"prebuild:dev": "pnpm clean && node generate_translations.js",
15+
"prebuild:prod": "pnpm clean && node generate_translations.js",
16+
"prepare": "husky",
1817
"themes:build": "sass src/assets/css/themes/:src/assets/css/themes",
1918
"themes:watch": "sass --watch src/assets/css/themes/:src/assets/css/themes",
2019
"translations:generate": "node generate_translations.js",
21-
"translations:init": "git submodule init && yarn translations:update",
20+
"translations:init": "git submodule init && pnpm translations:update",
2221
"translations:update": "git submodule update --remote --recursive"
2322
},
2423
"repository": "https://github.com/LemmyNet/lemmy-ui",
2524
"engines": {
2625
"node": ">=8.9.0"
2726
},
2827
"dependencies": {
29-
"@babel/plugin-proposal-class-properties": "^7.18.6",
30-
"@babel/plugin-proposal-decorators": "^7.23.7",
31-
"@babel/plugin-transform-runtime": "^7.23.7",
28+
"@babel/plugin-proposal-decorators": "^7.23.9",
29+
"@babel/plugin-transform-class-properties": "^7.23.3",
30+
"@babel/plugin-transform-runtime": "^7.23.9",
3231
"@babel/plugin-transform-typescript": "^7.23.6",
33-
"@babel/preset-env": "^7.23.8",
34-
"@babel/preset-typescript": "^7.21.5",
35-
"@babel/runtime": "^7.23.8",
36-
"@emoji-mart/data": "^1.1.0",
37-
"@shortcm/qr-image": "^9.0.2",
32+
"@babel/preset-env": "^7.23.9",
33+
"@babel/preset-typescript": "^7.23.3",
34+
"@babel/runtime": "^7.23.9",
35+
"@emoji-mart/data": "^1.1.2",
36+
"@shortcm/qr-image": "^9.0.4",
3837
"autosize": "^6.0.1",
3938
"babel-loader": "^9.1.3",
4039
"babel-plugin-inferno": "^6.7.1",
41-
"bootstrap": "^5.3.1",
40+
"bootstrap": "^5.3.2",
4241
"check-password-strength": "^2.0.7",
4342
"classnames": "^2.5.1",
4443
"clean-webpack-plugin": "^4.0.0",
4544
"cookie": "^0.6.0",
4645
"copy-webpack-plugin": "^12.0.2",
4746
"css-loader": "^6.9.1",
48-
"date-fns": "^3.2.0",
49-
"emoji-mart": "^5.4.0",
47+
"date-fns": "^3.3.1",
48+
"emoji-mart": "^5.5.2",
5049
"emoji-short-name": "^2.0.0",
5150
"express": "~4.18.2",
5251
"history": "^5.3.0",
5352
"html-to-text": "^9.0.5",
54-
"husky": "^8.0.3",
55-
"i18next": "^23.7.16",
53+
"i18next": "^23.8.0",
5654
"inferno": "^8.2.3",
5755
"inferno-create-element": "^8.2.3",
5856
"inferno-helmet": "^5.2.1",
@@ -86,44 +84,46 @@
8684
"tippy.js": "^6.3.7",
8785
"toastify-js": "^1.12.0",
8886
"tributejs": "^5.1.3",
89-
"webpack": "^5.89.0",
87+
"webpack": "^5.90.0",
9088
"webpack-cli": "^5.1.4",
9189
"webpack-node-externals": "^3.0.0"
9290
},
9391
"devDependencies": {
94-
"@babel/core": "^7.23.7",
95-
"@types/autosize": "^4.0.0",
96-
"@types/bootstrap": "^5.2.6",
92+
"@babel/core": "^7.23.9",
93+
"@types/autosize": "^4.0.3",
94+
"@types/bootstrap": "^5.2.10",
9795
"@types/cookie": "^0.6.0",
98-
"@types/express": "^4.17.17",
99-
"@types/html-to-text": "^9.0.0",
100-
"@types/lodash.isequal": "^4.5.6",
96+
"@types/express": "^4.17.21",
97+
"@types/html-to-text": "^9.0.4",
98+
"@types/lodash.isequal": "^4.5.8",
10199
"@types/markdown-it": "^13.0.7",
102-
"@types/markdown-it-container": "^2.0.6",
103-
"@types/node": "^20.11.5",
104-
"@types/path-browserify": "^1.0.0",
105-
"@types/sanitize-html": "^2.9.0",
106-
"@types/serialize-javascript": "^5.0.1",
107-
"@types/toastify-js": "^1.12.0",
108-
"@typescript-eslint/eslint-plugin": "^6.19.0",
109-
"@typescript-eslint/parser": "^6.19.0",
100+
"@types/markdown-it-container": "^2.0.9",
101+
"@types/node": "^20.11.10",
102+
"@types/path-browserify": "^1.0.2",
103+
"@types/sanitize-html": "^2.9.5",
104+
"@types/serialize-javascript": "^5.0.4",
105+
"@types/toastify-js": "^1.12.3",
106+
"@typescript-eslint/eslint-plugin": "^6.19.1",
107+
"@typescript-eslint/parser": "^6.19.1",
110108
"eslint": "^8.56.0",
111109
"eslint-plugin-inferno": "^7.33.3",
112-
"eslint-plugin-jsx-a11y": "^6.7.1",
110+
"eslint-plugin-jsx-a11y": "^6.8.0",
113111
"eslint-plugin-prettier": "^5.1.3",
112+
"husky": "^9.0.6",
114113
"import-sort-style-module": "^6.0.0",
115114
"lint-staged": "^15.2.0",
116115
"prettier": "^3.2.4",
117116
"prettier-plugin-import-sort": "^0.0.7",
118-
"prettier-plugin-organize-imports": "^3.2.3",
117+
"prettier-plugin-organize-imports": "^3.2.4",
119118
"prettier-plugin-packagejson": "^2.4.9",
120-
"rimraf": "^5.0.0",
119+
"qs": "^6.11.2",
120+
"rimraf": "^5.0.5",
121121
"sortpack": "^2.4.0",
122122
"style-loader": "^3.3.4",
123123
"terser": "^5.27.0",
124124
"typescript": "^5.3.3",
125125
"typescript-language-server": "^4.3.1",
126-
"webpack-bundle-analyzer": "^4.9.0",
126+
"webpack-bundle-analyzer": "^4.10.1",
127127
"webpack-dev-server": "4.15.1"
128128
},
129129
"lint-staged": {
@@ -138,7 +138,7 @@
138138
"sortpack"
139139
]
140140
},
141-
"packageManager": "[email protected]",
141+
"packageManager": "[email protected]",
142142
"engineStrict": true,
143143
"importSort": {
144144
".js, .jsx, .ts, .tsx": {

0 commit comments

Comments
 (0)