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
14 changes: 1 addition & 13 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
<!-- Thank you for contributing to @sigrea/react! -->

## Purpose
<!-- One sentence on what this PR solves. Add `Closes #123` if relevant. -->

## Summary
<!-- Scope touched and user impact. Note breaking changes or migration steps if any. -->

## Verification
<!--
Quick checks run. If not run, say why.

CI also validates PR titles as Conventional Commits.
-->
- [ ] `vp run cicheck`
<!-- Explain the change. Link related issues and note any breaking changes. -->
28 changes: 4 additions & 24 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,14 @@ jobs:
concurrency: publish-${{ github.ref }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: voidzero-dev/setup-vp@cab1ab9eaff52d4857875f4f2c016e36af8f2c76 # v1.22.0
with:
node-version-file: .node-version
cache: true
run-install: false
- run: vp install --frozen-lockfile
- run: vp run cicheck
- name: Detect already-published version
id: npmcheck
run: |
set -euo pipefail
NAME=$(node -p "require('./package.json').name")
VERSION=$(node -p "require('./package.json').version")
if npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
echo "published=true" >> "$GITHUB_OUTPUT"
else
echo "published=false" >> "$GITHUB_OUTPUT"
fi

- name: Pack publishable tarball (resolve pnpm catalogs)
if: steps.npmcheck.outputs.published != 'true'
run: pnpm pack --out "$RUNNER_TEMP/sigrea-package.tgz"

- name: npm publish (OIDC trusted publishing)
if: steps.npmcheck.outputs.published != 'true'
run: npm publish "$RUNNER_TEMP/sigrea-package.tgz" --access public

- name: Sync GitHub Release notes via changelogen
- run: node scripts/release.js publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: vp exec changelogen gh release ${{ github.ref_name }} --token "${GITHUB_TOKEN}"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
set -e
vp staged
vp test run
58 changes: 33 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
# Contributing to @sigrea/react

Thank you for contributing! This project uses a PR-based workflow with required CI checks.
## Development

## Requirements

Install [Vite+](https://viteplus.dev/guide/). Node.js and pnpm versions are pinned
in `.node-version` and `package.json`.
Install [Vite+](https://viteplus.dev/guide/). Node.js and pnpm versions are set in
`.node-version` and `package.json`.

```sh
vp env install
vp install --frozen-lockfile
```

## Commands

- `vp check` — format, lint, and TypeScript checks
- `vp test run` — unit tests
- `vp check` — formatting, lint, and TypeScript checks
- `vp test run` — tests
- `vp test run --coverage` — coverage
- `vp pack` — ESM/CJS bundles and declarations
- `vp fmt` — format source files
- `vp run cicheck` — checks, tests, packaging, and smoke checks

The pre-commit hook fixes staged files and runs the test suite.
The pre-commit hook checks and fixes staged files. Run `vp run cicheck` before
opening a PR.

Use a Conventional Commit title, such as `fix: stop a watcher after disposal`.
The title becomes the squash commit message and is used to generate the changelog.
Mention any breaking changes, manual checks, or known issues in the PR description.

## Commit Convention
## Releasing

Conventional Commits are required. Examples: `feat: ...`, `fix(scope): ...`, `docs: ...`.
The main branch uses squash merges, so the PR title becomes the final commit message.
Releases use stable `x.y.z` versions. Start on a clean `main` matching `origin/main`:

## Changelog Entries
```sh
vp run notes
SIGREA_RELEASE_VERSION=x.y.z vp run release_version
vp run push_release
```

Changelogen reads Conventional Commits directly, so please keep commit messages descriptive. Any user-facing change (features, fixes, deprecations, breaking updates) should have a clear `feat`, `fix`, or similar commit. Non-user-facing changes can use `chore`, `test`, etc. For PRs that squash multiple commits, summarize the user impact in the PR description so release managers can double-check the changelog entry.
`notes` previews the changelog. `release_version` runs the checks, updates the
version and CHANGELOG, then creates a commit and an annotated tag. The version
must be newer than the current version, and the tag must not already exist.

## Pull Requests
`push_release` asks before pushing main and the release tag together. If either
update fails, neither is pushed. It does not push other local tags.

Ensure the following before requesting review:
`vp run cicheck` passes and the PR title follows Conventional Commits.
The tag workflow publishes to npm using OIDC, then creates the GitHub Release
from CHANGELOG with `gh`. Reruns leave existing release notes alone.

## Release Workflow
If preparation fails, check `git status` and `git log` before retrying. It may have
already changed the version or created a commit.

This repository uses [changelogen](https://github.com/unjs/changelogen) to update `CHANGELOG.md` and create the release commit plus tag. Releases use an explicit version so maintainers do not depend on an inferred bump.
## Failed releases

1. Ensure `main` is up to date and clean. Run `vp run notes` if you want to preview the generated notes without touching the tree.
2. Run `SIGREA_RELEASE_VERSION=x.y.z vp run release_version`. This runs `vp run cicheck`, updates the changelog, amends the release commit if formatting changes are needed, and creates the annotated `vX.Y.Z` tag.
3. Push the commit and tag together with `vp run push_release`. The task uses `git push origin main --follow-tags`.
4. Tag pushes run `.github/workflows/publish.yml` in the `release` environment and publish to npm through OIDC.
Rerun a failed publish job on the same tag. If the version is already on npm, the
job skips npm publication and creates the GitHub Release if it is missing.

If the publish workflow fails, fix the root cause and re-run the job from the GitHub Actions UI. Avoid creating a new tag unless you intend to cut a new release. If you must roll back, delete the tag locally and remotely, revert the release commit, and start over from step 1.
If the tagged code needs changing, cut a new version. Do not move a tag that has
already been pushed. Published npm versions cannot be reused, even after
unpublishing.
22 changes: 0 additions & 22 deletions changelog.config.ts

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"prepare": "vp config --no-agent",
"playground:build": "vp build --config playground/vite.config.ts",
"notes": "vp exec changelogen --no-output",
"release_version": "sh scripts/release-version.sh",
"push_release": "sh scripts/push-release.sh"
"release_version": "node scripts/release.js prepare",
"push_release": "node scripts/release.js push"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.5",
Expand All @@ -63,6 +63,7 @@
"jsdom": "^24.1.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"semver": "^7.7.3",
"typescript": "5.9.3",
"vite": "catalog:",
"vite-plus": "catalog:",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions scripts/push-release.sh

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/release-version.sh

This file was deleted.

Loading
Loading