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
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v5

- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 20
node-version: 24
cache: pnpm

- run: pnpm install --frozen-lockfile
Expand All @@ -33,3 +33,6 @@ jobs:
- run: pnpm lint

- run: pnpm test

- name: Verify installed package
run: bash scripts/smoke-package.sh
23 changes: 18 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Release
on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -11,28 +12,39 @@ concurrency:
jobs:
release:
name: Version or publish
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0

- uses: pnpm/action-setup@v4
- uses: pnpm/action-setup@v5

- uses: actions/setup-node@v4
- uses: actions/setup-node@v5
with:
node-version: 20
node-version: 24
cache: pnpm
registry-url: https://registry.npmjs.org

- run: pnpm install --frozen-lockfile

- run: pnpm build
- name: Typecheck package
run: pnpm --filter @web-kits/audio typecheck

- name: Test package
run: pnpm --filter @web-kits/audio test

- name: Build package
run: pnpm --filter @web-kits/audio build

- name: Verify installed package
run: bash scripts/smoke-package.sh

- name: Create Release PR or publish
uses: changesets/action@v1
Expand All @@ -44,4 +56,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,32 @@ pnpm changeset

Follow the prompts to describe what changed and the semver bump type. This creates a markdown file in `.changeset/` that gets consumed during release.

## Publishing

The Release workflow on `main` versions packages with Changesets, or publishes
unpublished package versions when no changesets remain. It typechecks, tests, and
builds `@web-kits/audio` independently of the private website and marketing apps.
It also installs a packed tarball in a temporary project and checks the library
import and executable CLI. Run this check locally after building:

```bash
bash scripts/smoke-package.sh
```

Configure the repository's `NPM_TOKEN` Actions secret with permission to publish
`@web-kits/audio`. The workflow passes this secret as both `NPM_TOKEN` for
Changesets and `NODE_AUTH_TOKEN` for the npm configuration created by setup-node.

If publishing fails after a version bump, fix the underlying error and rerun the
Release workflow from Actions on `main` using **Run workflow**. Keep the existing
package version when it has not yet been published; a new changeset is not needed
for a release workflow repair. Verify the result with:

```bash
npm view @web-kits/audio version
npm view @web-kits/[email protected] version
```

## Commit convention

Commits must follow [Conventional Commits](https://www.conventionalcommits.org/). A `commitlint` hook enforces this automatically.
Expand Down
4 changes: 4 additions & 0 deletions packages/audio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.2.0

### Patch Changes

- Restore the Node.js interpreter header so the installed `audio` CLI runs correctly.

### Minor Changes

- ec45185: Add a `jitter` option to `PlayOptions` for per-voice random variation. Pick any combination of `detune` (cents), `volume` (fraction), and `playbackRate` (fraction) to humanize repeated triggers — so buttons pressed in quick succession no longer sound identical.
Expand Down
1 change: 1 addition & 0 deletions packages/audio/src/bin.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node
import { run } from "./commands/index.js";

run();
28 changes: 28 additions & 0 deletions scripts/smoke-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail

repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
smoke_dir="$(mktemp -d)"
trap 'rm -rf "$smoke_dir"' EXIT

cd "$repo_dir/packages/audio"
expected_version="$(node -p 'require("./package.json").version')"
npm pack --pack-destination "$smoke_dir" --json > "$smoke_dir/pack.json"
tarball="$(node -p 'JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"))[0].filename' "$smoke_dir/pack.json")"

npm install --prefix "$smoke_dir/consumer" "$smoke_dir/$tarball" \
--ignore-scripts --no-audit --no-fund

cd "$smoke_dir/consumer"
node --input-type=module -e '
import { defineSound } from "@web-kits/audio";
if (typeof defineSound !== "function") throw new Error("Missing defineSound export");
'

actual_version="$(./node_modules/.bin/audio --version)"
if [[ "$actual_version" != "$expected_version" ]]; then
echo "Expected CLI version $expected_version, got $actual_version" >&2
exit 1
fi
./node_modules/.bin/audio --help
echo "Packed @web-kits/audio@$expected_version passed installation and CLI checks."