diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index e3d2c15..993ed1c 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -1,13 +1,12 @@ name: Stage → Verdaccio -# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub), on every merge -# to main. Publishes the package as-is — version comes from package.json (a prerelease -# like 26.7.1-beta.N) — to the internal Verdaccio under the `stg` dist-tag. This registry -# rejects overwriting an existing version, so the step unpublishes it first (a no-op on the -# first publish) then publishes fresh. +# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release +# branches. Publishes prereleases to the internal Verdaccio under the `stg` dist-tag. +# Staging versions are intentionally mutable: an existing prerelease is removed before +# publishing the updated release candidate under the same version. on: push: - branches: [main] + branches: ['release/**'] jobs: publish-stg: @@ -19,13 +18,18 @@ jobs: with: node-version: '22' - run: npm ci - # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) - # as its own gate before anything leaves the machine. - - name: Publish to Verdaccio (unpublish + publish) + - run: npm audit + - name: Validate release candidate + run: npm run prepublishOnly + - name: Publish prerelease to Verdaccio env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }} run: | npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN" VER=$(node -p "require('./package.json').version") + case "$VER" in + *-*) ;; + *) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;; + esac npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true - npm publish --registry https://npm.svc.zoit.services --tag stg + npm publish --ignore-scripts --registry https://npm.svc.zoit.services --tag stg diff --git a/package-lock.json b/package-lock.json index 97da65b..f62ff56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1194,9 +1194,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1214,9 +1211,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1234,9 +1228,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1254,9 +1245,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1274,9 +1262,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1294,9 +1279,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1314,9 +1296,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1334,9 +1313,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1354,9 +1330,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1380,9 +1353,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1406,9 +1376,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1432,9 +1399,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1458,9 +1422,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1484,9 +1445,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1510,9 +1468,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1536,9 +1491,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -7976,9 +7928,9 @@ } }, "node_modules/undici": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.28.0.tgz", - "integrity": "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index c9e3eaa..36a63a8 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,17 @@ { "name": "@green-tea/core", "version": "26.8.0-beta.0", - "description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.", + "description": "A zen, opinionated, type-safe framework \u2014 your API is a graph, not a middleware chain.", "license": "MIT", "author": "green-tea contributors", + "repository": { + "type": "git", + "url": "git+https://github.com/Expressive-Tea/green-tea.git" + }, + "bugs": { + "url": "https://github.com/Expressive-Tea/green-tea/issues" + }, + "homepage": "https://green-tea.expressive-tea.io/docs/", "keywords": [ "http", "framework", @@ -118,7 +126,8 @@ "hyperid": { "uuid": "11.1.1" } - } + }, + "undici": "7.29.0" }, "devDependencies": { "@eslint/js": "^9.39.5", diff --git a/test/package-metadata.test.ts b/test/package-metadata.test.ts new file mode 100644 index 0000000..6790f86 --- /dev/null +++ b/test/package-metadata.test.ts @@ -0,0 +1,33 @@ +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; + +import { describe, expect, it } from 'vitest'; + +interface PackageMetadata { + readonly repository?: { + readonly type?: string; + readonly url?: string; + }; + readonly bugs?: { + readonly url?: string; + }; + readonly homepage?: string; +} + +const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata; + +describe('package publication metadata', () => { + it('links npm provenance to the public GitHub repository', () => { + expect(packageJson.repository).toEqual({ + type: 'git', + url: 'git+https://github.com/Expressive-Tea/green-tea.git', + }); + }); + + it('links npm consumers to support and documentation', () => { + expect(packageJson.bugs).toEqual({ + url: 'https://github.com/Expressive-Tea/green-tea/issues', + }); + expect(packageJson.homepage).toBe('https://green-tea.expressive-tea.io/docs/'); + }); +}); diff --git a/test/staging-workflow.test.ts b/test/staging-workflow.test.ts new file mode 100644 index 0000000..e216dc6 --- /dev/null +++ b/test/staging-workflow.test.ts @@ -0,0 +1,17 @@ +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; + +import { describe, expect, it } from 'vitest'; + +const workflow = readFileSync(resolve(process.cwd(), '.github/workflows/stage.yml'), 'utf8'); + +describe('Verdaccio staging workflow', () => { + it('replaces mutable prereleases only from release branches', () => { + expect(workflow).toContain("branches: ['release/**']"); + expect(workflow).toContain('npm audit'); + expect(workflow).toContain('npm run prepublishOnly'); + expect(workflow).toContain('npm unpublish'); + expect(workflow).toContain('npm publish --ignore-scripts'); + expect(workflow).not.toContain('scripts/staging-integrity.ts'); + }); +}); diff --git a/website/package-lock.json b/website/package-lock.json index 95d845d..dd061ab 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -70,9 +70,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -89,9 +86,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -108,9 +102,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -127,9 +118,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3848,9 +3836,9 @@ } }, "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "funding": [ { "type": "github",