Add npm publishing automation

This commit is contained in:
Federico Jaramillo Martinez
2026-05-08 16:55:24 +02:00
parent 5b339e192d
commit d602e4857a
5 changed files with 378 additions and 6 deletions
+35
View File
@@ -0,0 +1,35 @@
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
verify:
name: Verify and package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify
run: npm run verify
- name: Build
run: npm run build
- name: Check npm package contents
run: npm run pack:dry
+40
View File
@@ -0,0 +1,40 @@
name: Publish npm package
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
environment: npm
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm ci
- name: Verify
run: npm run verify
- name: Build
run: npm run build
- name: Publish
run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+15
View File
@@ -153,6 +153,21 @@ npm run start:sessiond
PI_WEB_PORT=8504 npm start
```
## Packaging and publishing
```bash
npm run verify
npm run pack:dry
npm publish --access public
```
`prepack` builds `dist/` before npm creates the tarball, and `prepublishOnly` runs verification before publishing. Releases can also be published by the GitHub Actions npm workflow when a GitHub release is published.
Pi Web uses a single-line CalVer-inspired npm version: `MAJOR.YYYYMM.SEQUENCE`, for example `1.202605.1`. The major number signals breaking-change eras; the middle number is the release month; the final number increments for additional releases in that month. Older major eras may be deprecated rather than maintained in parallel.
Pi Web declares `@earendil-works/pi-coding-agent` as a peer dependency (`>=0.74.0 <1`) and a development dependency for local builds. This keeps published installs flexible: npm 7+ installs the peer automatically, and users can upgrade the Pi package within the compatible range without Pi Web pinning a separate copy.
The web server defaults to `127.0.0.1:8504`. Set `PI_WEB_HOST=0.0.0.0` only when you intentionally want to bind directly on all interfaces.
The session daemon defaults to a private Unix socket at:
+262 -3
View File
File diff suppressed because it is too large Load Diff
+26 -3
View File
@@ -1,6 +1,6 @@
{
"name": "pi-web",
"version": "0.0.1",
"version": "1.202605.1",
"license": "MIT",
"type": "module",
"bin": {
@@ -26,7 +26,12 @@
"test": "vitest run --config vitest.config.ts",
"verify": "npm run typecheck && npm run lint && npm test",
"start": "tsx src/server/index.ts",
"start:sessiond": "tsx src/server/sessiond.ts"
"start:sessiond": "tsx src/server/sessiond.ts",
"clean": "rm -rf dist",
"prepack": "npm run build",
"pack:dry": "npm pack --dry-run",
"prepublishOnly": "npm run verify",
"publish:npm": "npm publish --access public"
},
"dependencies": {
"@codemirror/lang-css": "^6.3.1",
@@ -38,7 +43,6 @@
"@codemirror/lang-python": "^6.2.1",
"@codemirror/lang-rust": "^6.0.2",
"@codemirror/legacy-modes": "^6.5.2",
"@earendil-works/pi-coding-agent": "^0.74.0",
"@fastify/static": "^8.3.0",
"@fastify/websocket": "^11.2.0",
"@xterm/addon-fit": "^0.11.0",
@@ -51,6 +55,7 @@
"ws": "^8.18.3"
},
"devDependencies": {
"@earendil-works/pi-coding-agent": "^0.74.0",
"@eslint/js": "^10.0.1",
"@types/node": "^24.10.1",
"@types/ws": "^8.18.1",
@@ -61,5 +66,23 @@
"typescript-eslint": "^8.59.2",
"vite": "^7.2.4",
"vitest": "^4.1.5"
},
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=22"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jmfederico/pi-web.git"
},
"bugs": {
"url": "https://github.com/jmfederico/pi-web/issues"
},
"homepage": "https://github.com/jmfederico/pi-web#readme",
"packageManager": "[email protected]",
"peerDependencies": {
"@earendil-works/pi-coding-agent": ">=0.74.0 <1"
}
}