build: migrate to pnpm (#772)

This commit is contained in:
Trim21
2024-08-10 04:36:38 +08:00
committed by GitHub
parent a078cfe2b0
commit 61ea0b445a
21 changed files with 14256 additions and 20130 deletions

View File

@@ -9,23 +9,36 @@ on:
- master
jobs:
build:
runs-on: ubuntu-20.04
build-real:
runs-on: ubuntu-24.04
strategy:
matrix:
node: [18, 20]
node: ['20', '22']
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
cache: 'pnpm'
- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm run build
- run: npm run start -- --help
build:
# so we do not need to update GitHub repo config
needs: build-real
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18', '20']
fail-fast: false
steps:
- run: echo pass

View File

@@ -9,23 +9,36 @@ on:
- master
jobs:
check:
runs-on: ubuntu-20.04
check-real:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
node: [20]
node: ['22']
check: [check-source-formatting, check-types, lint]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
cache: 'pnpm'
- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm run ${{ matrix.check }}
check:
# so we do not need to update GitHub repo config
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20']
check: [check-source-formatting, check-types, lint]
needs:
- check-real
steps:
- run: echo ok

View File

@@ -13,7 +13,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
@@ -27,15 +27,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -9,7 +9,7 @@ on:
jobs:
aur:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

View File

@@ -9,21 +9,22 @@ on:
jobs:
flood-bin:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
node: [20]
node: ['22']
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'
- name: Set up QEMU
run: |

View File

@@ -7,23 +7,25 @@ on:
jobs:
npm:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
node: [20]
node: ['22']
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: pnpm
- run: npm ci
- run: pnpm install --frozen-lockfile
- name: Tag rolling release
id: tag_release
@@ -64,7 +66,7 @@ jobs:
docker:
needs: npm
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
@@ -115,11 +117,11 @@ jobs:
RTORRENT_VERSION=master
docker-dbg:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
node: [20]
node: ['22']
steps:
- uses: actions/checkout@v4
@@ -129,7 +131,7 @@ jobs:
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -171,11 +173,11 @@ jobs:
pkg:
needs: npm
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
node: [20]
node: ['22']
steps:
- name: Use Node.js ${{ matrix.node }}
@@ -256,7 +258,7 @@ jobs:
docker-distroless:
needs: pkg
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

View File

@@ -7,7 +7,7 @@ on:
jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
strategy:
matrix:
@@ -16,15 +16,17 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node + 2 }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache: 'pnpm'
- run: sudo npm i -g pkg
- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm publish --access public
env:
@@ -70,7 +72,7 @@ jobs:
release-docker:
needs: release
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

View File

@@ -9,22 +9,23 @@ on:
- master
jobs:
test-backend:
test-backend-real:
runs-on: ubuntu-22.04
strategy:
matrix:
node: ['18', '20']
node: ['20', '22']
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
cache: 'pnpm'
- run: sudo add-apt-repository -y ppa:qbittorrent-team/qbittorrent-stable
- run: sudo add-apt-repository -y ppa:transmissionbt/ppa
@@ -34,7 +35,7 @@ jobs:
wget https://github.com/jesec/rtorrent/releases/latest/download/rtorrent-linux-amd64.deb
sudo dpkg -i rtorrent-linux-amd64.deb
- run: npm ci
- run: pnpm install --frozen-lockfile
- run: npm test || npm test || npm test
- uses: codecov/codecov-action@v3
@@ -46,3 +47,16 @@ jobs:
- run: npm test -- --selectProjects rtorrent || npm test -- --selectProjects rtorrent || npm test -- --selectProjects rtorrent
if: matrix['node'] == '20'
test-backend:
# so we do not need to update GitHub repo config
runs-on: ubuntu-latest
needs:
- test-backend-real
strategy:
matrix:
node: ['18', '20']
fail-fast: false
steps:
- run: echo pass

View File

@@ -10,7 +10,7 @@ on:
jobs:
synchronize-with-crowdin:
if: github.repository_owner == 'jesec'
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

View File

@@ -4,3 +4,4 @@ dist-pkg/
# Coverage reports
coverage/
pnpm-lock.yaml

View File

@@ -21,7 +21,7 @@ WORKDIR /usr/src/app/
COPY . ./
# Fetch dependencies from npm
RUN npm ci --legacy-peer-deps
RUN pnpm install --frozen-lockfile --legacy-peer-deps
# Build assets
RUN npm run build

View File

