@vyriy/create 0.5.3 → 0.5.5
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/README.md +6 -2
- package/bin/index.js +3 -0
- package/cli.d.ts +5 -0
- package/cli.js +62 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +17 -18
- package/plan/plan.d.ts +0 -1
- package/plan/plan.js +1 -3
- package/plan/types.d.ts +0 -1
- package/preset/api.js +118 -5
- package/preset/base.js +109 -2
- package/preset/fullstack.js +393 -12
- package/preset/gql.js +198 -34
- package/preset/library.js +346 -180
- package/preset/mfe.js +450 -15
- package/preset/rest.js +182 -6
- package/preset/spa.js +236 -7
- package/preset/ssg.js +266 -13
- package/preset/ssr.js +256 -10
- package/prompt/index.d.ts +0 -1
- package/prompt/index.js +0 -1
- package/prompt/preset.js +3 -2
- package/types.d.ts +8 -0
- package/bin/vyriy-create.js +0 -17
- package/prompt/scope.d.ts +0 -2
- package/prompt/scope.js +0 -2
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ vyriy-create app --dry-run
|
|
|
18
18
|
vyriy-create . --overwrite
|
|
19
19
|
vyriy-create app --no-install
|
|
20
20
|
vyriy-create app --no-verify
|
|
21
|
+
vyriy-create --help
|
|
22
|
+
vyriy-create --version
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
## API
|
|
@@ -28,10 +30,10 @@ Install as a project dependency:
|
|
|
28
30
|
npm install @vyriy/create
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
Use the creator from code:
|
|
33
|
+
Use the creator and CLI helpers from code:
|
|
32
34
|
|
|
33
35
|
```ts
|
|
34
|
-
import { create } from '@vyriy/create';
|
|
36
|
+
import { create, runCreateCli } from '@vyriy/create';
|
|
35
37
|
|
|
36
38
|
const code = await create({
|
|
37
39
|
directory: 'app',
|
|
@@ -41,6 +43,8 @@ const code = await create({
|
|
|
41
43
|
install: true,
|
|
42
44
|
verify: true,
|
|
43
45
|
});
|
|
46
|
+
|
|
47
|
+
await runCreateCli(['app', '--dry-run']);
|
|
44
48
|
```
|
|
45
49
|
|
|
46
50
|
`create(options)` creates a Vyriy project from the configured starter options and returns a process-style exit code.
|
package/bin/index.js
ADDED
package/cli.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CreateHelpText, ParseCreateBinArgs, RunCreateCli } from './types.js';
|
|
2
|
+
export declare const createVersion: string;
|
|
3
|
+
export declare const createCreateHelpText: CreateHelpText;
|
|
4
|
+
export declare const parseCreateBinArgs: ParseCreateBinArgs;
|
|
5
|
+
export declare const runCreateCli: RunCreateCli;
|
package/cli.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import packageJson from './package.json' with { type: 'json' };
|
|
2
|
+
import { create } from './create.js';
|
|
3
|
+
export const createVersion = packageJson.version;
|
|
4
|
+
export const createCreateHelpText = (command = 'vyriy-create', alias = 'vc') => {
|
|
5
|
+
const aliasText = alias ? ` ${alias} [name] Alias for ${command}\n` : '';
|
|
6
|
+
const aliasExampleText = alias ? `\n ${alias} app` : '';
|
|
7
|
+
return `Vyriy Project Creator
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
${command} [name] Create a new Vyriy project
|
|
11
|
+
${command} . Initialize a new Vyriy project in the current directory
|
|
12
|
+
${aliasText}\
|
|
13
|
+
${command} --help, -h Show help
|
|
14
|
+
${command} --version, -v Show version
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--dry-run Print the merged file plan without writing project files
|
|
18
|
+
--overwrite Overwrite existing generated paths
|
|
19
|
+
--skip-existing Leave existing generated paths untouched
|
|
20
|
+
--no-install Create files without installing dependencies
|
|
21
|
+
--no-verify Install dependencies without running checks
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
${command} app
|
|
25
|
+
${command} app --dry-run
|
|
26
|
+
${command} .
|
|
27
|
+
${command} . --no-verify${aliasExampleText}`;
|
|
28
|
+
};
|
|
29
|
+
export const parseCreateBinArgs = (args) => {
|
|
30
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
31
|
+
return { type: 'help' };
|
|
32
|
+
}
|
|
33
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
34
|
+
return { type: 'version' };
|
|
35
|
+
}
|
|
36
|
+
const install = !args.includes('--no-install');
|
|
37
|
+
return {
|
|
38
|
+
type: 'create',
|
|
39
|
+
directory: args.find((arg) => !arg.startsWith('-')) ?? '',
|
|
40
|
+
dryRun: args.includes('--dry-run'),
|
|
41
|
+
overwrite: args.includes('--overwrite'),
|
|
42
|
+
skipExisting: args.includes('--skip-existing'),
|
|
43
|
+
install,
|
|
44
|
+
verify: install && !args.includes('--no-verify'),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export const runCreateCli = async (args = [], command = 'vyriy-create', alias = 'vc') => {
|
|
48
|
+
const parsed = parseCreateBinArgs(args);
|
|
49
|
+
switch (parsed.type) {
|
|
50
|
+
case 'help':
|
|
51
|
+
console.log(createCreateHelpText(command, alias));
|
|
52
|
+
process.exitCode = 0;
|
|
53
|
+
break;
|
|
54
|
+
case 'version':
|
|
55
|
+
console.log(createVersion);
|
|
56
|
+
process.exitCode = 0;
|
|
57
|
+
break;
|
|
58
|
+
case 'create':
|
|
59
|
+
process.exitCode = await create(parsed);
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyriy/create",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Vyriy project creation CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.0.0"
|
|
8
8
|
},
|
|
9
|
-
"packageManager": "yarn@4.
|
|
10
|
-
"bin":
|
|
9
|
+
"packageManager": "yarn@4.16.0",
|
|
10
|
+
"bin": {
|
|
11
|
+
"vc": "./bin/index.js",
|
|
12
|
+
"vyriy-create": "./bin/index.js"
|
|
13
|
+
},
|
|
11
14
|
"dependencies": {
|
|
12
|
-
"@vyriy/check": "0.5.
|
|
15
|
+
"@vyriy/check": "0.5.5"
|
|
13
16
|
},
|
|
14
17
|
"peerDependencies": {
|
|
15
18
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -28,7 +31,6 @@
|
|
|
28
31
|
"react-dom": "^19.2.7",
|
|
29
32
|
"rimraf": "^6.1.3",
|
|
30
33
|
"sass": "^1.100.0",
|
|
31
|
-
"serve": "^14.2.6",
|
|
32
34
|
"storybook": "^10.4.2",
|
|
33
35
|
"stylelint": "^17.12.0",
|
|
34
36
|
"tsx": "^4.22.4",
|
|
@@ -85,9 +87,6 @@
|
|
|
85
87
|
"sass": {
|
|
86
88
|
"optional": true
|
|
87
89
|
},
|
|
88
|
-
"serve": {
|
|
89
|
-
"optional": true
|
|
90
|
-
},
|
|
91
90
|
"storybook": {
|
|
92
91
|
"optional": true
|
|
93
92
|
},
|
|
@@ -122,6 +121,16 @@
|
|
|
122
121
|
"import": "./index.js",
|
|
123
122
|
"default": "./index.js"
|
|
124
123
|
},
|
|
124
|
+
"./cli": {
|
|
125
|
+
"types": "./cli.d.ts",
|
|
126
|
+
"import": "./cli.js",
|
|
127
|
+
"default": "./cli.js"
|
|
128
|
+
},
|
|
129
|
+
"./cli.js": {
|
|
130
|
+
"types": "./cli.d.ts",
|
|
131
|
+
"import": "./cli.js",
|
|
132
|
+
"default": "./cli.js"
|
|
133
|
+
},
|
|
125
134
|
"./create": {
|
|
126
135
|
"types": "./create.d.ts",
|
|
127
136
|
"import": "./create.js",
|
|
@@ -331,16 +340,6 @@
|
|
|
331
340
|
"types": "./prompt/resolve-option.d.ts",
|
|
332
341
|
"import": "./prompt/resolve-option.js",
|
|
333
342
|
"default": "./prompt/resolve-option.js"
|
|
334
|
-
},
|
|
335
|
-
"./prompt/scope": {
|
|
336
|
-
"types": "./prompt/scope.d.ts",
|
|
337
|
-
"import": "./prompt/scope.js",
|
|
338
|
-
"default": "./prompt/scope.js"
|
|
339
|
-
},
|
|
340
|
-
"./prompt/scope.js": {
|
|
341
|
-
"types": "./prompt/scope.d.ts",
|
|
342
|
-
"import": "./prompt/scope.js",
|
|
343
|
-
"default": "./prompt/scope.js"
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
}
|
package/plan/plan.d.ts
CHANGED
package/plan/plan.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stdin, stdout } from 'node:process';
|
|
2
2
|
import { dirname, resolve } from 'node:path';
|
|
3
3
|
import { createInterface } from 'node:readline';
|
|
4
|
-
import { prompt, preset as promptPreset
|
|
4
|
+
import { prompt, preset as promptPreset } from '../prompt/index.js';
|
|
5
5
|
import { question as createQuestion } from './question.js';
|
|
6
6
|
const toDirectoryName = (name, fallback) => {
|
|
7
7
|
const directoryName = name.trim().replaceAll(/[\s\\/]+/g, '_');
|
|
@@ -17,7 +17,6 @@ export const plan = async (dirName, appPath) => {
|
|
|
17
17
|
const description = await prompt(question, 'Project description', 'Calm cloud-ready application');
|
|
18
18
|
const target = await prompt(question, 'Target directory', getTargetDefault(name, dirName, appPath));
|
|
19
19
|
const preset = await promptPreset(question, stdout);
|
|
20
|
-
const scope = await promptScope(question, preset, name);
|
|
21
20
|
const confirmation = (await prompt(question, 'Use this project plan?', 'y')).toLowerCase();
|
|
22
21
|
return confirmation === 'y'
|
|
23
22
|
? {
|
|
@@ -25,7 +24,6 @@ export const plan = async (dirName, appPath) => {
|
|
|
25
24
|
description,
|
|
26
25
|
target,
|
|
27
26
|
preset,
|
|
28
|
-
scope,
|
|
29
27
|
}
|
|
30
28
|
: undefined;
|
|
31
29
|
}
|
package/plan/types.d.ts
CHANGED
package/preset/api.js
CHANGED
|
@@ -33,14 +33,14 @@ export const api = (options) => ({
|
|
|
33
33
|
test: "run-s 'test:*'",
|
|
34
34
|
'fix:prettier': 'prettier . --write',
|
|
35
35
|
'fix:eslint': 'eslint . --fix',
|
|
36
|
+
'start:api': 'sh workspaces/api/bin/start.sh',
|
|
36
37
|
'lint:ts': 'tsc',
|
|
37
38
|
'lint:prettier': 'prettier . --check',
|
|
38
39
|
'lint:eslint': 'eslint .',
|
|
40
|
+
'build:api': 'rimraf dist && sh workspaces/api/bin/build.sh',
|
|
39
41
|
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
40
42
|
'test:jest': 'jest',
|
|
41
43
|
postinstall: 'husky',
|
|
42
|
-
'start:api': 'sh workspaces/api/bin/start.sh',
|
|
43
|
-
'build:api': 'rimraf dist && sh workspaces/api/bin/build.sh',
|
|
44
44
|
},
|
|
45
45
|
dependencies: {
|
|
46
46
|
'@vyriy/typescript-config': `^${packageJson.version}`,
|
|
@@ -65,11 +65,81 @@ export const api = (options) => ({
|
|
|
65
65
|
'@vyriy/server': `^${packageJson.version}`,
|
|
66
66
|
},
|
|
67
67
|
}, null, 2) + '\n',
|
|
68
|
-
'README.md': `#
|
|
68
|
+
'README.md': `# Api
|
|
69
|
+
|
|
70
|
+
Calm cloud-ready application built as a Yarn workspace.
|
|
71
|
+
|
|
72
|
+
The repository currently contains one runtime workspace:
|
|
73
|
+
|
|
74
|
+
- \`workspaces/api\` - HTTP API entry point based on \`@vyriy/server\` and \`@vyriy/handler\`.
|
|
75
|
+
|
|
76
|
+
## Requirements
|
|
77
|
+
|
|
78
|
+
- Node.js \`>=24.0.0\`
|
|
79
|
+
- Yarn \`4.16.0\`
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
Install dependencies:
|
|
84
|
+
|
|
85
|
+
\`\`\`bash
|
|
86
|
+
yarn install
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
Start the API:
|
|
90
|
+
|
|
91
|
+
\`\`\`bash
|
|
92
|
+
yarn start
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
Build the API bundle:
|
|
96
|
+
|
|
97
|
+
\`\`\`bash
|
|
98
|
+
yarn build
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
Run all project checks:
|
|
102
|
+
|
|
103
|
+
\`\`\`bash
|
|
104
|
+
yarn check
|
|
105
|
+
\`\`\`
|
|
106
|
+
|
|
107
|
+
## Scripts
|
|
108
|
+
|
|
109
|
+
- \`yarn start\` - start all workspace services.
|
|
110
|
+
- \`yarn start:api\` - run the API from \`workspaces/api/index.ts\`.
|
|
111
|
+
- \`yarn build\` - build all project outputs.
|
|
112
|
+
- \`yarn build:api\` - create the production API bundle in \`dist/api\`.
|
|
113
|
+
- \`yarn test\` - run Jest tests.
|
|
114
|
+
- \`yarn lint\` - run TypeScript, Prettier, and ESLint validation.
|
|
115
|
+
- \`yarn storybook\` - start Storybook documentation.
|
|
116
|
+
|
|
117
|
+
## Project Structure
|
|
118
|
+
|
|
119
|
+
- \`workspaces/api\` - API source, tests, build script, and workspace README.
|
|
120
|
+
- \`.storybook\` - Storybook configuration for MDX documentation and stories.
|
|
121
|
+
- \`doc.mdx\` - root Storybook documentation page backed by this README.
|
|
122
|
+
- \`dist\` - generated production output.
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
Keep public behavior documented in the relevant workspace README and covered by
|
|
127
|
+
matching tests. For API changes, start with \`workspaces/api/index.ts\` and keep
|
|
128
|
+
\`workspaces/api/index.test.ts\` aligned with the request/response contract.
|
|
129
|
+
|
|
130
|
+
## Project Guidance
|
|
131
|
+
|
|
132
|
+
These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
|
|
133
|
+
|
|
134
|
+
- [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.
|
|
135
|
+
- [Calm App Structure for the Vyriy Ecosystem](https://vyriy.dev/blog/vyriy-calm-app-structure/) - a practical project structure for Vyriy applications: shared configs, small packages, thin workspaces, Storybook docs, tests, and deployable entry points.
|
|
136
|
+
- [One Handler, Many Runtimes](https://vyriy.dev/examples/one-handler-many-runtimes/) - how @vyriy/handler, @vyriy/router, and @vyriy/server compose a calm Lambda-compatible API that can run locally, in Docker, Fargate-style HTTP runtimes, and AWS Lambda.
|
|
137
|
+
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
|
|
138
|
+
`,
|
|
69
139
|
'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
70
140
|
import ReadMe from './README.md?raw';
|
|
71
141
|
|
|
72
|
-
<Meta title="
|
|
142
|
+
<Meta title="Api" />
|
|
73
143
|
|
|
74
144
|
<Markdown>{ReadMe}</Markdown>
|
|
75
145
|
`,
|
|
@@ -195,7 +265,50 @@ import ReadMe from './README.md?raw';
|
|
|
195
265
|
|
|
196
266
|
<Markdown>{ReadMe}</Markdown>
|
|
197
267
|
`,
|
|
198
|
-
'workspaces/api/README.md': `#
|
|
268
|
+
'workspaces/api/README.md': `# @w/api
|
|
269
|
+
|
|
270
|
+
HTTP API workspace for the application.
|
|
271
|
+
|
|
272
|
+
The current handler starts a \`@vyriy/server\` instance with an \`@vyriy/handler\`
|
|
273
|
+
API adapter. For every request it returns a JSON response with the requested
|
|
274
|
+
path:
|
|
275
|
+
|
|
276
|
+
\`\`\`json
|
|
277
|
+
{
|
|
278
|
+
"path": "/healthcheck"
|
|
279
|
+
}
|
|
280
|
+
\`\`\`
|
|
281
|
+
|
|
282
|
+
## Usage
|
|
283
|
+
|
|
284
|
+
Start the API from the repository root:
|
|
285
|
+
|
|
286
|
+
\`\`\`bash
|
|
287
|
+
yarn start:api
|
|
288
|
+
\`\`\`
|
|
289
|
+
|
|
290
|
+
Build the production bundle:
|
|
291
|
+
|
|
292
|
+
\`\`\`bash
|
|
293
|
+
yarn build:api
|
|
294
|
+
\`\`\`
|
|
295
|
+
|
|
296
|
+
The build writes a CommonJS bundle to \`dist/api/index.js\` and copies the
|
|
297
|
+
workspace \`package.json\` into \`dist/api\`.
|
|
298
|
+
|
|
299
|
+
## Development
|
|
300
|
+
|
|
301
|
+
The API entry point is \`index.ts\`.
|
|
302
|
+
|
|
303
|
+
Update the handler there when adding routes or changing response behavior, and
|
|
304
|
+
keep \`index.test.ts\` aligned with the public behavior.
|
|
305
|
+
|
|
306
|
+
Run the focused test suite with:
|
|
307
|
+
|
|
308
|
+
\`\`\`bash
|
|
309
|
+
yarn jest workspaces/api --runInBand --coverage=false
|
|
310
|
+
\`\`\`
|
|
311
|
+
`,
|
|
199
312
|
'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
|
|
200
313
|
import { ssr, external } from '@vyriy/webpack-config';
|
|
201
314
|
|
package/preset/base.js
CHANGED
|
@@ -53,11 +53,118 @@ export const base = ({ name, description }) => ({
|
|
|
53
53
|
'cross-env': packageJson.peerDependencies['cross-env'],
|
|
54
54
|
},
|
|
55
55
|
}, null, 2) + '\n',
|
|
56
|
-
'README.md': `#
|
|
56
|
+
'README.md': `# Base
|
|
57
|
+
|
|
58
|
+
Base is a minimal project preset for starting new applications, packages, or workspaces with a calm shared foundation already in place.
|
|
59
|
+
|
|
60
|
+
The repository intentionally contains configuration and workflow glue instead of product code. Its main entry point is Storybook: it works as both living documentation and a playground for future components, UI states, examples, and integration notes.
|
|
61
|
+
|
|
62
|
+
## Why Storybook
|
|
63
|
+
|
|
64
|
+
Storybook is configured from the start so the project has a visible documentation surface before any application-specific structure exists.
|
|
65
|
+
|
|
66
|
+
Use it to:
|
|
67
|
+
|
|
68
|
+
- document project decisions and package APIs with MDX;
|
|
69
|
+
- develop and review future components in isolation;
|
|
70
|
+
- capture component states, variants, and edge cases as stories;
|
|
71
|
+
- build a static documentation site that can be shared or deployed;
|
|
72
|
+
- keep README-driven documentation visible inside the same developer UI.
|
|
73
|
+
|
|
74
|
+
The root \`doc.mdx\` renders this README in Storybook, so the project overview is available both in the repository and in the local documentation playground.
|
|
75
|
+
|
|
76
|
+
## Included Foundation
|
|
77
|
+
|
|
78
|
+
- TypeScript configuration from \`@vyriy/typescript-config\`.
|
|
79
|
+
- ESLint configuration from \`@vyriy/eslint-config\`.
|
|
80
|
+
- Prettier configuration from \`@vyriy/prettier-config\`.
|
|
81
|
+
- Jest configuration from \`@vyriy/jest-config\`.
|
|
82
|
+
- Storybook configuration from \`@vyriy/storybook-config\`.
|
|
83
|
+
- Husky hooks for dependency refresh after branch changes or merges and quality checks before commit or push.
|
|
84
|
+
|
|
85
|
+
## Requirements
|
|
86
|
+
|
|
87
|
+
- Node.js \`>=24.0.0\`.
|
|
88
|
+
- Yarn \`4.16.0\`.
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
\`\`\`bash
|
|
93
|
+
yarn
|
|
94
|
+
\`\`\`
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
\`\`\`bash
|
|
99
|
+
yarn storybook
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
Starts the local Storybook playground on port \`6006\`.
|
|
103
|
+
|
|
104
|
+
\`\`\`bash
|
|
105
|
+
yarn build
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
Builds the static Storybook output.
|
|
109
|
+
|
|
110
|
+
\`\`\`bash
|
|
111
|
+
yarn check
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
Runs the full project validation pipeline: \`lint\`, \`build\`, and \`test\`.
|
|
115
|
+
|
|
116
|
+
\`\`\`bash
|
|
117
|
+
yarn fix
|
|
118
|
+
\`\`\`
|
|
119
|
+
|
|
120
|
+
Formats the project and applies available ESLint fixes.
|
|
121
|
+
|
|
122
|
+
\`\`\`bash
|
|
123
|
+
yarn lint
|
|
124
|
+
\`\`\`
|
|
125
|
+
|
|
126
|
+
Checks TypeScript, formatting, and ESLint rules.
|
|
127
|
+
|
|
128
|
+
\`\`\`bash
|
|
129
|
+
yarn test
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
Runs Jest. The command is allowed to pass in an empty preset before tests are added.
|
|
133
|
+
|
|
134
|
+
## Structure
|
|
135
|
+
|
|
136
|
+
\`\`\`text
|
|
137
|
+
.
|
|
138
|
+
├── .storybook/
|
|
139
|
+
│ ├── main.ts
|
|
140
|
+
│ └── preview.tsx
|
|
141
|
+
├── .husky/
|
|
142
|
+
├── doc.mdx
|
|
143
|
+
├── eslint.config.ts
|
|
144
|
+
├── jest.config.ts
|
|
145
|
+
├── prettier.config.ts
|
|
146
|
+
├── tsconfig.json
|
|
147
|
+
└── package.json
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
## Adding Project Code
|
|
151
|
+
|
|
152
|
+
Add source code where it fits the final project shape, for example under \`packages/*\` or \`workspaces/*\`. These paths are already included in \`tsconfig.json\`.
|
|
153
|
+
|
|
154
|
+
When adding public components or package APIs, add matching stories or MDX documentation so Storybook remains the first place to inspect behavior, examples, and supported states.
|
|
155
|
+
|
|
156
|
+
## Project Guidance
|
|
157
|
+
|
|
158
|
+
These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
|
|
159
|
+
|
|
160
|
+
- [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.
|
|
161
|
+
- [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/) - how to organize component code, tests, stories, and public exports.
|
|
162
|
+
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
|
|
163
|
+
`,
|
|
57
164
|
'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
58
165
|
import ReadMe from './README.md?raw';
|
|
59
166
|
|
|
60
|
-
<Meta title="
|
|
167
|
+
<Meta title="Base" />
|
|
61
168
|
|
|
62
169
|
<Markdown>{ReadMe}</Markdown>
|
|
63
170
|
`,
|