Skip to content

Commit 91aa617

Browse files
committed
Add workflow and dependabot
1 parent 90b1747 commit 91aa617

15 files changed

Lines changed: 207 additions & 23 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
actions:
9+
patterns: ['*']
10+
- package-ecosystem: npm
11+
directory: /
12+
schedule:
13+
interval: weekly
14+
open-pull-requests-limit: 5
15+
groups:
16+
development-dependencies:
17+
dependency-type: development
18+
update-types: [minor, patch]

‎.github/pull_request_template.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Change
2+
3+
Describe the problem and resulting behavior. Link a related issue if applicable.
4+
5+
## Validation
6+
7+
Describe the checks you ran and include screenshots for visible UI changes.
8+
9+
- [ ] Relevant tests and documentation updated.
10+
- [ ] CI passes.
11+
- [ ] Required generated assets regenerated manually, if applicable.

‎.github/workflows/ci.yml‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
checks:
18+
name: Checks (${{ matrix.os }})
19+
runs-on: ${{ matrix.os }}
20+
timeout-minutes: 20
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-latest, windows-latest]
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
28+
with:
29+
persist-credentials: false
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
33+
with:
34+
node-version: '24'
35+
package-manager-cache: false
36+
37+
- name: Enable Corepack
38+
run: corepack enable
39+
40+
- name: Install dependencies
41+
run: yarn install --immutable
42+
43+
- name: Check line endings
44+
run: yarn check-eol
45+
46+
- name: Lint without changing files
47+
run: yarn lint:ci
48+
49+
- name: Type-check packages
50+
run: yarn build
51+
52+
- name: Type-check VS Code extension with root TypeScript
53+
run: yarn exec tsc -p packages/ts-ssg-vscode/tsconfig.json --noEmit
54+
55+
- name: Test
56+
run: yarn test:ci
57+
58+
- name: Bundle distributable packages
59+
if: runner.os == 'Linux'
60+
run: yarn bundle
61+
62+
- name: Pack distributable packages
63+
if: runner.os == 'Linux'
64+
run: yarn package

‎CONTRIBUTING.md‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Contributing
2+
3+
Use short-lived branches and pull requests into `main`. Keep each pull request
4+
focused on one change so it is easy to review and revert.
5+
6+
## Make a change
7+
8+
1. Update your local `main`: `git switch main && git pull --ff-only`.
9+
2. Create a branch, such as `git switch -c feat/search` or `git switch -c fix/navigation`.
10+
3. Install dependencies with Node.js 24 and the Yarn version pinned in the root
11+
`package.json`: `corepack enable` then `yarn install --immutable`.
12+
4. Make the change and update relevant tests and documentation.
13+
5. Run `yarn lint:ci`, `yarn build`, and `yarn test:ci` before requesting review.
14+
6. Push the branch and open a pull request targeting `main`.
15+
7. Resolve review feedback and CI failures, squash merge, then delete the branch.
16+
17+
Use descriptive commits and pull request titles, for example `feat: add search`
18+
or `fix: preserve navigation state`. Squash merging gives `main` one commit per
19+
pull request. Use a new pull request to revert a change when necessary.
20+
21+
CI runs on pull requests and pushes to `main`. It checks line endings, lints
22+
without modifying source, type-checks with TypeScript, and runs tests on Linux
23+
and Windows using Node.js 24. Linux also bundles and packs distributable packages.
24+
The VS Code extension is checked using the root TypeScript version.
25+
26+
The existing `yarn lint` and `yarn pre-commit` commands modify files. Run
27+
generators deliberately and review their output before committing. When browser
28+
page scripts change, run `yarn embed` manually; do not edit generated files under
29+
`packages/ts-page-scripts/src/embed` directly. CI does not regenerate these files.
30+
31+
## Configure GitHub once
32+
33+
After pushing these files and obtaining the first successful CI run, create an
34+
active branch ruleset targeting `main` in **Settings → Rules → Rulesets**:
35+
36+
- Require a pull request before merging and resolve all review conversations.
37+
- Require `Checks (ubuntu-latest)` and `Checks (windows-latest)` to pass.
38+
- Require branches to be up to date before merging.
39+
- Block force pushes and branch deletion.
40+
- For a team, require one approving review and dismiss stale approvals. Solo
41+
maintainers can require pull requests without requiring another reviewer.
42+
43+
Under **Settings → General → Pull Requests**, enable squash merging and automatic
44+
branch deletion. Disable merge commits and rebase merging to keep a consistent
45+
history. Under **Settings → Actions → General**, allow the official actions used
46+
by the workflows and keep default workflow token permissions read-only.
47+
48+
These settings must be enabled on GitHub; committing workflow files does not
49+
enforce branch protection. See GitHub's [ruleset documentation](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets).
50+
51+
## Dependencies and publishing
52+
53+
Dependabot opens weekly pull requests for GitHub Actions and dependencies. Review
54+
them through the same CI and pull request process as other changes.
55+
56+
The existing **Publish new npm packages** workflow remains a manual operation.
57+
It only publishes packages missing from npm; it is not a version-release workflow.
58+
Use its default dry run first and review the registry results before publishing.
59+
Restrict the `npm-publish` environment to `main` and configure required reviewers
60+
when a team is available. Publishing existing package versions needs a separate
61+
release process; merging a pull request does not publish to npm.

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ and DOM support.
123123

