Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/publish-on-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: publish-on-tag

on:
push:
tags:
- '*'

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for OIDC (npm Trusted Publishing)
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
cache: npm
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Publish
run: npm publish --provenance --access public
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,24 @@ project illustrating how to use the plugin in practice.

## Publishing

**Googlers:** We use [go/wombat-dressing-room](http://go/wombat-dressing-room)
for publishing.
The package is published to npm by the
[`publish-on-tag`](.github/workflows/publish-on-tag.yml) GitHub Actions
workflow, which uses npm [trusted publishing](https://docs.npmjs.com/trusted-publishers)
(no npm tokens involved) and generates
[provenance attestations](https://docs.npmjs.com/generating-provenance-statements).

To publish a new version:

1. Bump the `version` in `package.json` and land that change on `main`.
2. Tag the release commit and push the tag:

```sh
git tag v1.2.3
git push origin v1.2.3
```

Pushing the tag triggers the workflow, which builds and tests the package and
then runs `npm publish`.

## License

Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,5 @@
"typescript": "^5.7.3",
"vite": "^8.0.16",
"vitest": "^4.1.8"
},
"publishConfig": {
"registry": "https://wombat-dressing-room.appspot.com"
}
}
4 changes: 4 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ describe('#VitePluginDevToolsJson', () => {
server: {
port,
host: true,
// Disable Vite's built-in host validation, which (depending on the
// Vite version) runs before plugin middlewares and would answer this
// request itself, so that the plugin's own check is exercised.
allowedHosts: true,
},
});

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"noImplicitAny": true,
"noUnusedLocals": true,
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"sourceMap": false,
"outDir": "dist",
"target": "ES2020",
Expand Down
Loading