Switch from yarn to pnpm.

This commit is contained in:
Dessalines 2024-01-28 12:12:03 -05:00
parent 1787a778f8
commit 5ab901b11f
7 changed files with 7723 additions and 10356 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn lint-staged
pnpm lint-staged

View file

@ -4,10 +4,10 @@ FROM node:21-alpine as builder
# Done for two reasons:
# - libvips binaries are not available for ARM32
# - It can break depending on the CPU (https://github.com/LemmyNet/lemmy-ui/issues/1566)
RUN apk update && apk upgrade && apk add --no-cache curl yarn python3 build-base gcc wget git vips-dev pkgconfig
RUN apk update && apk upgrade && apk add --no-cache curl python3 build-base gcc wget git vips-dev pkgconfig
# Install node-gyp
RUN npm install -g node-gyp
# Install node-gyp and pnpm
RUN npm install -g pnpm node-gyp
WORKDIR /usr/src/app
@ -15,10 +15,8 @@ ENV npm_config_target_platform=linux
ENV npm_config_target_libc=musl
# Cache deps
COPY package.json yarn.lock ./
RUN yarn --production --prefer-offline --pure-lockfile --network-timeout 100000
COPY package.json pnpm-lock.yaml ./
RUN pnpm i --production --prefer-offline
# Build
COPY generate_translations.js \
tsconfig.json \
@ -33,15 +31,13 @@ COPY .git .git
# Set UI version
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
RUN yarn --production --prefer-offline --network-timeout 100000
RUN yarn build:prod
RUN pnpm i --production --prefer-offline
RUN pnpm build:prod
RUN rm -rf ./node_modules/import-sort-parser-typescript
RUN rm -rf ./node_modules/typescript
RUN rm -rf ./node_modules/npm
RUN du -sh ./node_modules/* | sort -nr | grep '\dM.*'
FROM node:21-alpine as runner
ENV NODE_ENV=production

View file

@ -9,7 +9,7 @@ new_tag="$1"
# sudo docker push dessalines/lemmy-ui:$new_tag
# Upgrade version
yarn version --new-version $new_tag
npm version $new_tag
git push
git tag $new_tag

View file

@ -1,5 +1,6 @@
FROM node:20-alpine as builder
RUN apk update && apk add curl yarn python3 build-base gcc wget git --no-cache
RUN apk update && apk add curl python3 build-base gcc wget git --no-cache
RUN npm install -g pnpm
WORKDIR /usr/src/app
@ -8,8 +9,8 @@ ENV npm_config_target_platform=linux
ENV npm_config_target_libc=musl
# Cache deps
COPY package.json yarn.lock ./
RUN yarn --prefer-offline --pure-lockfile
COPY package.json pnpm-lock.yaml ./
RUN pnpm i --prefer-offline
# Build
COPY generate_translations.js \
@ -25,8 +26,8 @@ COPY .git .git
# Set UI version
RUN echo "export const VERSION = 'dev';" > "src/shared/version.ts"
RUN yarn --prefer-offline
RUN yarn build:dev
RUN pnpm i --prefer-offline
RUN pnpm build:dev
FROM node:20-alpine as runner
COPY --from=builder /usr/src/app/dist /app/dist
@ -34,4 +35,4 @@ COPY --from=builder /usr/src/app/node_modules /app/node_modules
EXPOSE 1234
WORKDIR /app
CMD node dist/js/server.js
CMD node dist/js/server.js

View file

@ -8,17 +8,17 @@
"analyze": "webpack --mode=none",
"build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development",
"build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production",
"clean": "yarn run rimraf dist",
"dev": "yarn build:dev --watch",
"lint": "yarn translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
"clean": "pnpm rimraf dist",
"dev": "pnpm build:dev --watch",
"lint": "pnpm translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
"postinstall": "husky install",
"prebuild:dev": "yarn clean && node generate_translations.js",
"prebuild:prod": "yarn clean && node generate_translations.js",
"prebuild:dev": "pnpm clean && node generate_translations.js",
"prebuild:prod": "pnpm clean && node generate_translations.js",
"prepare": "husky install",
"themes:build": "sass src/assets/css/themes/:src/assets/css/themes",
"themes:watch": "sass --watch src/assets/css/themes/:src/assets/css/themes",
"translations:generate": "node generate_translations.js",
"translations:init": "git submodule init && yarn translations:update",
"translations:init": "git submodule init && pnpm translations:update",
"translations:update": "git submodule update --remote --recursive"
},
"repository": "https://github.com/LemmyNet/lemmy-ui",
@ -51,7 +51,6 @@
"express": "~4.18.2",
"history": "^5.3.0",
"html-to-text": "^9.0.5",
"husky": "^8.0.3",
"i18next": "^23.7.16",
"inferno": "^8.2.3",
"inferno-create-element": "^8.2.3",
@ -111,6 +110,7 @@
"eslint-plugin-inferno": "^7.33.3",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.1.3",
"husky": "^8.0.3",
"import-sort-style-module": "^6.0.0",
"lint-staged": "^15.2.0",
"prettier": "^3.2.4",
@ -138,7 +138,7 @@
"sortpack"
]
},
"packageManager": "yarn@1.22.19",
"packageManager": "pnpm@8.14.3",
"engineStrict": true,
"importSort": {
".js, .jsx, .ts, .tsx": {

7699
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

10329
yarn.lock

File diff suppressed because it is too large Load diff