Skip to content

Commit f12c3a6

Browse files
committed
docs(docs): add starlight site and alpha safeguards
1 parent e7e41ff commit f12c3a6

40 files changed

Lines changed: 4368 additions & 2921 deletions

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Upload Pages artifact
5252
uses: actions/upload-pages-artifact@v3
5353
with:
54-
path: docs-api
54+
path: docs-dist
5555

5656
- name: Deploy Pages
5757
id: deployment

.github/workflows/prerelease.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ name: Prerelease
33
on:
44
workflow_dispatch:
55
inputs:
6-
tag:
7-
description: npm dist-tag to publish
8-
required: true
9-
default: alpha
10-
type: choice
11-
options:
12-
- alpha
13-
- beta
14-
- rc
156
version_base:
167
description: Base version before prerelease suffix
178
required: true
@@ -51,7 +42,7 @@ jobs:
5142
5243
- name: Set prerelease version
5344
env:
54-
PACKAGE_VERSION: ${{ inputs.version_base }}-${{ inputs.tag }}.${{ github.run_number }}
45+
PACKAGE_VERSION: ${{ inputs.version_base }}-alpha.${{ github.run_number }}
5546
run: |
5647
node -e "const fs = require('node:fs'); const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); pkg.version = process.env.PACKAGE_VERSION; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');"
5748
node -e "const pkg = require('./package.json'); console.log(pkg.name + '@' + pkg.version);"
@@ -62,7 +53,16 @@ jobs:
6253
pnpm size
6354
6455
- name: Publish prerelease
65-
run: pnpm publish --tag "${{ inputs.tag }}" --access public --no-git-checks
56+
run: pnpm publish --tag alpha --access public --no-git-checks
57+
env:
58+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
59+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
61+
- name: Keep npm latest on current alpha
62+
run: |
63+
PACKAGE_NAME=$(node -p "require('./package.json').name")
64+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
65+
npm dist-tag add "$PACKAGE_NAME@$PACKAGE_VERSION" latest
6666
env:
6767
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6868
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Release
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
confirm_stable_release:
7+
description: Type "publish-stable" to publish the latest dist-tag.
8+
required: true
9+
default: alpha-only
510

611
permissions:
712
contents: write
@@ -14,6 +19,7 @@ concurrency:
1419

1520
jobs:
1621
release:
22+
if: github.ref_name == 'main' && inputs.confirm_stable_release == 'publish-stable'
1723
runs-on: ubuntu-latest
1824
steps:
1925
- name: Checkout
@@ -47,3 +53,13 @@ jobs:
4753
env:
4854
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4955
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
57+
stable-release-locked:
58+
if: inputs.confirm_stable_release != 'publish-stable'
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Stable release is locked
62+
run: |
63+
echo "Stable npm publishing is disabled by default."
64+
echo "Use the Prerelease workflow for alpha releases."
65+
echo "To intentionally publish latest, rerun this workflow with confirm_stable_release=publish-stable on main."

.github/workflows/size.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: read
11+
pull-requests: write
1112

1213
jobs:
1314
compare:
@@ -50,10 +51,36 @@ jobs:
5051
node scripts/size-report.mjs --json > ../base-size.json
5152
5253
- name: Compare size
54+
id: compare
5355
run: |
5456
if [ -f base-size.json ]; then
55-
node head/scripts/size-compare.mjs base-size.json head-size.json >> "$GITHUB_STEP_SUMMARY"
57+
node head/scripts/size-compare.mjs base-size.json head-size.json | tee size-summary.md >> "$GITHUB_STEP_SUMMARY"
5658
else
5759
echo "Base branch does not have size tooling yet. Head size:" >> "$GITHUB_STEP_SUMMARY"
5860
cat head-size.json >> "$GITHUB_STEP_SUMMARY"
61+
{
62+
echo "Base branch does not have size tooling yet. Head size:"
63+
cat head-size.json
64+
} > size-summary.md
5965
fi
66+
67+
- name: Comment size report
68+
if: github.event_name == 'pull_request'
69+
uses: actions/github-script@v7
70+
with:
71+
script: |
72+
const fs = require('node:fs');
73+
const marker = '<!-- react-timer-hook-size-report -->';
74+
const body = `${marker}
75+
## Bundle size
76+
77+
${fs.readFileSync('size-summary.md', 'utf8')}`;
78+
const { owner, repo } = context.repo;
79+
const issue_number = context.issue.number;
80+
const comments = await github.rest.issues.listComments({ owner, repo, issue_number, per_page: 100 });
81+
const existing = comments.data.find(comment => comment.body?.includes(marker));
82+
if (existing) {
83+
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
84+
} else {
85+
await github.rest.issues.createComment({ owner, repo, issue_number, body });
86+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ out
129129
.nuxt
130130
dist
131131
docs-api
132+
docs-dist
133+
.astro
132134

133135
# Gatsby files
134136
.cache/

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!dist/**
3+
!README.md
4+
!LICENSE
5+
!package.json

CONTRIBUTING.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
Thanks for considering a contribution.
44

5-
This project aims to stay small, deterministic, and heavily tested. Please read the requirements and API docs before proposing API changes:
5+
This project aims to stay small, deterministic, and heavily tested. Please read the public docs before proposing API changes:
66

7-
- [Requirements](./REQUIREMENTS.md)
8-
- [API Specification](./docs/API.md)
9-
- [Implementation Plan](./docs/IMPLEMENTATION.md)
10-
- [Task Plan](./docs/TASKS.md)
11-
- [Branching and Commits](./docs/BRANCHING_AND_COMMITS.md)
7+
- [Docs](https://crup.github.io/react-timer-hook/)
8+
- [useTimer](https://crup.github.io/react-timer-hook/api/use-timer/)
9+
- [useTimerGroup](https://crup.github.io/react-timer-hook/api/use-timer-group/)
1210

1311
## Project Boundaries
1412

@@ -50,12 +48,20 @@ pnpm test
5048
pnpm typecheck
5149
pnpm build
5250
pnpm docs:build
51+
pnpm size
5352
pnpm readme:check
5453
```
5554

5655
## Branches and Commit Messages
5756

58-
Use `feature/timer-core-v1` for the first implementation branch.
57+
Use short-lived branches:
58+
59+
- `feature/*` for features
60+
- `fix/*` for fixes
61+
- `docs/*` for docs
62+
- `chore/*` for maintenance
63+
64+
Alpha releases are published from `next`. Stable publishing is manually locked until the project intentionally switches to final releases.
5965

6066
Use Conventional Commits:
6167

@@ -73,8 +79,6 @@ docs(release): document alpha prerelease flow
7379

7480
Commit messages are enforced with commitlint through Husky. Changesets still own package versioning.
7581

76-
See [Branching and Commits](./docs/BRANCHING_AND_COMMITS.md) for the full branch, alpha, beta, release-candidate, and stable release flow.
77-
7882
## API Change Rules
7983

8084
Prefer recipes over new API.

0 commit comments

Comments
 (0)