@welcome-back/brand 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +140 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,7 +21,8 @@ Use it for loading moments that mean "on the way to the next step".
21
21
  - [Accessibility](#accessibility)
22
22
  - [Where to use it, and where not](#where-to-use-it-and-where-not)
23
23
  - [Troubleshooting](#troubleshooting)
24
- - [Release](#release)
24
+ - [Develop](#develop)
25
+ - [Publish a change](#publish-a-change)
25
26
  - [Source art](#source-art)
26
27
 
27
28
  ## Install
@@ -320,17 +321,146 @@ the content will appear.
320
321
  | The runner fills the whole container | No width is set | Give it a width (`w-24`, or `width` in CSS) |
321
322
  | A Tailwind arbitrary property has no effect | Tailwind does not scan the file | Check the `content` globs in the Tailwind config |
322
323
 
323
- ## Release
324
+ ## Develop
324
325
 
325
- 1. Bump `version` in `package.json` in a PR, and merge it to `main`.
326
- 2. Tag the merge commit: `git tag v0.2.0 && git push origin v0.2.0`.
327
- 3. The Publish workflow checks the tag against the version, runs typecheck,
328
- tests and build, and publishes to npm.
326
+ ### Repo layout
329
327
 
330
- Publishing uses npm trusted publishing (GitHub OIDC): no npm token is stored.
331
- The trusted publisher is set on npmjs.com → `@welcome-back/brand` → Settings:
332
- GitHub Actions, `WelcomeBackLoyalty/brand`, workflow `publish.yml`, with
333
- **Allow npm publish** ticked.
328
+ | Path | What it holds |
329
+ |---|---|
330
+ | `src/index.ts` | Public exports. Only what is exported here is part of the API. |
331
+ | `src/RunnerLoader.tsx` | The component: SVG structure, clip paths, props |
332
+ | `src/runnerCss.ts` | The animation: keyframes, timing, swing angles, reduced motion |
333
+ | `src/runnerArt.ts` | Vector data: paths, pants fills, clip polygons |
334
+ | `src/*.test.tsx` | Vitest tests (server render, no browser) |
335
+ | `scripts/mark-cjs.mjs` | Marks `dist/cjs` as CommonJS after the build |
336
+ | `.github/workflows/ci.yml` | Runs on every PR and on `main` |
337
+ | `.github/workflows/publish.yml` | Runs on a `v*` tag and publishes to npm |
338
+
339
+ ### Commands
340
+
341
+ Node 22 or later.
342
+
343
+ ```bash
344
+ npm ci # install
345
+ npm run typecheck # tsc, no output
346
+ npm test # vitest
347
+ npm run build # dist/esm (ESM + types) and dist/cjs (CommonJS)
348
+ ```
349
+
350
+ CI runs all four, then loads both builds to prove that `import` and `require`
351
+ work.
352
+
353
+ ### Try a change in an app before you publish
354
+
355
+ Pack the package and install the tarball in the app:
356
+
357
+ ```bash
358
+ # in brand/
359
+ npm run build && npm pack # writes welcome-back-brand-<version>.tgz
360
+
361
+ # in the app, for example staff-ui/
362
+ npm i ../brand/welcome-back-brand-<version>.tgz
363
+ ```
364
+
365
+ Undo it in the app with `npm i @welcome-back/brand@latest`. Do not commit the
366
+ tarball path in the app's `package.json`.
367
+
368
+ Prefer `npm pack` to `npm link`. A linked package can load a second copy of
369
+ React, and then hooks fail with "Invalid hook call".
370
+
371
+ ### Common changes
372
+
373
+ | To change | Edit | Note |
374
+ |---|---|---|
375
+ | Speed | `--wb-runner-step-default` in `src/runnerCss.ts` | Apps can already override it per use with `--wb-runner-step` |
376
+ | Stride length (swing angles) | `@keyframes wb-runner-swing-front` / `-back` in `src/runnerCss.ts` | Angles are measured from each leg drawing's rest pose. The front leg is vertical at `-36deg`, the back leg at `39deg`. Keep forward and back swings equal around those values. |
377
+ | Where the legs join the body | `@keyframes wb-runner-hip-front` / `-back` | Values are in the art's coordinates (the 1500×1500 PDF page) |
378
+ | What is hidden behind the W | `LEGS_CLIP` / `BODY_CLIP` in `src/runnerArt.ts` | See [Source art](#source-art) |
379
+ | A new prop | `src/RunnerLoader.tsx`, plus a test and a row in the props table | |
380
+ | A new asset (logo, icon, token) | A new file in `src/`, exported from `src/index.ts`, plus a test and a README section | |
381
+
382
+ After a visual change, check it in a real app with `npm pack` (above) in light
383
+ mode, dark mode and with reduced motion on.
384
+
385
+ ## Publish a change
386
+
387
+ Every change reaches npm through a PR and a tag. Nobody publishes from a laptop,
388
+ and there is no npm token: GitHub Actions publishes with npm trusted publishing.
389
+
390
+ ### 1. Pick the version
391
+
392
+ The package follows [semver](https://semver.org). Apps install it with `^`, so
393
+ they get minor and patch releases on their next install.
394
+
395
+ | Change | Bump | Example |
396
+ |---|---|---|
397
+ | Docs, tests, or a fix with no visible change | patch | `0.1.2` → `0.1.3` |
398
+ | A new prop, asset or CSS variable; a visual tweak that keeps the API | minor | `0.1.3` → `0.2.0` |
399
+ | A removed or renamed prop, export or CSS variable | major | `0.9.0` → `1.0.0` |
400
+
401
+ While the version is `0.x`, npm treats a minor bump as breaking for `^`
402
+ ranges. Apps then need an explicit update to get it.
403
+
404
+ ### 2. Open a PR with the change and the new version
405
+
406
+ ```bash
407
+ git switch main && git pull
408
+ git switch -c <type>/<short-name>
409
+ # make the change
410
+ npm version <patch|minor|major> --no-git-tag-version # edits package.json and package-lock.json
411
+ git commit -am "<type>: <what changed> (v<new version>)"
412
+ git push -u origin HEAD
413
+ gh pr create --base main
414
+ ```
415
+
416
+ CI must pass before you merge. Squash-merge the PR.
417
+
418
+ ### 3. Tag the merge commit
419
+
420
+ ```bash
421
+ git switch main && git pull
422
+ git tag v<new version> # must equal "version" in package.json
423
+ git push origin v<new version>
424
+ ```
425
+
426
+ The tag starts the Publish workflow. It:
427
+
428
+ 1. checks that the tag equals `version` in `package.json`,
429
+ 2. runs typecheck, tests and build (`prepublishOnly`),
430
+ 3. publishes to npm through trusted publishing.
431
+
432
+ Watch it with `gh run watch`, or in the repo's **Actions** tab.
433
+
434
+ ### 4. Check npm and update the apps
435
+
436
+ ```bash
437
+ npm view @welcome-back/brand version # the new version, after a few minutes
438
+ ```
439
+
440
+ A new version can take up to about 3 minutes to show on the registry. Then, in
441
+ each app:
442
+
443
+ ```bash
444
+ npm i @welcome-back/brand@latest
445
+ ```
446
+
447
+ ### If the publish fails
448
+
449
+ | Error in the workflow log | Cause | Fix |
450
+ |---|---|---|
451
+ | `Tag must match package.json version` step fails | The tag and `version` differ | Delete the tag (`git push origin :v<x>` and `git tag -d v<x>`), fix the version in a PR, tag again |
452
+ | `403 … OIDC permission denied` | The trusted publisher on npmjs.com does not allow direct publish, or its fields do not match | npmjs.com → package → Settings → Trusted Publisher: `WelcomeBackLoyalty` / `brand` / `publish.yml`, no environment, **Allow npm publish** ticked |
453
+ | `403 … cannot publish over the previously published versions` | That version is already on npm | Bump the version in a new PR and tag again. npm never allows a republish of a version. |
454
+ | Typecheck or test fails | The tagged commit is broken | Fix it in a PR, bump the version, tag again |
455
+
456
+ To rerun a failed publish without a new tag: `gh run rerun <run-id> --failed`.
457
+
458
+ ### npm settings (for maintainers)
459
+
460
+ - Org: `welcome-back`. Package access: public.
461
+ - Trusted publisher: GitHub Actions, `WelcomeBackLoyalty/brand`, `publish.yml`,
462
+ no environment, **Allow npm publish** ticked.
463
+ - No provenance: npm cannot generate it for a private GitHub repo.
334
464
 
335
465
  ## Source art
336
466
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@welcome-back/brand",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "WelcomeBack brand assets for React apps: the running-W loader.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {