0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-11 09:15:31 +02:00

build: update pnpm to v11 (#37591)

Update to https://github.com/pnpm/pnpm/releases/tag/v11.0.0

- move all pnpm settings to `pnpm-workspace.yaml`, pnpm v11 only reads
that file
- drop redundant or no-op settings
- disable `strictDepBuilds` to avoid having to manually specify deps
with build scripts, this is equivalent to v10 where it will not execute
and warn.
- add workarounds for https://github.com/SukkaW/nolyfill/issues/119
- remove dead eslintrc entry

---
This PR was written with the help of Claude Opus 4.7

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
silverwind 2026-05-08 06:17:20 +02:00 committed by GitHub
parent bba748e8b5
commit b4085c7e3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 80 additions and 49 deletions

View File

@ -71,15 +71,15 @@ jobs:
- "assets/emoji.json"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "Makefile"
- ".eslintrc.cjs"
- ".npmrc"
docs:
- "**/*.md"
- ".markdownlint.yaml"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
actions:
- ".github/workflows/*"
@ -108,6 +108,7 @@ jobs:
- "Makefile"
- "package.json"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- ".spectral.yaml"
yaml:

View File

@ -44,7 +44,7 @@ jobs:
go-version-file: go.mod
check-latest: true
cache: false
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
@ -130,7 +130,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

View File

@ -29,7 +29,7 @@ jobs:
with:
cache-name: e2e
build-cache: "false"
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

View File

@ -22,7 +22,7 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

View File

@ -23,7 +23,7 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

View File

@ -26,7 +26,7 @@ jobs:
with:
go-version-file: go.mod
check-latest: true
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24

7
.npmrc
View File

@ -1,7 +0,0 @@
audit=false
fund=false
update-notifier=false
save-exact=true
auto-install-peers=true
dedupe-peer-dependents=false
enable-pre-post-scripts=true

View File

@ -3,7 +3,7 @@
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.23 AS frontend-build
RUN apk --no-cache add build-base git nodejs pnpm
WORKDIR /src
COPY package.json pnpm-lock.yaml .npmrc ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
COPY --exclude=.git/ . .
RUN make frontend

View File

@ -3,7 +3,7 @@
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.23 AS frontend-build
RUN apk --no-cache add build-base git nodejs pnpm
WORKDIR /src
COPY package.json pnpm-lock.yaml .npmrc ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile
COPY --exclude=.git/ . .
RUN make frontend

View File

@ -613,6 +613,7 @@ update-js: node_modules ## update js dependencies
.PHONY: nolyfill
nolyfill: node_modules ## apply nolyfill overrides to package.json and relock
pnpm exec nolyfill install
node tools/migrate-nolyfills.ts
pnpm install
@touch node_modules

View File

@ -1,9 +1,9 @@
{
"type": "module",
"packageManager": "pnpm@10.33.2",
"packageManager": "pnpm@11.0.8",
"engines": {
"node": ">= 22.18.0",
"pnpm": ">= 10.0.0"
"pnpm": ">= 11.0.0"
},
"dependencies": {
"@citation-js/core": "0.7.21",
@ -124,34 +124,5 @@
"updates": "17.16.8",
"vitest": "4.1.5",
"vue-tsc": "3.2.8"
},
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {
"eslint-plugin-github>eslint": ">=9"
}
},
"overrides": {
"array-includes": "npm:@nolyfill/array-includes@^1",
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@^1",
"array.prototype.flat": "npm:@nolyfill/array.prototype.flat@^1",
"array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@^1",
"es-aggregate-error": "npm:@nolyfill/es-aggregate-error@^1",
"hasown": "npm:@nolyfill/hasown@^1",
"is-core-module": "npm:@nolyfill/is-core-module@^1",
"object.assign": "npm:@nolyfill/object.assign@^1",
"object.fromentries": "npm:@nolyfill/object.fromentries@^1",
"object.groupby": "npm:@nolyfill/object.groupby@^1",
"object.values": "npm:@nolyfill/object.values@^1",
"safe-buffer": "npm:@nolyfill/safe-buffer@^1",
"safe-regex-test": "npm:@nolyfill/safe-regex-test@^1",
"safer-buffer": "npm:@nolyfill/safer-buffer@^1",
"string.prototype.includes": "npm:@nolyfill/string.prototype.includes@^1",
"string.prototype.trimend": "npm:@nolyfill/string.prototype.trimend@^1",
"object-keys": "npm:@nolyfill/object-keys@^1",
"object.entries": "npm:@nolyfill/object.entries@^1",
"abab": "npm:@nolyfill/abab@^1",
"es-set-tostringtag": "npm:@nolyfill/es-set-tostringtag@^1"
}
}
}

