@atelier-ui/create-workspace 0.2.43 → 0.2.44
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 +32 -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 +21 -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
|
@@ -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
|
+
// (Confirmed by direct repro: @atelier-ui/react's built entry has the
|
|
39
|
+
// identical per-component `import './x.css'` pattern and does NOT
|
|
40
|
+
// need this — its package.json inconsistently declares
|
|
41
|
+
// `"type": "commonjs"` while shipping raw ESM syntax, which trips
|
|
42
|
+
// Vitest's own dual-package guard and forces it through the same
|
|
43
|
+
// inlined path automatically. That is not a design guarantee: if
|
|
44
|
+
// @atelier-ui/react's build is ever made internally consistent, it
|
|
45
|
+
// will need this exact same `inline` entry.)
|
|
46
|
+
inline: ['@atelier-ui/vue'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|