@@ -1,8 +1,8 @@
import {FC, lazy, Suspense} from 'react';
import {ComponentType, FC, lazy, Suspense} from 'react';
import packageJSON from '../../../../../../package.json';
const AboutMarkdown = lazy(() =>
const AboutMarkdown = lazy<ComponentType<{FloodVersion: unknown; CommitBadge: unknown}>>(() =>
import(/* webpackChunkName: 'about' */ '../../../../ABOUT.md').then((module) => ({default: module.react})),
);

View File

@@ -1,6 +1,7 @@
import {ClassNamesArg, cx} from '@emotion/css';
import {cx} from '@emotion/css';
import {FC} from 'react';
import {useLingui} from '@lingui/react';
import {ClassNamesArg} from '@emotion/react';
import AuthActions from '@client/actions/AuthActions';
import ConfigStore from '@client/stores/ConfigStore';

View File

@@ -1,5 +1,5 @@
# Use node alpine docker image
FROM docker.io/node:alpine
FROM docker.io/node:22-alpine
ARG PACKAGE=flood
ARG VERSION=latest

20060
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -40,12 +40,12 @@
"dist/geoip-country6.dat"
],
"targets": [
"node18-linuxstatic-x64",
"node18-linuxstatic-arm64",
"node18-macos-x64",
"node18-macos-arm64",
"node18-win-x64",
"node18-win-arm64"
"node20-linuxstatic-x64",
"node20-linuxstatic-arm64",
"node20-macos-x64",
"node20-macos-arm64",
"node20-win-x64",
"node20-win-arm64"
]
},
"scripts": {
@@ -82,12 +82,14 @@
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/modifiers": "^6.0.1",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.2",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/css": "^11.11.0",
"@emotion/react": "^11.11.1",
"@fastify/compress": "^6.5.0",
"@fastify/express": "^2.3.0",
"@fastify/static": "^6.10.2",
"@lingui/core": "^3.17.2",
"@lingui/loader": "^3.17.2",
"@lingui/react": "^3.17.2",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
@@ -98,6 +100,9 @@
"@types/cookie-parser": "^1.4.3",
"@types/create-torrent": "^5.0.0",
"@types/d3": "^7.4.0",
"@types/d3-array": "^3.2.1",
"@types/d3-scale": "^4.0.8",
"@types/d3-shape": "^3.1.6",
"@types/express": "^4.17.17",
"@types/fs-extra": "^9.0.13",
"@types/geoip-country": "^4.0.0",
@@ -106,14 +111,13 @@
"@types/jsonwebtoken": "^9.0.2",
"@types/lodash": "^4.14.195",
"@types/morgan": "^1.9.4",
"@types/node": "^12.20.55",
"@types/node": "^14.0.0",
"@types/parse-torrent": "^5.8.4",
"@types/passport": "^1.0.12",
"@types/passport-jwt": "^3.0.9",
"@types/react": "^18.2.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.2.4",
"@types/react-measure": "^2.0.8",
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "^4.4.6",
"@types/react-window": "^1.8.5",
"@types/supertest": "^2.0.12",
@@ -169,6 +173,7 @@
"jsonwebtoken": "^9.0.0",
"lint-staged": "^15.2.2",
"lodash": "^4.17.21",
"make-plural": "^7.4.0",
"mini-css-extract-plugin": "^2.7.6",
"mobx": "^6.9.0",
"mobx-react": "^7.6.0",
@@ -189,8 +194,8 @@
"react-dropzone": "^14.2.3",
"react-measure": "^2.5.2",
"react-refresh": "^0.14.0",
"react-router": "^6.12.1",
"react-router-dom": "^6.12.1",
"react-router": "^6.26.0",
"react-router-dom": "^6.26.0",
"react-transition-group": "^4.4.5",
"react-use": "^17.4.0",
"react-window": "^1.8.9",
@@ -210,7 +215,7 @@
"tsconfig-paths": "^4.2.0",
"tsx": "^4.6.2",
"typed-emitter": "^2.1.0",
"typescript": "~4.9.5",
"typescript": "~5.0.4",
"webpack": "^5.86.0",
"webpack-dev-server": "^4.15.1",
"webpack-shebang-plugin": "^1.1.8",
@@ -219,8 +224,7 @@
"zod": "^3.21.4"
},
"engines": {
"node": ">=12.0.0",
"npm": ">=6.0.0"
"node": ">=16.0.0"
},
"browserslist": [
"> 2%",
@@ -235,5 +239,6 @@
],
"lint-staged": {
"*": "prettier --ignore-unknown -w"
}
},
"packageManager": "pnpm@9.7.0"
}

14141
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
module.exports = {
transformIgnorePatterns: ['node_modules/(?!(p-queue|p-timeout)/)'],
transformIgnorePatterns: ['node_modules/.pnpm/(?!(p-queue|p-timeout).*/)'],
transform: {
// transform ESM only package to CommonJS
'^.+\\.(t|j)sx?$': [

View File

@@ -27,7 +27,7 @@ export const methodCallXML = (options: net.NetConnectOpts, methodName: string, p
const xmlLength = Buffer.byteLength(xml, 'utf8');
stream.on('error', reject);
stream.setEncoding('UTF8');
stream.setEncoding('utf8');
const headerItems = [
`CONTENT_LENGTH${NULL_CHAR}${xmlLength}${NULL_CHAR}`,
@@ -68,7 +68,7 @@ export const methodCallJSON = (options: net.NetConnectOpts, methodName: string,
const jsonLength = Buffer.byteLength(json, 'utf8');
stream.on('error', reject);
stream.setEncoding('UTF8');
stream.setEncoding('utf8');
const headerItems = [
`CONTENT_LENGTH${NULL_CHAR}${jsonLength}${NULL_CHAR}`,

View File

@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es2019",
"target": "es2020",
"moduleResolution": "node",
"allowJs": true,
"module": "commonjs",
@@ -9,6 +9,7 @@
"isolatedModules": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"useUnknownInCatchVariables": false,
"baseUrl": "../",
"paths": {
"@shared/*": ["shared/*"]

View File

@@ -15,6 +15,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"useDefineForClassFields": true,
"useUnknownInCatchVariables": false,
"baseUrl": "./",
"paths": {
"@client/*": ["client/src/javascript/*"],