@atelier-ui/create-workspace 0.2.43 → 0.3.0
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.
- package/CHANGELOG.md +59 -11
- package/package.json +1 -1
- package/src/generators/preset/files/claude/agents/component-review.md +53 -0
- package/src/generators/preset/files/claude/commands/verify.md +24 -0
- package/src/generators/preset/files/claude/hooks/format-edited.sh +77 -0
- package/src/generators/preset/files/claude/skills/atelier-component/SKILL.md +84 -0
- package/src/generators/preset/files/storybook/angular/atl-button.stories.ts.template +48 -1
- package/src/generators/preset/files/storybook/react/atl-button.stories.tsx +56 -1
- package/src/generators/preset/files/storybook/vue/atl-button.stories.ts.template +57 -2
- package/src/generators/preset/files/testing/angular/atl-button.spec.ts.template +27 -0
- package/src/generators/preset/files/testing/angular/test-setup.ts.template +6 -0
- package/src/generators/preset/files/testing/angular/vitest.unit.config.ts.template +36 -0
- package/src/generators/preset/files/testing/react/atl-button.spec.tsx +22 -0
- package/src/generators/preset/files/testing/react/test-setup.ts.template +1 -0
- package/src/generators/preset/files/testing/react/vitest.unit.config.ts.template +42 -0
- package/src/generators/preset/files/testing/vue/atl-button.spec.ts.template +25 -0
- package/src/generators/preset/files/testing/vue/test-setup.ts.template +1 -0
- package/src/generators/preset/files/testing/vue/vitest.unit.config.ts.template +50 -0
- package/src/generators/preset/preset.js +762 -359
- package/src/generators/preset/preset.js.map +1 -1
- package/src/generators/preset/schema.d.ts +2 -1
- package/src/generators/preset/schema.json +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,69 @@
|
|
|
1
|
+
## 0.3.0 (2026-09-13)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- ⚠️ **react:** the published package declares what it actually ships ([68a3b528](https://github.com/DominikPieper/atelier-ui/commit/68a3b528))
|
|
6
|
+
|
|
7
|
+
### ⚠️ Breaking Changes
|
|
8
|
+
|
|
9
|
+
- **react:** the published package declares what it actually ships ([68a3b528](https://github.com/DominikPieper/atelier-ui/commit/68a3b528))
|
|
10
|
+
` footer, and that is a judgement to review
|
|
11
|
+
rather than a claim that nothing changed. An external consumer who imports this
|
|
12
|
+
package in their own Vitest suite was silently protected by the guard and now
|
|
13
|
+
needs the same `inline` entry themselves — semver-honest grounds for a major.
|
|
14
|
+
The footer is left off because on this setup it would likely cut 1.0.0
|
|
15
|
+
automatically on push, and that is the owner's call to make deliberately, not a
|
|
16
|
+
side effect of a bug fix.
|
|
17
|
+
Gates: nx test react 0 (450), nx build react 0, nx lint react 0,
|
|
18
|
+
nx storybook-test react 0 (228, run alone), nx test create-workspace 0 (200),
|
|
19
|
+
nx build create-workspace 0, check-adr-refs 0, prettier --check 0. The CLI e2e
|
|
20
|
+
for react — scaffold, build, Storybook build, check:contracts, nx test,
|
|
21
|
+
check:stories in Chromium — green against the fixed package.
|
|
22
|
+
|
|
23
|
+
### ❤️ Thank You
|
|
24
|
+
|
|
25
|
+
- Claude Opus 5 (1M context)
|
|
26
|
+
- Dominik Pieper @DominikPieper
|
|
27
|
+
|
|
28
|
+
## 0.2.44 (2026-09-13)
|
|
29
|
+
|
|
30
|
+
### 🚀 Features
|
|
31
|
+
|
|
32
|
+
- **create-workspace:** the workspace knows which Figma file is the attendee's ([40a2eff2](https://github.com/DominikPieper/atelier-ui/commit/40a2eff2))
|
|
33
|
+
- **create-workspace:** a unit-test runner, without disturbing the browser one ([fa60042d](https://github.com/DominikPieper/atelier-ui/commit/fa60042d))
|
|
34
|
+
- **create-workspace:** the workspace ships the skill for the loop it runs ([50169e2e](https://github.com/DominikPieper/atelier-ui/commit/50169e2e))
|
|
35
|
+
- **create-workspace:** the generated workspace is set up for the agent that works in it ([e2772040](https://github.com/DominikPieper/atelier-ui/commit/e2772040))
|
|
36
|
+
- **create-workspace:** a pinned workspace whose example teaches the doctrine ([de06988e](https://github.com/DominikPieper/atelier-ui/commit/de06988e))
|
|
37
|
+
- **create-workspace:** the preset takes one framework, not a list ([d4b1cfb1](https://github.com/DominikPieper/atelier-ui/commit/d4b1cfb1))
|
|
38
|
+
|
|
39
|
+
### 🩹 Fixes
|
|
40
|
+
|
|
41
|
+
- **create-workspace:** the CLAUDE.md it writes quoted the wrong radius values ([35ccffa7](https://github.com/DominikPieper/atelier-ui/commit/35ccffa7))
|
|
42
|
+
- **create-workspace:** the generator validates the Figma key it interpolates ([e6eb441d](https://github.com/DominikPieper/atelier-ui/commit/e6eb441d))
|
|
43
|
+
|
|
44
|
+
### ❤️ Thank You
|
|
45
|
+
|
|
46
|
+
- Claude Opus 5 (1M context)
|
|
47
|
+
- Dominik Pieper @DominikPieper
|
|
48
|
+
|
|
1
49
|
## 0.2.43 (2026-09-12)
|
|
2
50
|
|
|
3
51
|
### 🚀 Features
|
|
4
52
|
|
|
5
|
-
- **scaffold:** Prettier ships enforced, and a types script does not ship at all ([
|
|
6
|
-
- **scaffold:** a generated workspace gets the CSS-discipline rules on day one ([
|
|
7
|
-
- **lint:** the linter is a gate, where the invariant fits in one file ([
|
|
8
|
-
- **gates:** a gate that measured nothing is not a gate that found nothing ([
|
|
9
|
-
- **gates:** check:manifest-parity — the three manifests, diffed — ADR-0121 S6a ([
|
|
10
|
-
- **spec:** the contract on every Docs tab, imported by every story meta — ADR-0121 S5b ([
|
|
11
|
-
- **create-workspace:** the scaffold ships the contract loop — ADR-0121 S4 ([
|
|
12
|
-
- **create-workspace:** Storybook and the skills ship together — ADR-0123 ([
|
|
53
|
+
- **scaffold:** Prettier ships enforced, and a types script does not ship at all ([543dc71](https://github.com/DominikPieper/atelier-ui/commit/543dc71))
|
|
54
|
+
- **scaffold:** a generated workspace gets the CSS-discipline rules on day one ([68b097c](https://github.com/DominikPieper/atelier-ui/commit/68b097c))
|
|
55
|
+
- **lint:** the linter is a gate, where the invariant fits in one file ([e4e6a02](https://github.com/DominikPieper/atelier-ui/commit/e4e6a02))
|
|
56
|
+
- **gates:** a gate that measured nothing is not a gate that found nothing ([a45a685](https://github.com/DominikPieper/atelier-ui/commit/a45a685))
|
|
57
|
+
- **gates:** check:manifest-parity — the three manifests, diffed — ADR-0121 S6a ([fbd5fd3](https://github.com/DominikPieper/atelier-ui/commit/fbd5fd3))
|
|
58
|
+
- **spec:** the contract on every Docs tab, imported by every story meta — ADR-0121 S5b ([30dd54c](https://github.com/DominikPieper/atelier-ui/commit/30dd54c))
|
|
59
|
+
- **create-workspace:** the scaffold ships the contract loop — ADR-0121 S4 ([74aa640](https://github.com/DominikPieper/atelier-ui/commit/74aa640))
|
|
60
|
+
- **create-workspace:** Storybook and the skills ship together — ADR-0123 ([79b60e9](https://github.com/DominikPieper/atelier-ui/commit/79b60e9))
|
|
13
61
|
|
|
14
62
|
### 🩹 Fixes
|
|
15
63
|
|
|
16
|
-
- **lint:** a broken allowlists module made the staleness check silent ([
|
|
17
|
-
- **gates:** check:contracts skips package-imported components before docgen ([
|
|
18
|
-
- **skill:** the Day-2 loop, walked as a participant — twenty findings, five blockers ([
|
|
64
|
+
- **lint:** a broken allowlists module made the staleness check silent ([a41ff02](https://github.com/DominikPieper/atelier-ui/commit/a41ff02))
|
|
65
|
+
- **gates:** check:contracts skips package-imported components before docgen ([caa7633](https://github.com/DominikPieper/atelier-ui/commit/caa7633))
|
|
66
|
+
- **skill:** the Day-2 loop, walked as a participant — twenty findings, five blockers ([e1fe140](https://github.com/DominikPieper/atelier-ui/commit/e1fe140))
|
|
19
67
|
|
|
20
68
|
### ❤️ Thank You
|
|
21
69
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: component-review
|
|
3
|
+
description: Reviews ONE existing component in this workspace against its contract file, its Storybook stories, and its accessibility posture — reports findings, never edits anything. Use for "review <component>", "does <component> match its contract", "check <component>'s story coverage", or an accessibility pass on one component before a PR. Do NOT use for general code review, cross-file refactors, or a change that also touches other components — read the diff directly for those instead.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are **component-review**. Given one component name (e.g. `AtlButton`), audit it against the three sources of truth this workspace already has, and report what's missing or inconsistent. You never edit a file — a finding you can't fix by editing is exactly what this agent exists to surface.
|
|
9
|
+
|
|
10
|
+
## Finding the component
|
|
11
|
+
|
|
12
|
+
This is a single-framework scaffold — there is exactly one app, under
|
|
13
|
+
`workshop-*/src`. Inside it:
|
|
14
|
+
|
|
15
|
+
- `src/contracts/<name>.contract.ts` — the one hand-authored contract file:
|
|
16
|
+
the Figma master's node id, plus intentional Figma ↔ code mismatches
|
|
17
|
+
(`figmaOnly`, `codeOnly`, `axisMap`, `probes`) — never props, defaults, or
|
|
18
|
+
prose.
|
|
19
|
+
- the component's own source and its `*.stories.*` file — the real props,
|
|
20
|
+
variants, defaults, and `play` functions live there, not in the contract.
|
|
21
|
+
|
|
22
|
+
Glob for both before reading anything else; do not assume a path.
|
|
23
|
+
|
|
24
|
+
## Review checklist
|
|
25
|
+
|
|
26
|
+
1. **Contract exists and still matches.** Read the contract file for the
|
|
27
|
+
named component. Does its Figma node id look real, not a placeholder? Grep
|
|
28
|
+
the component's own source for every prop/variant the contract's
|
|
29
|
+
`figmaOnly`/`codeOnly`/`axisMap` entries name — an exemption naming a prop
|
|
30
|
+
that no longer exists, or missing one that now does, is a finding.
|
|
31
|
+
2. **Story coverage.** Read the stories file. Is there one story per variant
|
|
32
|
+
value and one per boolean state? A variant value with no story rendering
|
|
33
|
+
it is a finding. Does the story meta import the component's contract and
|
|
34
|
+
set `parameters.contract`? (Currently only a warning workspace-wide —
|
|
35
|
+
still worth naming.)
|
|
36
|
+
3. **Accessibility posture.** Read the component source for ARIA attributes,
|
|
37
|
+
roles, and keyboard handling appropriate to its type (button, dialog,
|
|
38
|
+
listbox, …). Check the stories for a `play` function exercising keyboard
|
|
39
|
+
interaction, and for any `parameters.a11y` override — an override that
|
|
40
|
+
_disables_ a rule is itself a finding worth surfacing, not something to
|
|
41
|
+
accept silently because it's already there.
|
|
42
|
+
4. **Corroborate, read-only.** You may run `npm run check:contracts` and
|
|
43
|
+
`nx lint <project>` to check your reading against the gates — read their
|
|
44
|
+
output, never edit in response to it. A clean gate proves shape and
|
|
45
|
+
coverage; it does not excuse skipping the reading above, since a stale
|
|
46
|
+
exemption or a disabled a11y rule can be gate-clean and still wrong.
|
|
47
|
+
|
|
48
|
+
## Report shape
|
|
49
|
+
|
|
50
|
+
One finding per line, prefixed with a rough severity — `BLOCKING`,
|
|
51
|
+
`WORTH FIXING`, or `NIT` — naming the exact file (and line, where that helps).
|
|
52
|
+
End with a one-line verdict: ready to ship, or not yet and why. Do not edit
|
|
53
|
+
any file; that is the caller's job once they've read your findings.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run this workspace's five verification gates and report each one's exit code.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Run these five checks, in order, and report each one's exit code — never a
|
|
6
|
+
single pass/fail summary. A gate's result is its exit code: run it as
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
<command> > /tmp/verify-<name>.log 2>&1; echo $?
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
and read the log file afterwards. Never pipe a gate into `head` or `grep` to
|
|
13
|
+
read it — the pipe's own exit status is always `0`, which silently turns a
|
|
14
|
+
failing gate into a passing one.
|
|
15
|
+
|
|
16
|
+
1. `npm run check:format` — Prettier
|
|
17
|
+
2. `npm run check:stylelint` — the ported CSS-discipline rules
|
|
18
|
+
3. `npm run check:contracts` — contract ↔ docgen ↔ Figma-snapshot parity
|
|
19
|
+
4. `npm run check:unit` — jsdom unit tests (components, composables, helpers)
|
|
20
|
+
5. `npm run check:stories` — every story, rendered in Chromium, axe-checked
|
|
21
|
+
|
|
22
|
+
Report a short table: check name → exit code → pass/fail. For any non-zero
|
|
23
|
+
exit code, show only the relevant lines from that check's log (not the whole
|
|
24
|
+
log) and stop there — do not attempt a fix unless asked to.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PostToolUse hook (matcher: Edit|Write) — formats whatever file the tool
|
|
3
|
+
# call just touched.
|
|
4
|
+
#
|
|
5
|
+
# Why not jq: this workspace declares no jq dependency and it isn't
|
|
6
|
+
# guaranteed to be on an attendee's machine. Node is (package.json's own
|
|
7
|
+
# "engines" requires >=22), so the JSON-on-stdin event is parsed with
|
|
8
|
+
# `node -e` instead.
|
|
9
|
+
#
|
|
10
|
+
# Why not npx: resolving prettier/stylelint through npx pays their full
|
|
11
|
+
# resolution cost on *every* edit — a hook that slow is a hook people turn
|
|
12
|
+
# off. Both are devDependencies this preset installs, so the locally
|
|
13
|
+
# installed binary under node_modules/.bin is invoked directly.
|
|
14
|
+
#
|
|
15
|
+
# This is a formatter, not a gate: it must always exit 0, and must do
|
|
16
|
+
# nothing at all when the path is missing, outside the workspace, or of a
|
|
17
|
+
# type neither tool handles. Blocking an edit because Prettier disliked a
|
|
18
|
+
# file is the wrong failure mode — check:format and check:stylelint are the
|
|
19
|
+
# real gates (see /verify).
|
|
20
|
+
set -u
|
|
21
|
+
|
|
22
|
+
project_dir="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
23
|
+
cd "$project_dir" || exit 0
|
|
24
|
+
|
|
25
|
+
# The event arrives as JSON on stdin; the edited path is at
|
|
26
|
+
# `.tool_input.file_path`. Malformed/empty stdin, or a payload with no
|
|
27
|
+
# string there, prints nothing — handled as "no path" below, same as a
|
|
28
|
+
# missing key.
|
|
29
|
+
file_path="$(node -e '
|
|
30
|
+
let data = "";
|
|
31
|
+
process.stdin.on("data", (chunk) => { data += chunk; });
|
|
32
|
+
process.stdin.on("end", () => {
|
|
33
|
+
try {
|
|
34
|
+
const event = JSON.parse(data);
|
|
35
|
+
const path = event && event.tool_input && event.tool_input.file_path;
|
|
36
|
+
if (typeof path === "string") process.stdout.write(path);
|
|
37
|
+
} catch {
|
|
38
|
+
// Leave stdout empty — treated as "no path" below.
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
' 2>/dev/null)"
|
|
42
|
+
|
|
43
|
+
[ -z "$file_path" ] && exit 0
|
|
44
|
+
|
|
45
|
+
# Edit/Write always report an absolute path. Anything not rooted at this
|
|
46
|
+
# workspace (a stray edit against some other tree opened in the same
|
|
47
|
+
# session) is out of scope for this hook.
|
|
48
|
+
case "$file_path" in
|
|
49
|
+
"$project_dir"/*) ;;
|
|
50
|
+
*) exit 0 ;;
|
|
51
|
+
esac
|
|
52
|
+
|
|
53
|
+
[ -f "$file_path" ] || exit 0
|
|
54
|
+
|
|
55
|
+
# Only extensions Prettier actually formats in this workspace — anything
|
|
56
|
+
# else (an image, a lockfile, a binary asset) is a type neither tool
|
|
57
|
+
# handles, and the hook does nothing rather than shell out for no reason.
|
|
58
|
+
case "$file_path" in
|
|
59
|
+
*.ts | *.tsx | *.js | *.jsx | *.mjs | *.cjs | *.vue | *.json | *.css | *.md | *.html | *.yml | *.yaml) ;;
|
|
60
|
+
*) exit 0 ;;
|
|
61
|
+
esac
|
|
62
|
+
|
|
63
|
+
prettier_bin="./node_modules/.bin/prettier"
|
|
64
|
+
if [ -x "$prettier_bin" ]; then
|
|
65
|
+
"$prettier_bin" --write "$file_path" >/dev/null 2>&1
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
case "$file_path" in
|
|
69
|
+
*.css)
|
|
70
|
+
stylelint_bin="./node_modules/.bin/stylelint"
|
|
71
|
+
if [ -x "$stylelint_bin" ]; then
|
|
72
|
+
"$stylelint_bin" --fix "$file_path" >/dev/null 2>&1
|
|
73
|
+
fi
|
|
74
|
+
;;
|
|
75
|
+
esac
|
|
76
|
+
|
|
77
|
+
exit 0
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: atelier-component
|
|
3
|
+
description: Build, change or review one component in this Atelier workshop workspace, running the Figma → contract → stories → checks loop against the surfaces this workspace actually has (`<app>/src/contracts/`, `contracts.config.json`, `npm run check:contracts`, `npm run check:stories`). Use whenever the ask is to implement, add, port, restyle or review a component here, when a figma.com/design link arrives with a component name, or when `check:contracts` or `check:stories` report findings that need explaining. Do NOT use for Storybook configuration, for editing `.storybook/*`, or for work that is not about a single component.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# One component, in this workspace
|
|
7
|
+
|
|
8
|
+
This is a generated Atelier workshop workspace: one app (`workshop-<framework>`), one
|
|
9
|
+
framework, a local Storybook on port 6006, and a contract loop. The loop below is the one
|
|
10
|
+
the Atelier monorepo runs, minus the parts that need the monorepo — say so plainly when you
|
|
11
|
+
reach one, rather than pretending the step happened.
|
|
12
|
+
|
|
13
|
+
## What this workspace can check, and what it cannot
|
|
14
|
+
|
|
15
|
+
| Can | How |
|
|
16
|
+
| ----------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
17
|
+
| That a contract matches its Figma master's shape | `npm run check:contracts` against `tools/figma/snapshot.json` |
|
|
18
|
+
| That every variant value and Boolean state has a story | the same check's `[COVERAGE]` findings |
|
|
19
|
+
| That a component, composable, service, or helper behaves as unit-tested | `npm run check:unit` (jsdom, `@testing-library/*`) |
|
|
20
|
+
| That every story renders, behaves, and passes axe | `npm run check:stories` (Chromium, headless) |
|
|
21
|
+
| That CSS uses tokens rather than literals | `npm run check:stylelint` |
|
|
22
|
+
|
|
23
|
+
It cannot check design parity against the live Figma file unless the `figma-console` MCP is
|
|
24
|
+
wired in `.mcp.json` and the Desktop Bridge plugin is running. If it is not, the loop ends at
|
|
25
|
+
`check:stories` — and you say that, instead of claiming parity.
|
|
26
|
+
|
|
27
|
+
For a component imported from `@atelier-ui/<framework>` rather than written here,
|
|
28
|
+
`check:contracts` skips docgen (the import resolves into `node_modules`) and reports only
|
|
29
|
+
`[NO-STORY-META]`. A green run on such a component proves the wiring, not the component.
|
|
30
|
+
|
|
31
|
+
## The loop
|
|
32
|
+
|
|
33
|
+
1. **Get the shape from Figma, not from a picture.** `figma_get_component_for_development` on
|
|
34
|
+
the node if the MCP is available. Write down the variant axes, the Boolean properties, the
|
|
35
|
+
tokens, and the interaction states before writing any code. If you were handed a screenshot
|
|
36
|
+
and nothing else, say that behaviour has not been specified yet and ask for the node.
|
|
37
|
+
2. **Write the contract.** `<app>/src/contracts/<name>.contract.ts` — the master's node id and
|
|
38
|
+
only the Figma ↔ code mismatches you are making on purpose (`figmaOnly`, `codeOnly`,
|
|
39
|
+
`axisMap`). Never props, defaults, unions or prose: those live in the component's own types
|
|
40
|
+
and JSDoc. See `<app>/src/contracts/README.md`.
|
|
41
|
+
3. **Write the component.** Tokens only — every colour, space and radius is a `--ui-*` custom
|
|
42
|
+
property. A raw hex or a hardcoded `2.5rem` is a stylelint error here, not a style opinion.
|
|
43
|
+
4. **Write the stories, because the stories are the claims.** One story per variant value and
|
|
44
|
+
per Boolean state, `args`-based; one `play` per behaviour you are asserting, with a real
|
|
45
|
+
assertion. Copy the shape from `<app>/src/atl-button.stories.*`, which ships with this
|
|
46
|
+
workspace for exactly that purpose.
|
|
47
|
+
5. **Run the checks.** `npm run check:contracts`, then `npm run check:stories`. Read the exit
|
|
48
|
+
code, not the last line of output.
|
|
49
|
+
6. **Close the loop against Figma** if the MCP is available: `figma_check_design_parity`,
|
|
50
|
+
with the code side assembled from `check:contracts` and `figma_scan_code_accessibility`.
|
|
51
|
+
|
|
52
|
+
## Never invent a prop
|
|
53
|
+
|
|
54
|
+
Before using any prop of a component from `@atelier-ui/<framework>`: call `docs-list` once to
|
|
55
|
+
get valid ids, then `docs-show` for the component. The answer comes back shaped for this
|
|
56
|
+
framework — two-way bindings and split Inputs/Outputs for Angular, `v-model` and typed slots
|
|
57
|
+
for Vue, JSX and `children` for React. If a prop is not in the docs, it does not exist; say so
|
|
58
|
+
rather than guessing from another library's naming.
|
|
59
|
+
|
|
60
|
+
For a component whose source lives in this workspace, its own types are the API.
|
|
61
|
+
|
|
62
|
+
## Reading `check:contracts`
|
|
63
|
+
|
|
64
|
+
| Finding | What it means |
|
|
65
|
+
| ----------------------------------------------------- | ------------------------------------------------------------ |
|
|
66
|
+
| `[CONTRACT-MISSING]` / `[CONTRACT-NODE]` | no contract file, or its node id disagrees with the snapshot |
|
|
67
|
+
| `[AXIS]` / `[BOOLEAN]` / `[ENUM-UNDRAWN]` | a Figma property has no matching code prop |
|
|
68
|
+
| `[COVERAGE]` / `[COVERAGE-BOOL]` | a variant value or Boolean state that no story renders |
|
|
69
|
+
| `[FIGMA-ONLY]` / `[STALE-EXEMPTION]` / `[UNMIRRORED]` | an exemption is missing, stale, or unexplained |
|
|
70
|
+
| `[NO-STORY-META]` / `[NO-MASTER]` | a contract with nothing yet to check it against |
|
|
71
|
+
| `[CONTRACT-IMPORT]` | a story meta does not import its contract (a warning here) |
|
|
72
|
+
|
|
73
|
+
A `[COVERAGE]` finding is not noise to silence. It means a state exists in the design that
|
|
74
|
+
nothing in this workspace has ever rendered — which is the one thing this loop exists to
|
|
75
|
+
catch.
|
|
76
|
+
|
|
77
|
+
## Definition of done
|
|
78
|
+
|
|
79
|
+
`npm run check:format`, `npm run check:stylelint`, `npm run check:contracts`,
|
|
80
|
+
`npm run check:unit` and `npm run check:stories` each exit 0 — checked as exit codes, one at
|
|
81
|
+
a time. Never pipe a check into `head` or `grep` to read it: the pipe's status is 0 whatever
|
|
82
|
+
the check did, and that turns a red run into a green report.
|
|
83
|
+
|
|
84
|
+
Then say which of the six loop steps you actually ran, and which you could not.
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/angular-vite';
|
|
2
2
|
import { argsToTemplate } from '@storybook/angular-vite';
|
|
3
|
+
import { expect, userEvent } from 'storybook/test';
|
|
3
4
|
import { AtlButton } from '@atelier-ui/angular';
|
|
4
5
|
|
|
5
6
|
// A working pattern to copy: duplicate this file for another component from
|
|
6
7
|
// @atelier-ui/angular, or add more `args`/`argTypes` below.
|
|
8
|
+
//
|
|
9
|
+
// ADR-0121: the stories are the claims — one story per `variant` value and
|
|
10
|
+
// per Boolean state (`disabled`, `loading`), args-based, plus exactly one
|
|
11
|
+
// `play` function with a real assertion (not a decorative one).
|
|
7
12
|
const meta: Meta<AtlButton> = {
|
|
8
13
|
title: 'AtlButton',
|
|
9
14
|
component: AtlButton,
|
|
@@ -35,4 +40,46 @@ const meta: Meta<AtlButton> = {
|
|
|
35
40
|
export default meta;
|
|
36
41
|
type Story = StoryObj<AtlButton>;
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
// One story per `variant` value.
|
|
44
|
+
//
|
|
45
|
+
// The one `play` function in this file lives here, on an enabled button: it
|
|
46
|
+
// proves the button actually fires its click handler when clicked, not just
|
|
47
|
+
// that it looks clickable.
|
|
48
|
+
export const Primary: Story = {
|
|
49
|
+
args: { variant: 'primary' },
|
|
50
|
+
render: (args) => ({
|
|
51
|
+
props: { ...args, clicked: false },
|
|
52
|
+
template: `
|
|
53
|
+
<div style="display:flex;flex-direction:column;gap:0.5rem;align-items:flex-start">
|
|
54
|
+
<atl-button ${argsToTemplate(args)} (click)="clicked = true">Button</atl-button>
|
|
55
|
+
<span>{{ clicked ? 'clicked' : 'not clicked' }}</span>
|
|
56
|
+
</div>
|
|
57
|
+
`,
|
|
58
|
+
}),
|
|
59
|
+
play: async ({ canvas }) => {
|
|
60
|
+
const button = canvas.getByRole('button');
|
|
61
|
+
await userEvent.click(button);
|
|
62
|
+
await expect(canvas.getByText('clicked')).toBeInTheDocument();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const Secondary: Story = {
|
|
67
|
+
args: { variant: 'secondary' },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Outline: Story = {
|
|
71
|
+
args: { variant: 'outline' },
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Danger: Story = {
|
|
75
|
+
args: { variant: 'danger' },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// One story per Boolean state.
|
|
79
|
+
export const Loading: Story = {
|
|
80
|
+
args: { loading: true },
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Disabled: Story = {
|
|
84
|
+
args: { disabled: true },
|
|
85
|
+
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { expect, userEvent } from 'storybook/test';
|
|
2
4
|
import { AtlButton } from '@atelier-ui/react';
|
|
3
5
|
|
|
4
6
|
// A working pattern to copy: duplicate this file for another component from
|
|
5
7
|
// @atelier-ui/react, or add more `args`/`argTypes` below.
|
|
8
|
+
//
|
|
9
|
+
// ADR-0121: the stories are the claims — one story per `variant` value and
|
|
10
|
+
// per Boolean state (`disabled`, `loading`), args-based, plus exactly one
|
|
11
|
+
// `play` function with a real assertion (not a decorative one).
|
|
6
12
|
const meta: Meta<typeof AtlButton> = {
|
|
7
13
|
title: 'AtlButton',
|
|
8
14
|
component: AtlButton,
|
|
@@ -28,4 +34,53 @@ const meta: Meta<typeof AtlButton> = {
|
|
|
28
34
|
export default meta;
|
|
29
35
|
type Story = StoryObj<typeof AtlButton>;
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
// One story per `variant` value.
|
|
38
|
+
//
|
|
39
|
+
// The one `play` function in this file lives here, on an enabled button: it
|
|
40
|
+
// proves the button actually fires its click handler when clicked, not just
|
|
41
|
+
// that it looks clickable.
|
|
42
|
+
export const Primary: Story = {
|
|
43
|
+
args: { variant: 'primary' },
|
|
44
|
+
render: function PrimaryRender(args) {
|
|
45
|
+
const [clicked, setClicked] = useState(false);
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
style={{
|
|
49
|
+
display: 'flex',
|
|
50
|
+
flexDirection: 'column',
|
|
51
|
+
gap: '0.5rem',
|
|
52
|
+
alignItems: 'flex-start',
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<AtlButton {...args} onClick={() => setClicked(true)} />
|
|
56
|
+
<span>{clicked ? 'clicked' : 'not clicked'}</span>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
play: async ({ canvas }) => {
|
|
61
|
+
const button = canvas.getByRole('button');
|
|
62
|
+
await userEvent.click(button);
|
|
63
|
+
await expect(canvas.getByText('clicked')).toBeInTheDocument();
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Secondary: Story = {
|
|
68
|
+
args: { variant: 'secondary' },
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Outline: Story = {
|
|
72
|
+
args: { variant: 'outline' },
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const Danger: Story = {
|
|
76
|
+
args: { variant: 'danger' },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// One story per Boolean state.
|
|
80
|
+
export const Loading: Story = {
|
|
81
|
+
args: { loading: true },
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const Disabled: Story = {
|
|
85
|
+
args: { disabled: true },
|
|
86
|
+
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { expect, userEvent } from 'storybook/test';
|
|
2
4
|
import { AtlButton } from '@atelier-ui/vue';
|
|
3
5
|
|
|
4
6
|
// A working pattern to copy: duplicate this file for another component from
|
|
5
7
|
// @atelier-ui/vue, or add more `args`/`argTypes` below.
|
|
8
|
+
//
|
|
9
|
+
// ADR-0121: the stories are the claims — one story per `variant` value and
|
|
10
|
+
// per Boolean state (`disabled`, `loading`), args-based, plus exactly one
|
|
11
|
+
// `play` function with a real assertion (not a decorative one).
|
|
6
12
|
const meta: Meta<typeof AtlButton> = {
|
|
7
13
|
title: 'AtlButton',
|
|
8
14
|
component: AtlButton,
|
|
@@ -15,7 +21,10 @@ const meta: Meta<typeof AtlButton> = {
|
|
|
15
21
|
template: '<AtlButton v-bind="args">Button</AtlButton>',
|
|
16
22
|
}),
|
|
17
23
|
argTypes: {
|
|
18
|
-
variant: {
|
|
24
|
+
variant: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['primary', 'secondary', 'outline', 'danger'],
|
|
27
|
+
},
|
|
19
28
|
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
20
29
|
disabled: { control: 'boolean' },
|
|
21
30
|
loading: { control: 'boolean' },
|
|
@@ -31,4 +40,50 @@ const meta: Meta<typeof AtlButton> = {
|
|
|
31
40
|
export default meta;
|
|
32
41
|
type Story = StoryObj<typeof AtlButton>;
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
// One story per `variant` value.
|
|
44
|
+
//
|
|
45
|
+
// The one `play` function in this file lives here, on an enabled button: it
|
|
46
|
+
// proves the button actually fires its click handler when clicked, not just
|
|
47
|
+
// that it looks clickable.
|
|
48
|
+
export const Primary: Story = {
|
|
49
|
+
args: { variant: 'primary' },
|
|
50
|
+
render: (args) => ({
|
|
51
|
+
components: { AtlButton },
|
|
52
|
+
setup() {
|
|
53
|
+
const clicked = ref(false);
|
|
54
|
+
return { args, clicked };
|
|
55
|
+
},
|
|
56
|
+
template: `
|
|
57
|
+
<div style="display:flex;flex-direction:column;gap:0.5rem;align-items:flex-start">
|
|
58
|
+
<AtlButton v-bind="args" @click="clicked = true">Button</AtlButton>
|
|
59
|
+
<span>{{ clicked ? 'clicked' : 'not clicked' }}</span>
|
|
60
|
+
</div>
|
|
61
|
+
`,
|
|
62
|
+
}),
|
|
63
|
+
play: async ({ canvas }) => {
|
|
64
|
+
const button = canvas.getByRole('button');
|
|
65
|
+
await userEvent.click(button);
|
|
66
|
+
await expect(canvas.getByText('clicked')).toBeInTheDocument();
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Secondary: Story = {
|
|
71
|
+
args: { variant: 'secondary' },
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Outline: Story = {
|
|
75
|
+
args: { variant: 'outline' },
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Danger: Story = {
|
|
79
|
+
args: { variant: 'danger' },
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// One story per Boolean state.
|
|
83
|
+
export const Loading: Story = {
|
|
84
|
+
args: { loading: true },
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const Disabled: Story = {
|
|
88
|
+
args: { disabled: true },
|
|
89
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/angular';
|
|
2
|
+
import { AtlButton } from '@atelier-ui/angular';
|
|
3
|
+
|
|
4
|
+
// A working pattern to copy: same purpose as atl-button.stories.ts, but for
|
|
5
|
+
// a plain jsdom unit test (`npx nx test workshop-angular`) rather than a
|
|
6
|
+
// browser-rendered story — the loop for anything that is not itself a
|
|
7
|
+
// story: a service, a directive, a form-validation rule.
|
|
8
|
+
describe('AtlButton', () => {
|
|
9
|
+
it('renders with its accessible name', async () => {
|
|
10
|
+
await render('<atl-button>Click me</atl-button>', {
|
|
11
|
+
imports: [AtlButton],
|
|
12
|
+
});
|
|
13
|
+
expect(
|
|
14
|
+
screen.getByRole('button', { name: 'Click me' }),
|
|
15
|
+
).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('emits a click event when clicked', async () => {
|
|
19
|
+
const onClick = vi.fn();
|
|
20
|
+
await render('<atl-button (click)="onClick()">Click me</atl-button>', {
|
|
21
|
+
imports: [AtlButton],
|
|
22
|
+
componentProperties: { onClick },
|
|
23
|
+
});
|
|
24
|
+
await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
|
|
25
|
+
expect(onClick).toHaveBeenCalledOnce();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import angular from '@analogjs/vite-plugin-angular';
|
|
3
|
+
|
|
4
|
+
// A second Vitest config, deliberately separate from `vitest.config.ts` one
|
|
5
|
+
// directory up (the browser-mode Storybook test config) and deliberately
|
|
6
|
+
// named something OTHER than `vitest.config.*` / `vite.config.*` /
|
|
7
|
+
// `vitest.workspace.*` — see that file's own comment, and this monorepo's
|
|
8
|
+
// ADR-0112, for why: the Storybook test-run tool's own config-discovery walk
|
|
9
|
+
// only ever considers a file whose BASENAME is one of those three; content
|
|
10
|
+
// is checked only once a candidate with a matching name is found. This file
|
|
11
|
+
// isn't a candidate at all, by name, so it is only ever invoked explicitly —
|
|
12
|
+
// via the `test` target in project.json (`vitest run --config
|
|
13
|
+
// vitest.unit.config.ts`).
|
|
14
|
+
//
|
|
15
|
+
// Runs in jsdom, not a real browser: a service, a directive, or a
|
|
16
|
+
// form-validation rule needs a fast feedback loop, not Playwright +
|
|
17
|
+
// Chromium. Same `@analogjs/vite-plugin-angular` plugin as vitest.config.ts,
|
|
18
|
+
// and for the same reason documented there — it links
|
|
19
|
+
// `@atelier-ui/angular`'s partially-Ivy-compiled npm package, not just this
|
|
20
|
+
// app's own components.
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
plugins: [angular()],
|
|
23
|
+
test: {
|
|
24
|
+
name: 'workshop-angular',
|
|
25
|
+
globals: true,
|
|
26
|
+
environment: 'jsdom',
|
|
27
|
+
include: ['src/**/*.spec.*'],
|
|
28
|
+
setupFiles: ['src/test-setup.ts'],
|
|
29
|
+
// Vitest defaults to 5000ms. libs/angular/vite.config.mts (this
|
|
30
|
+
// monorepo's own equivalent) measured an Angular Testing Library
|
|
31
|
+
// render() at 220-1270ms with the machine to itself, and higher under
|
|
32
|
+
// contention — 20s means a timeout here is a real hang, not a busy
|
|
33
|
+
// laptop.
|
|
34
|
+
testTimeout: 20_000,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { AtlButton } from '@atelier-ui/react';
|
|
3
|
+
|
|
4
|
+
// A working pattern to copy: same purpose as atl-button.stories.tsx, but for
|
|
5
|
+
// a plain jsdom unit test (`npx nx test workshop-react`) rather than a
|
|
6
|
+
// browser-rendered story — the loop for anything that is not itself a
|
|
7
|
+
// story: a hook, a helper, a piece of app logic.
|
|
8
|
+
describe('AtlButton', () => {
|
|
9
|
+
it('renders with its accessible name', () => {
|
|
10
|
+
render(<AtlButton>Click me</AtlButton>);
|
|
11
|
+
expect(
|
|
12
|
+
screen.getByRole('button', { name: 'Click me' }),
|
|
13
|
+
).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('fires its click handler when clicked', () => {
|
|
17
|
+
const onClick = vi.fn();
|
|
18
|
+
render(<AtlButton onClick={onClick}>Click me</AtlButton>);
|
|
19
|
+
fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
|
|
20
|
+
expect(onClick).toHaveBeenCalledOnce();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/vitest';
|