Skip to content

Commit f0ea08d

Browse files
Modernize package and publishing workflows (#3)
Align Node support, CI, package metadata, and npm publishing safeguards. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7f2687a commit f0ea08d

5 files changed

Lines changed: 35 additions & 13 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [20.x, 22.x]
15+
node-version: [22.x, 24.x, 26.x]
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919

2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v4
21+
uses: actions/setup-node@v6
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: "npm"
@@ -34,4 +34,4 @@ jobs:
3434

3535
- name: Generate coverage report
3636
run: npm run test:coverage
37-
if: matrix.node-version == '20.x'
37+
if: matrix.node-version == '22.x'

‎.github/workflows/publish.yml‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ on:
44
push:
55
tags:
66
- "v*"
7+
workflow_dispatch:
8+
inputs:
9+
publish_mode:
10+
description: Choose dry-run for testing or publish to release
11+
required: true
12+
default: dry-run
13+
type: choice
14+
options:
15+
- dry-run
16+
- publish
717

818
permissions:
919
id-token: write # Required for OIDC
@@ -14,22 +24,33 @@ jobs:
1424
runs-on: ubuntu-latest
1525

1626
steps:
17-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v6
1828

1929
- name: Setup Node.js
20-
uses: actions/setup-node@v4
30+
uses: actions/setup-node@v6
2131
with:
22-
node-version: "20.x"
32+
node-version: "24.x"
2333
registry-url: "https://registry.npmjs.org"
2434

25-
- name: Update npm
26-
run: npm install -g npm@latest
35+
- name: Verify tag matches package version
36+
if: github.event_name == 'push'
37+
run: |
38+
expected_tag="v$(node -p "require('./package.json').version")"
39+
test "$GITHUB_REF_NAME" = "$expected_tag"
2740
2841
- name: Install dependencies
2942
run: npm ci
3043

44+
- name: Run linter
45+
run: npm run lint
46+
3147
- name: Run tests
3248
run: npm run test:run
3349

50+
- name: Dry-run npm publish
51+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish_mode != 'publish'
52+
run: npm publish --dry-run --access public
53+
3454
- name: Publish to npm
35-
run: npm publish
55+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_mode == 'publish')
56+
run: npm publish --provenance --access public

‎package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"types": "form-saver.d.ts",
2525
"exports": {
2626
".": {
27+
"types": "./form-saver.d.ts",
2728
"import": "./index.js"
2829
},
2930
"./form-saver.js": {
@@ -45,10 +46,9 @@
4546
"LICENSE"
4647
],
4748
"engines": {
48-
"node": ">=20.0.0"
49+
"node": ">=22.0.0"
4950
},
5051
"scripts": {
51-
"setup": "node scripts/setup.js",
5252
"test": "vitest",
5353
"test:ui": "vitest --ui",
5454
"test:run": "vitest run",

‎vitest.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config';
33
export default defineConfig({
44
test: {
55
environment: 'happy-dom',
6+
execArgv: ['--no-experimental-webstorage'],
67
globals: true,
78
setupFiles: ['./test/setup.js'],
89
},

0 commit comments

Comments
 (0)