You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `prepare` script also runs `node build.js`, so `npm install` from a git clone will build automatically.
35
40
41
+
## Lint
42
+
43
+
```bash
44
+
npm run lint # ESLint 9 flat config
45
+
```
46
+
47
+
Config lives in `eslint.config.mjs`. Browser globals are set for `src/`, CommonJS globals for `build.js`. `dist/`, `node_modules/`, and `docs/` are ignored.
48
+
49
+
## Test
50
+
51
+
```bash
52
+
npm test# vitest run (happy-dom environment)
53
+
```
54
+
55
+
Tests are in `tests/keepTrack.test.js`. The UMD source is loaded via `new Function()` with a local `module.exports` so it runs in the happy-dom environment. Tests verify API shape, CSS variable placement, cleanup, observe/unobserve, scrollbar tracking, and callbacks.
56
+
57
+
**Limitations:** happy-dom's `getComputedStyle` returns empty strings and `getBoundingClientRect` returns zeroes. Tests check that variables are *set*, not their pixel values. Sticky detection is not meaningfully testable.
58
+
59
+
## Release
60
+
61
+
Releases are published to npm automatically via `.github/workflows/release.yml` when a GitHub Release is created (published).
62
+
63
+
**Setup:**
64
+
1. Create an npm access token (Granular Access Token, publish-only, scoped to `keeptrack-css`).
65
+
2. Add it as a repository secret named `NPM_TOKEN` in GitHub Settings > Secrets and variables > Actions.
66
+
3. Create a GitHub Release — the workflow runs build, lint, test and then `npm publish --provenance --access public`.
0 commit comments