32
pnpm-workspace.yaml Normal file
View File

@ -0,0 +1,32 @@
packages: [.] # workaround for https://github.com/SukkaW/nolyfill/issues/119
savePrefix: ''
dedupePeerDependents: false
updateNotifier: false
strictDepBuilds: false
minimumReleaseAge: 0
peerDependencyRules:
allowedVersions:
eslint-plugin-github>eslint: '>=9'
overrides:
array-includes: npm:@nolyfill/array-includes@^1
array.prototype.findlastindex: npm:@nolyfill/array.prototype.findlastindex@^1
array.prototype.flat: npm:@nolyfill/array.prototype.flat@^1
array.prototype.flatmap: npm:@nolyfill/array.prototype.flatmap@^1
es-aggregate-error: npm:@nolyfill/es-aggregate-error@^1
hasown: npm:@nolyfill/hasown@^1
is-core-module: npm:@nolyfill/is-core-module@^1
object.assign: npm:@nolyfill/object.assign@^1
object.fromentries: npm:@nolyfill/object.fromentries@^1
object.groupby: npm:@nolyfill/object.groupby@^1
object.values: npm:@nolyfill/object.values@^1
safe-buffer: npm:@nolyfill/safe-buffer@^1
safe-regex-test: npm:@nolyfill/safe-regex-test@^1
safer-buffer: npm:@nolyfill/safer-buffer@^1
string.prototype.includes: npm:@nolyfill/string.prototype.includes@^1
string.prototype.trimend: npm:@nolyfill/string.prototype.trimend@^1
object-keys: npm:@nolyfill/object-keys@^1
object.entries: npm:@nolyfill/object.entries@^1
abab: npm:@nolyfill/abab@^1
es-set-tostringtag: npm:@nolyfill/es-set-tostringtag@^1

View File

@ -85,7 +85,7 @@
"matchManagers": ["npm"],
"postUpgradeTasks": {
"commands": ["make svg nolyfill"],
"fileFilters": ["package.json", "pnpm-lock.yaml", "public/assets/img/svg/**"],
"fileFilters": ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", "public/assets/img/svg/**"],
"executionMode": "branch",
},
},

View File

@ -0,0 +1,33 @@
#!/usr/bin/env node
// nolyfill writes overrides to package.json#pnpm.overrides which pnpm v11 ignores.
// This moves them to pnpm-workspace.yaml until SukkaW/nolyfill#119 is fixed.
import {readFileSync, writeFileSync} from 'node:fs';
import {exit} from 'node:process';
import {fileURLToPath} from 'node:url';
import {dump} from 'js-yaml';
const packagePath = fileURLToPath(new URL('../package.json', import.meta.url));
const workspacePath = fileURLToPath(new URL('../pnpm-workspace.yaml', import.meta.url));
const packageJson: {pnpm?: {overrides?: Record<string, string>}} = JSON.parse(readFileSync(packagePath, 'utf8'));
const overrides = packageJson.pnpm?.overrides;
if (!overrides || !Object.keys(overrides).length) {
exit(0);
}
const block = dump({overrides}, {lineWidth: -1, quotingType: "'"});
const workspace = readFileSync(workspacePath, 'utf8');
const overridesRegex = /^overrides:[^\n]*(?:\n(?:[ \t][^\n]*|[ \t]*(?=\n[ \t])))*\n?/m;
if (!overridesRegex.test(workspace)) {
console.error(`No 'overrides:' block found in pnpm-workspace.yaml`);
exit(1);
}
writeFileSync(workspacePath, workspace.replace(overridesRegex, block));
const pnpm = packageJson.pnpm!;
delete pnpm.overrides;
if (!Object.keys(pnpm).length) delete packageJson.pnpm;
writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}\n`);