124124
## Develop this repository
125125

126+
See [Contributing](CONTRIBUTING.md) for the branch, pull request, CI, and publishing workflow.
127+
126128
This is a Yarn 4 workspace. Run commands from the repository root:
127129

128130
```sh

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"tsdown": "0.23.0",
2525
"tsx": "^4.21.0",
2626
"typescript": "7.0.2",
27+
"typescript-parser": "npm:typescript@6.0.3",
2728
"vite": "^7.3.1",
2829
"vite-tsconfig-paths": "^6.1.1",
2930
"vitest": "^4.0.18"
@@ -40,12 +41,14 @@
4041
"gen-icons": "yarn tsx scripts/generate-icons.ts",
4142
"build": "echo 'Building...' && yarn workspaces foreach --no-private --all --verbose --topological -- run build",
4243
"lint": "yarn workspaces foreach --no-private --all --verbose --topological -- run lint",
43-
"check-eol": "node scripts/check-eol.js",
44+
"lint:ci": "yarn workspaces foreach --no-private --all --verbose --topological -- exec biome check ./src --formatter-enabled=false",
45+
"check-eol": "yarn tsx scripts/check-eol.ts",
4446
"sync-purestack-version": "yarn tsx --no-warnings scripts/sync-purestack-version.ts",
4547
"bundle": "yarn tsx --no-warnings scripts/bundle.ts",
4648
"cleanup": "yarn tsx --no-warnings scripts/cleanup.ts",
4749
"publish-new-packages": "yarn tsx --no-warnings scripts/publish-new-packages.ts",
4850
"test": "vitest",
51+
"test:ci": "vitest run",
4952
"package": "yarn workspaces foreach --no-private --all --parallel pack",
5053
"pack-vscode-ext": "yarn --cwd packages/ts-ssg-vscode build && yarn --cwd packages/ts-ssg-vscode package",
5154
"longest": "yarn tsx ./scripts/longest-functions.ts",

‎packages/ts-components/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"BtnGroup",
6969
"BtnGroupDropDown",
7070
"BtnLink",
71+
"ClassicLogo",
7172
"CodeShowcase",
7273
"ComparisonColumn",
7374
"ComparisonFeature",

‎packages/ts-components/src/standard/composer/composer.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ describe('Composer', () => {
2929
},
3030
)
3131
try {
32-
const editor = document.querySelector<HTMLElement>('.composer__editor')!
32+
const editor = document.querySelector<HTMLElement>('.composer__editor')
33+
if (!editor) throw new Error('Composer editor was not rendered')
3334
expect(editor.textContent).toBe('Original draft')
3435

3536
messageHtml(

‎packages/ts-components/src/standard/logo/logo.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ describe('SiteLogo', () => {
7373
},
7474
)
7575
try {
76-
const logo = () => document.querySelector<HTMLElement>('.site-logo')!
76+
const logo = () => {
77+
const element = document.querySelector<HTMLElement>('.site-logo')
78+
if (!element) throw new Error('Site logo was not rendered')
79+
return element
80+
}
7781
expect(logo().textContent).toContain('First Brand')
7882
expect(logo().getAttribute('aria-label')).toBe('Custom accessible name')
7983
config({

‎packages/ts-components/src/standard/virtualList/variableMeasurement.test.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,18 @@ describe('variable row measurements', () => {
146146
expect(total()).toBeGreaterThan(beforeResize)
147147
expect(context?.visibleRows?.()[0]).toBe(firstRow)
148148
const emittedSizes: number[] = []
149-
const stop = observe(context!.visibleRows!, (rows) => {
149+
const visibleRows = context?.visibleRows
150+
const viewport = context?.viewportElement?.()
151+
if (!visibleRows || !viewport)
152+
throw new Error('Virtual rows and viewport were not initialized')
153+
const stop = observe(visibleRows, (rows) => {
150154
emittedSizes.push(rows.length)
151155
})
152-
const viewport = context!.viewportElement!()!
153156
for (const position of [1000000, 1900000, 200000, 0]) {
154157
const beforeJump = rowMounts
155158
viewport.scrollTop = position
156159
viewport.dispatchEvent(new Event('scroll'))
157-
expect(context!.visibleRows!().length).toBeLessThan(20)
160+
expect(visibleRows().length).toBeLessThan(20)
158161
expect(rowMounts - beforeJump).toBeLessThan(40)
159162
}
160163
stop()

0 commit comments

Comments
 (0)