@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.
Files changed (22) hide show
  1. package/CHANGELOG.md +59 -11
  2. package/package.json +1 -1
  3. package/src/generators/preset/files/claude/agents/component-review.md +53 -0
  4. package/src/generators/preset/files/claude/commands/verify.md +24 -0
  5. package/src/generators/preset/files/claude/hooks/format-edited.sh +77 -0
  6. package/src/generators/preset/files/claude/skills/atelier-component/SKILL.md +84 -0
  7. package/src/generators/preset/files/storybook/angular/atl-button.stories.ts.template +48 -1
  8. package/src/generators/preset/files/storybook/react/atl-button.stories.tsx +56 -1
  9. package/src/generators/preset/files/storybook/vue/atl-button.stories.ts.template +57 -2
  10. package/src/generators/preset/files/testing/angular/atl-button.spec.ts.template +27 -0
  11. package/src/generators/preset/files/testing/angular/test-setup.ts.template +6 -0
  12. package/src/generators/preset/files/testing/angular/vitest.unit.config.ts.template +36 -0
  13. package/src/generators/preset/files/testing/react/atl-button.spec.tsx +22 -0
  14. package/src/generators/preset/files/testing/react/test-setup.ts.template +1 -0
  15. package/src/generators/preset/files/testing/react/vitest.unit.config.ts.template +42 -0
  16. package/src/generators/preset/files/testing/vue/atl-button.spec.ts.template +25 -0
  17. package/src/generators/preset/files/testing/vue/test-setup.ts.template +1 -0
  18. package/src/generators/preset/files/testing/vue/vitest.unit.config.ts.template +50 -0
  19. package/src/generators/preset/preset.js +762 -359
  20. package/src/generators/preset/preset.js.map +1 -1
  21. package/src/generators/preset/schema.d.ts +2 -1
  22. package/src/generators/preset/schema.json +18 -3
@@ -0,0 +1,42 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ // A second Vitest config, named something other than vitest.config.ts /
5
+ // vite.config.ts on purpose — see the Angular version of this file, or
6
+ // vitest.config.ts one directory up, for why (ADR-0112: the Storybook
7
+ // test-run tool's own config-discovery walk keys on a file's BASENAME, and
8
+ // this one deliberately isn't a candidate).
9
+ //
10
+ // Runs in jsdom, not a real browser: a hook, a helper, or a piece of app
11
+ // logic needs a fast feedback loop, not Playwright + Chromium.
12
+ export default defineConfig({
13
+ plugins: [react()],
14
+ test: {
15
+ name: 'workshop-react',
16
+ globals: true,
17
+ environment: 'jsdom',
18
+ include: ['src/**/*.spec.*'],
19
+ setupFiles: ['src/test-setup.ts'],
20
+ server: {
21
+ deps: {
22
+ // @atelier-ui/react's built entry ships one `import './x.css'` per
23
+ // component, same as @atelier-ui/vue's (see that file's version of
24
+ // this comment for the general shape of the problem). Its
25
+ // package.json declares "type": "module" honestly (ADR-0138) and an
26
+ // unqualified `main`/`module`, so Vitest's dual-package guard sees a
27
+ // normal, self-consistent ESM package and hands it to Node's own
28
+ // module loader instead of Vite's — which then fails twice over:
29
+ // Node's loader has no idea what to do with a bare `.css` specifier
30
+ // ("Unknown file extension \".css\""), and even before it gets that
31
+ // far, the package's own extensionless relative imports (emitted by
32
+ // its `"module": "preserve"` / `"moduleResolution": "bundler"` build,
33
+ // which assumes a bundler resolves them) fail Node's stricter ESM
34
+ // resolver on their own ("Cannot find module … imported from …").
35
+ // `inline` forces this one package back through Vite's own
36
+ // pipeline, which resolves both the extensionless imports and the
37
+ // `.css` import the same way it does for every other package here.
38
+ inline: ['@atelier-ui/react'],
39
+ },
40
+ },
41
+ },
42
+ });
@@ -0,0 +1,25 @@
1
+ import { fireEvent, render, screen } from '@testing-library/vue';
2
+ import { AtlButton } from '@atelier-ui/vue';
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-vue`) rather than a
6
+ // browser-rendered story — the loop for anything that is not itself a
7
+ // story: a composable, a helper, a form-validation rule.
8
+ describe('AtlButton', () => {
9
+ it('renders with its accessible name', () => {
10
+ render(AtlButton, { slots: { default: 'Click me' } });
11
+ expect(
12
+ screen.getByRole('button', { name: 'Click me' }),
13
+ ).toBeInTheDocument();
14
+ });
15
+
16
+ it('emits a click event when clicked', async () => {
17
+ const onClick = vi.fn();
18
+ render(AtlButton, {
19
+ slots: { default: 'Click me' },
20
+ attrs: { onClick },
21
+ });
22
+ await fireEvent.click(screen.getByRole('button', { name: 'Click me' }));
23
+ expect(onClick).toHaveBeenCalledOnce();
24
+ });
25
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,50 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import vue from '@vitejs/plugin-vue';
3
+
4
+ // A second Vitest config, named something other than vitest.config.ts /
5
+ // vite.config.ts on purpose — see the Angular version of this file, or
6
+ // vitest.config.ts one directory up, for why (ADR-0112: the Storybook
7
+ // test-run tool's own config-discovery walk keys on a file's BASENAME, and
8
+ // this one deliberately isn't a candidate).
9
+ //
10
+ // Runs in jsdom, not a real browser: a composable, a helper, or a
11
+ // form-validation rule needs a fast feedback loop, not Playwright +
12
+ // Chromium.
13
+ export default defineConfig({
14
+ plugins: [vue()],
15
+ test: {
16
+ name: 'workshop-vue',
17
+ globals: true,
18
+ environment: 'jsdom',
19
+ include: ['src/**/*.spec.*'],
20
+ setupFiles: ['src/test-setup.ts'],
21
+ server: {
22
+ deps: {
23
+ // @atelier-ui/vue's built entry (index.mjs) carries an unconditional
24
+ // `import "./index.css"` banner — vite build's lib mode extracts all
25
+ // component <style> blocks into one index.css but emits no import for
26
+ // it, so the library's own vite.config.mts injects one via a rollup
27
+ // banner. That is correct for a browser or another Vite build, both
28
+ // of which have a CSS loader. Vitest's default dependency handling
29
+ // does not: because @atelier-ui/vue is unambiguous, self-consistent
30
+ // ESM (an .mjs main, an `exports` map pointing at it, no conflicting
31
+ // "type" field), Vitest hands it to Node's own module loader instead
32
+ // of running it through Vite's transform pipeline — and Node's
33
+ // loader has no idea what to do with a bare `.css` specifier
34
+ // ("Unknown file extension \".css\""), unlike Vite's, which is what
35
+ // resolves component-level CSS imports for every OTHER package here.
36
+ // `inline` forces this one package back through Vite's own pipeline,
37
+ // where the `.css` import is handled like any other test asset.
38
+ // (@atelier-ui/react's built entry has the identical per-component
39
+ // `import './x.css'` pattern and, since ADR-0138 corrected its
40
+ // package.json to declare "type": "module" honestly, needs this
41
+ // exact same `inline` entry too — see the React version of this
42
+ // file. Before that fix, React's self-contradictory package.json
43
+ // tripped Vitest's dual-package guard and got force-inlined as a
44
+ // side effect of the defect, which is exactly why it was a defect
45
+ // and not a fix.)
46
+ inline: ['@atelier-ui/vue'],
47
+ },
48
+ },
49
+ },
50
+ });