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
6 changes: 2 additions & 4 deletions .codex/environments/environment.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ name = "react"

[setup]
script = '''
mise trust -y
eval "$(mise env -s bash)"
mise install
pnpm i --frozen-lockfile
vp env install
vp install --frozen-lockfile
'''
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<!--
Quick checks run. If not run, say why.

CI also validates PR title via semantic-pr.yml (Conventional Commits).
CI also validates PR titles as Conventional Commits.
-->
- [ ] `pnpm -s cicheck`
- [ ] `vp run cicheck`
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
- uses: voidzero-dev/setup-vp@cab1ab9eaff52d4857875f4f2c016e36af8f2c76 # v1.22.0
with:
node-version: 24
cache: 'pnpm'
node-version-file: .node-version
cache: true
run-install: false

- name: Validate PR title (Conventional Commits)
if: github.event_name == 'pull_request'
Expand All @@ -34,5 +34,5 @@ jobs:
}
NODE

- run: pnpm install
- run: pnpm -s cicheck
- run: vp install --frozen-lockfile
- run: vp run cicheck
26 changes: 12 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,34 @@ jobs:
concurrency: publish-${{ github.ref }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- uses: voidzero-dev/setup-vp@cab1ab9eaff52d4857875f4f2c016e36af8f2c76 # v1.22.0
with:
node-version: 24
- uses: pnpm/action-setup@v6
- run: pnpm install
- run: pnpm -s cicheck
- name: Ensure npm CLI supports trusted publishing
run: |
npm i -g npm@11.5.1
npm --version

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")
echo "name=$NAME" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
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 --access public
run: npm publish "$RUNNER_TEMP/sigrea-package.tgz" --access public

- name: Sync GitHub Release notes via changelogen
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm exec changelogen gh release ${{ github.ref_name }} --token "${GITHUB_TOKEN}"
run: vp exec changelogen gh release ${{ github.ref_name }} --token "${GITHUB_TOKEN}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ node_modules
dist
coverage
.DS_Store
.vitest/

.vite-hooks/_
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26.13.0
4 changes: 4 additions & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
vp staged
vp test run
35 changes: 21 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ Thank you for contributing! This project uses a PR-based workflow with required

## Requirements

Node.js >= 24 and pnpm >= 10.
TypeScript strict mode, Biome for formatting, Vitest for tests.
Install [Vite+](https://viteplus.dev/guide/). Node.js and pnpm versions are pinned
in `.node-version` and `package.json`.

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

`pnpm typecheck` — run TypeScript checks
`pnpm test` — run unit tests
`pnpm build` — build the library via unbuild
`pnpm format` — check formatting (no writes)
`pnpm format:fix` — apply formatting
`pnpm -s cicheck` — run test, typecheck, build, smoke, and format checks
## Commands

- `vp check` — format, lint, and TypeScript checks
- `vp test run` — unit 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.

## Commit Convention

Expand All @@ -28,15 +35,15 @@ Changelogen reads Conventional Commits directly, so please keep commit messages
## Pull Requests

Ensure the following before requesting review:
`pnpm -s cicheck` passes and the PR title follows Conventional Commits.
`vp run cicheck` passes and the PR title follows Conventional Commits.

## Release Workflow

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.

1. Ensure `main` is up to date and clean. Run `mise run notes` if you want to preview the generated notes without touching the tree.
2. Run `SIGREA_RELEASE_VERSION=x.y.z mise run release_version`. This runs `pnpm -s 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 `mise run push_release`. The task uses `git push origin main --follow-tags`.
4. Tag pushes trigger `.github/workflows/publish.yml`. The job runs on the `release` environment, installs dependencies, runs `pnpm -s cicheck`, publishes to npm with OIDC trusted publishing, and then syncs the GitHub Release body with `pnpm exec changelogen gh release`.
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.

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.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,20 +351,18 @@ createRoot(document.getElementById("root")!).render(<App />);

## Development

This repo targets Node.js 24 or later.
Install [Vite+](https://viteplus.dev/guide/), then run:

- `pnpm install` installs dependencies.
- `pnpm test` runs the Vitest suite once.
- `pnpm typecheck` runs TypeScript checks.
- `pnpm test:coverage` collects coverage.
- `pnpm build` builds CJS and ESM bundles with unbuild.
- `pnpm -s cicheck` runs the local CI chain.
- `pnpm dev` launches the playground counter demo.
```sh
vp env install
vp install --frozen-lockfile
vp run cicheck
```

If you use mise, run `mise trust -y` once before using mise tasks.
Run `vp run dev` to start the playground.

See [CONTRIBUTING.md](https://github.com/sigrea/react/blob/main/CONTRIBUTING.md)
for workflow details.
for individual commands and the release workflow.

## License

Expand Down
15 changes: 0 additions & 15 deletions biome.json

This file was deleted.

15 changes: 0 additions & 15 deletions build.config.ts

This file was deleted.

2 changes: 1 addition & 1 deletion changelog.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ChangelogConfig } from "changelogen";

const config: ChangelogConfig = {
const config: Partial<ChangelogConfig> = {
repo: "sigrea/react",
output: "CHANGELOG.md",
types: {
Expand Down
9 changes: 0 additions & 9 deletions lefthook.yml

This file was deleted.

31 changes: 0 additions & 31 deletions mise.toml

This file was deleted.

98 changes: 52 additions & 46 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,79 @@
"name": "@sigrea/react",
"version": "0.7.1",
"description": "React hooks for Sigrea molecules and signals.",
"license": "MIT",
"type": "module",
"packageManager": "pnpm@10.0.0",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sigrea/react.git"
},
"keywords": [
"molecule",
"react",
"reactivity",
"signals",
"typescript"
],
"homepage": "https://github.com/sigrea/react#readme",
"bugs": {
"url": "https://github.com/sigrea/react/issues"
},
"engines": {
"node": ">=24"
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/sigrea/react.git"
},
"files": [
"dist"
],
"type": "module",
"sideEffects": false,
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": ["dist"],
"keywords": ["signals", "reactivity", "react", "molecule", "typescript"],
"publishConfig": {
"access": "public"
},
"scripts": {
"dev": "vite --config playground/vite.config.ts",
"build": "unbuild",
"prepack": "unbuild",
"dev": "vp dev --config playground/vite.config.ts",
"prepack": "vp pack",
"smoke": "node --input-type=module -e \"const mod = await import('@sigrea/react'); for (const key of ['useMolecule', 'useSignal']) { if (typeof mod[key] !== 'function') throw new Error(key + ' export is missing'); }\" && node -e \"const mod = require('@sigrea/react'); for (const key of ['useMolecule', 'useSignal']) { if (typeof mod[key] !== 'function') throw new Error(key + ' export is missing'); }\"",
"changelog": "changelogen",
"test": "vitest run",
"test:coverage": "vitest --coverage",
"typecheck": "tsc -p tsconfig.json --noEmit",
"format": "biome check .",
"format:fix": "biome check --write .",
"cicheck": "pnpm -s test && pnpm -s typecheck && pnpm -s build && pnpm -s smoke && pnpm -s format"
},
"peerDependencies": {
"@sigrea/core": "^0.7.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
"cicheck": "vp check && vp test run && vp pack && vp run smoke",
"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"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@arethetypeswrong/core": "^0.18.5",
"@sigrea/core": "^0.7.0",
"@types/node": "^24.19.2",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/coverage-v8": "^3.2.4",
"baseline-browser-mapping": "^2.10.30",
"@vitejs/plugin-react": "6.1.0",
"@vitest/coverage-v8": "catalog:",
"changelogen": "^0.6.2",
"jsdom": "^24.1.3",
"lefthook": "1.13.6",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tsx": "^4.20.5",
"typescript": "5.9.3",
"unbuild": "3.6.1",
"vite": "^5.4.6",
"vitest": "^3.2.4"
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
},
"peerDependencies": {
"@sigrea/core": "^0.7.0",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"engines": {
"node": ">=24"
},
"pnpm": {
"onlyBuiltDependencies": ["lefthook", "@biomejs/biome"]
}
"packageManager": "pnpm@12.16.1"
}
Loading
Loading