@vyriy/create 0.5.4 → 0.5.6
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/package.json +2 -16
- 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/fullstack.js +393 -12
- package/preset/gql.js +198 -34
- package/preset/library.js +346 -180
- package/preset/mfe.js +546 -16
- 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/scope.d.ts +0 -2
- package/prompt/scope.js +0 -2
package/preset/rest.js
CHANGED
|
@@ -33,14 +33,14 @@ export const rest = (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}`,
|
|
@@ -67,11 +67,119 @@ export const rest = (options) => ({
|
|
|
67
67
|
'@vyriy/html': `^${packageJson.version}`,
|
|
68
68
|
},
|
|
69
69
|
}, null, 2) + '\n',
|
|
70
|
-
'README.md': `#
|
|
70
|
+
'README.md': `# REST API
|
|
71
|
+
|
|
72
|
+
Calm cloud-ready application built as a Yarn workspace.
|
|
73
|
+
|
|
74
|
+
The repository currently contains a single API workspace that serves a small
|
|
75
|
+
HTTP API, publishes an OpenAPI document, and renders the document with Scalar.
|
|
76
|
+
The root package owns shared tooling for TypeScript, ESLint, Prettier, Jest,
|
|
77
|
+
Storybook, and workspace-level build scripts.
|
|
78
|
+
|
|
79
|
+
## Requirements
|
|
80
|
+
|
|
81
|
+
- Node.js \`>=24.0.0\`
|
|
82
|
+
- Yarn \`4.16.0\`
|
|
83
|
+
|
|
84
|
+
## Workspaces
|
|
85
|
+
|
|
86
|
+
| Workspace | Description |
|
|
87
|
+
| -------------------------------------- | ------------------------------------------------------ |
|
|
88
|
+
| [\`@w/api\`](./workspaces/api/README.md) | HTTP API server with OpenAPI and Scalar documentation. |
|
|
89
|
+
|
|
90
|
+
## Local development
|
|
91
|
+
|
|
92
|
+
Install dependencies:
|
|
93
|
+
|
|
94
|
+
\`\`\`bash
|
|
95
|
+
yarn install
|
|
96
|
+
\`\`\`
|
|
97
|
+
|
|
98
|
+
Start all configured services:
|
|
99
|
+
|
|
100
|
+
\`\`\`bash
|
|
101
|
+
yarn start
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
Start only the API:
|
|
105
|
+
|
|
106
|
+
\`\`\`bash
|
|
107
|
+
yarn start:api
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
The API listens on \`PORT\` through \`@vyriy/server\`; when \`PORT\` is not set, the
|
|
111
|
+
default port is \`3000\`.
|
|
112
|
+
|
|
113
|
+
After the API starts, open:
|
|
114
|
+
|
|
115
|
+
- \`http://localhost:3000/\` for the Scalar API reference.
|
|
116
|
+
- \`http://localhost:3000/openapi.json\` for the raw OpenAPI document.
|
|
117
|
+
- \`http://localhost:3000/api/test\` for the test endpoint.
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
Run Storybook:
|
|
122
|
+
|
|
123
|
+
\`\`\`bash
|
|
124
|
+
yarn storybook
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
The root \`doc.mdx\` imports this README for project-level documentation.
|
|
128
|
+
\`workspaces/api/doc.mdx\` imports the API workspace README for API-specific
|
|
129
|
+
documentation.
|
|
130
|
+
|
|
131
|
+
## Validation
|
|
132
|
+
|
|
133
|
+
Run all checks:
|
|
134
|
+
|
|
135
|
+
\`\`\`bash
|
|
136
|
+
yarn check
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
Run checks separately:
|
|
140
|
+
|
|
141
|
+
\`\`\`bash
|
|
142
|
+
yarn lint
|
|
143
|
+
yarn build
|
|
144
|
+
yarn test
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
Run the focused API test suite:
|
|
148
|
+
|
|
149
|
+
\`\`\`bash
|
|
150
|
+
yarn jest workspaces/api --runInBand --coverage=false
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
## Build
|
|
154
|
+
|
|
155
|
+
Build all configured outputs:
|
|
156
|
+
|
|
157
|
+
\`\`\`bash
|
|
158
|
+
yarn build
|
|
159
|
+
\`\`\`
|
|
160
|
+
|
|
161
|
+
Build only the API bundle:
|
|
162
|
+
|
|
163
|
+
\`\`\`bash
|
|
164
|
+
yarn build:api
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
The API build writes a CommonJS server bundle to \`dist/api/index.js\` and copies
|
|
168
|
+
a runtime \`package.json\` into \`dist/api\`.
|
|
169
|
+
|
|
170
|
+
## Project Guidance
|
|
171
|
+
|
|
172
|
+
These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
|
|
173
|
+
|
|
174
|
+
- [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.
|
|
175
|
+
- [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.
|
|
176
|
+
- [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.
|
|
177
|
+
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
|
|
178
|
+
`,
|
|
71
179
|
'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
72
180
|
import ReadMe from './README.md?raw';
|
|
73
181
|
|
|
74
|
-
<Meta title="
|
|
182
|
+
<Meta title="REST API" />
|
|
75
183
|
|
|
76
184
|
<Markdown>{ReadMe}</Markdown>
|
|
77
185
|
`,
|
|
@@ -197,7 +305,75 @@ import ReadMe from './README.md?raw';
|
|
|
197
305
|
|
|
198
306
|
<Markdown>{ReadMe}</Markdown>
|
|
199
307
|
`,
|
|
200
|
-
'workspaces/api/README.md': `#
|
|
308
|
+
'workspaces/api/README.md': `# REST API
|
|
309
|
+
|
|
310
|
+
Calm cloud-ready application API workspace.
|
|
311
|
+
|
|
312
|
+
This workspace starts a small HTTP API with \`@vyriy/server\`, adapts the router
|
|
313
|
+
through \`@vyriy/handler\`, and documents the available endpoints with an
|
|
314
|
+
OpenAPI document rendered by Scalar.
|
|
315
|
+
|
|
316
|
+
## Routes
|
|
317
|
+
|
|
318
|
+
| Method | Path | Description |
|
|
319
|
+
| ------ | --------------- | ------------------------------------------------- |
|
|
320
|
+
| \`GET\` | \`/\` | Serves the Scalar API reference UI. |
|
|
321
|
+
| \`GET\` | \`/openapi.json\` | Returns the OpenAPI 3.0 document for the API. |
|
|
322
|
+
| \`GET\` | \`/api/test\` | Returns a JSON test response: \`{ "test": "ok" }\`. |
|
|
323
|
+
|
|
324
|
+
Unknown routes return a \`404\` JSON response.
|
|
325
|
+
|
|
326
|
+
## Local development
|
|
327
|
+
|
|
328
|
+
Start the API from the repository root:
|
|
329
|
+
|
|
330
|
+
\`\`\`bash
|
|
331
|
+
yarn start:api
|
|
332
|
+
\`\`\`
|
|
333
|
+
|
|
334
|
+
The server listens on \`PORT\` through \`@vyriy/server\`; when \`PORT\` is not set,
|
|
335
|
+
the default port is \`3000\`.
|
|
336
|
+
|
|
337
|
+
After the server starts, open:
|
|
338
|
+
|
|
339
|
+
- \`http://localhost:3000/\` for the API reference UI.
|
|
340
|
+
- \`http://localhost:3000/openapi.json\` for the raw OpenAPI document.
|
|
341
|
+
- \`http://localhost:3000/api/test\` for the test endpoint.
|
|
342
|
+
|
|
343
|
+
## Validation
|
|
344
|
+
|
|
345
|
+
Run the API test suite:
|
|
346
|
+
|
|
347
|
+
\`\`\`bash
|
|
348
|
+
yarn jest workspaces/api --runInBand --coverage=false
|
|
349
|
+
\`\`\`
|
|
350
|
+
|
|
351
|
+
Run the full repository checks:
|
|
352
|
+
|
|
353
|
+
\`\`\`bash
|
|
354
|
+
yarn check
|
|
355
|
+
\`\`\`
|
|
356
|
+
|
|
357
|
+
## Build
|
|
358
|
+
|
|
359
|
+
Build the API bundle from the repository root:
|
|
360
|
+
|
|
361
|
+
\`\`\`bash
|
|
362
|
+
yarn build:api
|
|
363
|
+
\`\`\`
|
|
364
|
+
|
|
365
|
+
The build writes a CommonJS server bundle to \`dist/api/index.js\` and copies a
|
|
366
|
+
runtime \`package.json\` into \`dist/api\`.
|
|
367
|
+
|
|
368
|
+
## Implementation notes
|
|
369
|
+
|
|
370
|
+
- \`index.ts\` owns the router, OpenAPI document, Scalar UI route, and server
|
|
371
|
+
startup.
|
|
372
|
+
- \`index.test.ts\` mocks the server adapter, loads \`index.ts\`, and validates the
|
|
373
|
+
registered route behavior.
|
|
374
|
+
- \`doc.mdx\` imports this README so the same documentation appears in Storybook
|
|
375
|
+
under \`Workspaces/API\`.
|
|
376
|
+
`,
|
|
201
377
|
'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
|
|
202
378
|
import { ssr, external } from '@vyriy/webpack-config';
|
|
203
379
|
|
|
@@ -313,7 +489,7 @@ router.get('/', async () => {
|
|
|
313
489
|
});
|
|
314
490
|
});
|
|
315
491
|
|
|
316
|
-
server(api(
|
|
492
|
+
server(api(router.handle()));
|
|
317
493
|
`,
|
|
318
494
|
'workspaces/api/index.test.ts': `import { describe, expect, it, jest } from '@jest/globals';
|
|
319
495
|
import type { APIGatewayProxyEvent } from '@vyriy/router';
|
package/preset/spa.js
CHANGED
|
@@ -35,15 +35,15 @@ export const spa = (options) => ({
|
|
|
35
35
|
'fix:prettier': 'prettier . --write',
|
|
36
36
|
'fix:eslint': 'eslint . --fix',
|
|
37
37
|
'fix:stylelint': 'stylelint "**/*.{css,scss}" --fix',
|
|
38
|
+
'start:spa': 'sh workspaces/spa/bin/start.sh',
|
|
38
39
|
'lint:ts': 'tsc',
|
|
39
40
|
'lint:prettier': 'prettier . --check',
|
|
40
41
|
'lint:eslint': 'eslint .',
|
|
41
42
|
'lint:stylelint': 'stylelint "**/*.{css,scss}"',
|
|
43
|
+
'build:spa': 'rimraf dist && sh workspaces/spa/bin/build.sh',
|
|
42
44
|
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
43
45
|
'test:jest': 'jest',
|
|
44
46
|
postinstall: 'husky',
|
|
45
|
-
'start:spa': 'sh workspaces/spa/bin/start.sh',
|
|
46
|
-
'build:spa': 'rimraf dist && sh workspaces/spa/bin/build.sh',
|
|
47
47
|
},
|
|
48
48
|
dependencies: {
|
|
49
49
|
'@vyriy/typescript-config': `^${packageJson.version}`,
|
|
@@ -73,13 +73,119 @@ export const spa = (options) => ({
|
|
|
73
73
|
'@vyriy/cn': `^${packageJson.version}`,
|
|
74
74
|
'@vyriy/html': `^${packageJson.version}`,
|
|
75
75
|
'@vyriy/browserslist-config': `^${packageJson.version}`,
|
|
76
|
+
'@vyriy/render': `^${packageJson.version}`,
|
|
76
77
|
},
|
|
77
78
|
}, null, 2) + '\n',
|
|
78
|
-
'README.md': `#
|
|
79
|
+
'README.md': `# SPA
|
|
80
|
+
|
|
81
|
+
Calm cloud-ready application built as a Yarn workspace monorepo.
|
|
82
|
+
|
|
83
|
+
## Workspaces
|
|
84
|
+
|
|
85
|
+
### \`@w/spa\`
|
|
86
|
+
|
|
87
|
+
Client-side React application in \`workspaces/spa\`.
|
|
88
|
+
|
|
89
|
+
- Entry point: \`workspaces/spa/index.tsx\`
|
|
90
|
+
- Webpack config: \`workspaces/spa/webpack.config.ts\`
|
|
91
|
+
- Production output: \`dist/spa/index.js\`
|
|
92
|
+
- Documentation: \`workspaces/spa/README.md\`
|
|
93
|
+
|
|
94
|
+
### \`@p/components\`
|
|
95
|
+
|
|
96
|
+
Shared React component package in \`packages/components\`.
|
|
97
|
+
|
|
98
|
+
- Public entry point: \`packages/components/index.ts\`
|
|
99
|
+
- Current public exports: \`Page\`, \`PageProps\`, \`PageType\`
|
|
100
|
+
- Documentation: \`packages/components/README.md\`
|
|
101
|
+
|
|
102
|
+
## Requirements
|
|
103
|
+
|
|
104
|
+
- Node.js \`>=24.0.0\`
|
|
105
|
+
- Yarn \`4.16.0\`
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
Start the SPA development server:
|
|
110
|
+
|
|
111
|
+
\`\`\`bash
|
|
112
|
+
yarn start:spa
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
Start Storybook:
|
|
116
|
+
|
|
117
|
+
\`\`\`bash
|
|
118
|
+
yarn storybook
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
Run all start scripts:
|
|
122
|
+
|
|
123
|
+
\`\`\`bash
|
|
124
|
+
yarn start
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
## Build
|
|
128
|
+
|
|
129
|
+
Build the SPA:
|
|
130
|
+
|
|
131
|
+
\`\`\`bash
|
|
132
|
+
yarn build:spa
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
Build Storybook:
|
|
136
|
+
|
|
137
|
+
\`\`\`bash
|
|
138
|
+
yarn build:storybook
|
|
139
|
+
\`\`\`
|
|
140
|
+
|
|
141
|
+
Run all build scripts:
|
|
142
|
+
|
|
143
|
+
\`\`\`bash
|
|
144
|
+
yarn build
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
## Validation
|
|
148
|
+
|
|
149
|
+
Run the full project check:
|
|
150
|
+
|
|
151
|
+
\`\`\`bash
|
|
152
|
+
yarn check
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
Run individual validation steps:
|
|
156
|
+
|
|
157
|
+
\`\`\`bash
|
|
158
|
+
yarn lint
|
|
159
|
+
yarn test
|
|
160
|
+
\`\`\`
|
|
161
|
+
|
|
162
|
+
Run focused Jest checks:
|
|
163
|
+
|
|
164
|
+
\`\`\`bash
|
|
165
|
+
yarn jest packages/components --runInBand --coverage=false
|
|
166
|
+
yarn jest workspaces/spa --runInBand --coverage=false
|
|
167
|
+
\`\`\`
|
|
168
|
+
|
|
169
|
+
## Formatting And Fixes
|
|
170
|
+
|
|
171
|
+
Apply configured format, ESLint, and Stylelint fixes:
|
|
172
|
+
|
|
173
|
+
\`\`\`bash
|
|
174
|
+
yarn fix
|
|
175
|
+
\`\`\`
|
|
176
|
+
|
|
177
|
+
## Project Guidance
|
|
178
|
+
|
|
179
|
+
These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
|
|
180
|
+
|
|
181
|
+
- [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.
|
|
182
|
+
- [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.
|
|
183
|
+
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
|
|
184
|
+
`,
|
|
79
185
|
'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
80
186
|
import ReadMe from './README.md?raw';
|
|
81
187
|
|
|
82
|
-
<Meta title="
|
|
188
|
+
<Meta title="SPA" />
|
|
83
189
|
|
|
84
190
|
<Markdown>{ReadMe}</Markdown>
|
|
85
191
|
`,
|
|
@@ -180,6 +286,67 @@ export default {
|
|
|
180
286
|
'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
|
|
181
287
|
'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
|
|
182
288
|
'assets.d.ts': "declare module '*.scss';\n",
|
|
289
|
+
'packages/components/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
290
|
+
import ReadMe from './README.md?raw';
|
|
291
|
+
|
|
292
|
+
<Meta title="Packages/Components" />
|
|
293
|
+
|
|
294
|
+
<Markdown>{ReadMe}</Markdown>
|
|
295
|
+
`,
|
|
296
|
+
'packages/components/README.md': `# Components
|
|
297
|
+
|
|
298
|
+
Shared React components for the SPA workspace.
|
|
299
|
+
|
|
300
|
+
## Exports
|
|
301
|
+
|
|
302
|
+
### \`Page\`
|
|
303
|
+
|
|
304
|
+
SSR-friendly page wrapper that renders string content inside the page content container.
|
|
305
|
+
|
|
306
|
+
\`\`\`tsx
|
|
307
|
+
import { Page } from '@p/components';
|
|
308
|
+
|
|
309
|
+
export const Example = () => <Page content="Page body" />;
|
|
310
|
+
\`\`\`
|
|
311
|
+
|
|
312
|
+
Rendered markup:
|
|
313
|
+
|
|
314
|
+
\`\`\`html
|
|
315
|
+
<div class="content">Page body</div>
|
|
316
|
+
\`\`\`
|
|
317
|
+
|
|
318
|
+
### \`PageProps\`
|
|
319
|
+
|
|
320
|
+
Props accepted by \`Page\`.
|
|
321
|
+
|
|
322
|
+
\`\`\`ts
|
|
323
|
+
type PageProps = {
|
|
324
|
+
content: string;
|
|
325
|
+
};
|
|
326
|
+
\`\`\`
|
|
327
|
+
|
|
328
|
+
### \`PageType\`
|
|
329
|
+
|
|
330
|
+
React component type for \`Page\`.
|
|
331
|
+
|
|
332
|
+
\`\`\`ts
|
|
333
|
+
type PageType = FC<PageProps>;
|
|
334
|
+
\`\`\`
|
|
335
|
+
|
|
336
|
+
## Validation
|
|
337
|
+
|
|
338
|
+
Run the package tests from the repository root:
|
|
339
|
+
|
|
340
|
+
\`\`\`bash
|
|
341
|
+
yarn jest packages/components --runInBand --coverage=false
|
|
342
|
+
\`\`\`
|
|
343
|
+
|
|
344
|
+
Run the full project check when changing public behavior:
|
|
345
|
+
|
|
346
|
+
\`\`\`bash
|
|
347
|
+
yarn check
|
|
348
|
+
\`\`\`
|
|
349
|
+
`,
|
|
183
350
|
'packages/components/package.json': JSON.stringify({
|
|
184
351
|
name: '@p/components',
|
|
185
352
|
private: true,
|
|
@@ -273,7 +440,66 @@ import ReadMe from './README.md?raw';
|
|
|
273
440
|
|
|
274
441
|
<Markdown>{ReadMe}</Markdown>
|
|
275
442
|
`,
|
|
276
|
-
'workspaces/spa/README.md': `#
|
|
443
|
+
'workspaces/spa/README.md': `# SPA
|
|
444
|
+
|
|
445
|
+
Client-side React application workspace for the project.
|
|
446
|
+
|
|
447
|
+
## Entry Point
|
|
448
|
+
|
|
449
|
+
The application starts from \`index.tsx\`. It mounts into the \`#root\` element created by the workspace Webpack HTML plugin and renders the shared \`Page\` component from \`@p/components\`.
|
|
450
|
+
|
|
451
|
+
\`\`\`tsx
|
|
452
|
+
import { Page } from '@p/components';
|
|
453
|
+
|
|
454
|
+
import '@p/components/page/styles.scss';
|
|
455
|
+
|
|
456
|
+
element({
|
|
457
|
+
root: document.getElementById('root'),
|
|
458
|
+
component: <Page content="Test content" />,
|
|
459
|
+
});
|
|
460
|
+
\`\`\`
|
|
461
|
+
|
|
462
|
+
## Build Output
|
|
463
|
+
|
|
464
|
+
The Webpack configuration builds the SPA into:
|
|
465
|
+
|
|
466
|
+
\`\`\`text
|
|
467
|
+
dist/spa/index.js
|
|
468
|
+
\`\`\`
|
|
469
|
+
|
|
470
|
+
The generated HTML document uses:
|
|
471
|
+
|
|
472
|
+
\`\`\`html
|
|
473
|
+
<title>SPA</title>
|
|
474
|
+
<div id="root"></div>
|
|
475
|
+
\`\`\`
|
|
476
|
+
|
|
477
|
+
## Development
|
|
478
|
+
|
|
479
|
+
Start the local development server from the repository root:
|
|
480
|
+
|
|
481
|
+
\`\`\`bash
|
|
482
|
+
yarn start:spa
|
|
483
|
+
\`\`\`
|
|
484
|
+
|
|
485
|
+
Build the production bundle:
|
|
486
|
+
|
|
487
|
+
\`\`\`bash
|
|
488
|
+
yarn build:spa
|
|
489
|
+
\`\`\`
|
|
490
|
+
|
|
491
|
+
Run the focused workspace test:
|
|
492
|
+
|
|
493
|
+
\`\`\`bash
|
|
494
|
+
yarn jest workspaces/spa --runInBand --coverage=false
|
|
495
|
+
\`\`\`
|
|
496
|
+
|
|
497
|
+
Run the full project check when changing shared behavior or build configuration:
|
|
498
|
+
|
|
499
|
+
\`\`\`bash
|
|
500
|
+
yarn check
|
|
501
|
+
\`\`\`
|
|
502
|
+
`,
|
|
277
503
|
'workspaces/spa/webpack.config.ts': `import { csr, html } from '@vyriy/webpack-config';
|
|
278
504
|
import { path } from '@vyriy/path';
|
|
279
505
|
|
|
@@ -302,13 +528,16 @@ export default csr(
|
|
|
302
528
|
type: 'module',
|
|
303
529
|
private: true,
|
|
304
530
|
}, null, 2) + '\n',
|
|
305
|
-
'workspaces/spa/index.tsx': `import {
|
|
531
|
+
'workspaces/spa/index.tsx': `import { element } from '@vyriy/render/element';
|
|
306
532
|
|
|
307
533
|
import { Page } from '@p/components';
|
|
308
534
|
|
|
309
535
|
import '@p/components/page/styles.scss';
|
|
310
536
|
|
|
311
|
-
|
|
537
|
+
element({
|
|
538
|
+
root: document.getElementById('root'),
|
|
539
|
+
component: <Page content="Test content" />,
|
|
540
|
+
});
|
|
312
541
|
`,
|
|
313
542
|
'workspaces/spa/index.test.tsx': `import type { ReactElement, ReactNode } from 'react';
|
|
314
543
|
import { describe, expect, it, jest } from '@jest/globals';
|