@vyriy/create 0.8.1 → 0.8.3

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @vyriy/create
2
2
 
3
+ Part of [Vyriy](https://vyriy.dev) - a calm architecture toolkit for TypeScript, React, SSR, SSG, APIs, and cloud-ready apps.
4
+
5
+ Full documentation: https://vyriy.dev/docs/create/
6
+
3
7
  Vyriy project creation CLI and programmatic scaffold API.
4
8
 
5
9
  ## CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vyriy/create",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Vyriy project creation CLI.",
5
5
  "homepage": "https://vyriy.dev/docs/create/",
6
6
  "type": "module",
@@ -13,11 +13,12 @@
13
13
  "vyriy-create": "./bin/index.js"
14
14
  },
15
15
  "dependencies": {
16
- "@vyriy/check": "0.8.1"
16
+ "@vyriy/check": "0.8.3",
17
+ "@vyriy/tooling": "0.8.3"
17
18
  },
18
19
  "peerDependencies": {
19
- "@storybook/addon-docs": "^10.4.4",
20
- "@storybook/react-webpack5": "^10.4.4",
20
+ "@storybook/addon-docs": "^10.4.5",
21
+ "@storybook/react-webpack5": "^10.4.5",
21
22
  "@testing-library/dom": "^10.4.1",
22
23
  "@testing-library/react": "^16.3.2",
23
24
  "@types/jest": "^30.0.0",
@@ -34,7 +35,7 @@
34
35
  "react-dom": "^19.2.7",
35
36
  "rimraf": "^6.1.3",
36
37
  "sass": "^1.101.0",
37
- "storybook": "^10.4.4",
38
+ "storybook": "^10.4.5",
38
39
  "stylelint": "^17.13.0",
39
40
  "tsx": "^4.22.4",
40
41
  "typescript": "^6.0.3",
@@ -310,6 +311,16 @@
310
311
  "import": "./preset/ssr.js",
311
312
  "default": "./preset/ssr.js"
312
313
  },
314
+ "./preset/tooling": {
315
+ "types": "./preset/tooling.d.ts",
316
+ "import": "./preset/tooling.js",
317
+ "default": "./preset/tooling.js"
318
+ },
319
+ "./preset/tooling.js": {
320
+ "types": "./preset/tooling.d.ts",
321
+ "import": "./preset/tooling.js",
322
+ "default": "./preset/tooling.js"
323
+ },
313
324
  "./prompt/conflict-strategy": {
314
325
  "types": "./prompt/conflict-strategy.d.ts",
315
326
  "import": "./prompt/conflict-strategy.js",
package/preset/api.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { baseToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -213,35 +214,9 @@ cdk.context.json
213
214
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
214
215
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
215
216
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
216
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
217
- import { path } from '@vyriy/path';
218
-
219
- export default {
220
- ...config,
221
- stories: [
222
- path('**/*.mdx'),
223
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
224
- ],
225
- };
226
- `,
227
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
228
217
  'yarn.lock': '',
229
- 'tsconfig.json': JSON.stringify({
230
- extends: '@vyriy/typescript-config/index.json',
231
- include: [
232
- '.storybook/**/*.ts',
233
- '.storybook/**/*.tsx',
234
- 'packages/**/*.ts',
235
- 'packages/**/*.tsx',
236
- 'workspaces/**/*.ts',
237
- 'workspaces/**/*.tsx',
238
- '*.ts',
239
- ],
240
- }, null, 2) + '\n',
241
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
218
+ ...baseToolingFiles,
242
219
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
243
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
244
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
245
220
  'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
246
221
 
247
222
  set -e
package/preset/base.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { baseToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -238,33 +239,7 @@ cdk.context.json
238
239
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
239
240
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
240
241
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
241
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
242
- import { path } from '@vyriy/path';
243
-
244
- export default {
245
- ...config,
246
- stories: [
247
- path('**/*.mdx'),
248
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
249
- ],
250
- };
251
- `,
252
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
253
242
  'yarn.lock': '',
254
- 'tsconfig.json': JSON.stringify({
255
- extends: '@vyriy/typescript-config/index.json',
256
- include: [
257
- '.storybook/**/*.ts',
258
- '.storybook/**/*.tsx',
259
- 'packages/**/*.ts',
260
- 'packages/**/*.tsx',
261
- 'workspaces/**/*.ts',
262
- 'workspaces/**/*.tsx',
263
- '*.ts',
264
- ],
265
- }, null, 2) + '\n',
266
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
243
+ ...baseToolingFiles,
267
244
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
268
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
269
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
270
245
  });
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { styleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -10,7 +11,6 @@ const agentsPath = [
10
11
  const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
11
12
  const projectFiles = {
12
13
  '.browserslistrc': '[development]\nextends @vyriy/browserslist-config\n\n[ssr]\nextends @vyriy/browserslist-config\n\n[production]\nextends @vyriy/browserslist-config\n\n[modern]\nextends @vyriy/browserslist-config\n',
13
- '.storybook/preview.tsx': "import '../packages/components/styles.scss';\n\nexport { default } from '@vyriy/storybook-config/preview';\n",
14
14
  'packages/env/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Env\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
15
15
  'packages/env/index.ts': "export * from './env.js';\n",
16
16
  'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
@@ -58,7 +58,6 @@ Override these variables before running a workspace script when a different orig
58
58
  - The public entry point re-exports from \`env.ts\`.
59
59
  - The getters are thin wrappers around \`@vyriy/env\` and keep environment access explicit at call sites.
60
60
  `,
61
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
62
61
  'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/api/package.json\nnpm pkg delete "type" --prefix dist/api\nnpm pkg delete "private" --prefix dist/api\n',
63
62
  'workspaces/api/bin/start.sh': `#!/usr/bin/env sh
64
63
 
@@ -349,35 +348,9 @@ cdk.context.json
349
348
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
350
349
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
351
350
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
352
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
353
- import { path } from '@vyriy/path';
354
-
355
- export default {
356
- ...config,
357
- stories: [
358
- path('**/*.mdx'),
359
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
360
- ],
361
- };
362
- `,
363
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
364
351
  'yarn.lock': '',
365
- 'tsconfig.json': JSON.stringify({
366
- extends: '@vyriy/typescript-config/index.json',
367
- include: [
368
- '.storybook/**/*.ts',
369
- '.storybook/**/*.tsx',
370
- 'packages/**/*.ts',
371
- 'packages/**/*.tsx',
372
- 'workspaces/**/*.ts',
373
- 'workspaces/**/*.tsx',
374
- '*.ts',
375
- ],
376
- }, null, 2) + '\n',
377
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
352
+ ...styleToolingFiles,
378
353
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
379
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
380
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
381
354
  'packages/components/avatar/avatar.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { Avatar } from './avatar.js';\nimport avatar from '../../../workspaces/static/public/avatar.svg';\n\nconst meta = {\n title: 'Components/Avatar',\n component: Avatar,\n parameters: { docs: { page: null } },\n args: { name: 'Ada Lovelace', size: 'md' },\n} satisfies Meta<typeof Avatar>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Image: Story = {\n args: {\n src: avatar,\n alt: 'Profile portrait',\n },\n};\n\nexport const Large: Story = { args: { size: 'lg' } };\n",
382
355
  'packages/components/avatar/avatar.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { Avatar } from './avatar.js';\n\ndescribe('Avatar', () => {\n it('renders an image when src exists', () => {\n render(<Avatar src=\"/avatar.png\" name=\"Ada Lovelace\" />);\n\n expect(screen.getByRole('img', { name: 'Ada Lovelace' })).toBeDefined();\n });\n\n it('uses a generic image alt when name and alt are not provided', () => {\n render(<Avatar src=\"/avatar.png\" />);\n\n expect(screen.getByRole('img', { name: 'Profile avatar' })).toBeDefined();\n });\n\n it('renders initials fallback without exposing decorative text', () => {\n render(<Avatar name=\"Ada Lovelace\" data-testid=\"avatar-root\" />);\n\n expect(screen.getByText('AL')).toBeDefined();\n expect(screen.getByText('AL').getAttribute('aria-hidden')).toBe('true');\n expect(screen.getByTestId('avatar-root')).toBeDefined();\n });\n\n it('renders a stable fallback when name is not provided', () => {\n render(<Avatar />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n\n it('renders a stable fallback when name has no initials', () => {\n render(<Avatar name=\" \" />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n});\n",
383
356
  'packages/components/avatar/avatar.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { AvatarType } from './types.js';\n\nconst getInitials = (name?: string) => {\n if (!name) {\n return '?';\n }\n\n const initials = name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => part[0]?.toUpperCase())\n .join('');\n\n return initials || '?';\n};\n\n/** Renders either a profile image or deterministic initials fallback. */\nexport const Avatar: AvatarType = ({ src, alt, name, size = 'md', className, ...props }) => {\n return (\n <div className={cn('avatar', `avatar--${size}`, className)} {...props}>\n {src ? (\n <img className=\"avatar__image\" alt={alt ?? name ?? 'Profile avatar'} src={src} />\n ) : (\n <span className=\"avatar__initials\" aria-hidden=\"true\">\n {getInitials(name)}\n </span>\n )}\n </div>\n );\n};\n",
package/preset/gql.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { baseToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -173,35 +174,9 @@ cdk.context.json
173
174
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
174
175
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
175
176
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
176
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
177
- import { path } from '@vyriy/path';
178
-
179
- export default {
180
- ...config,
181
- stories: [
182
- path('**/*.mdx'),
183
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
184
- ],
185
- };
186
- `,
187
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
188
177
  'yarn.lock': '',
189
- 'tsconfig.json': JSON.stringify({
190
- extends: '@vyriy/typescript-config/index.json',
191
- include: [
192
- '.storybook/**/*.ts',
193
- '.storybook/**/*.tsx',
194
- 'packages/**/*.ts',
195
- 'packages/**/*.tsx',
196
- 'workspaces/**/*.ts',
197
- 'workspaces/**/*.tsx',
198
- '*.ts',
199
- ],
200
- }, null, 2) + '\n',
201
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
178
+ ...baseToolingFiles,
202
179
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
203
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
204
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
205
180
  'package.json': JSON.stringify({
206
181
  name: options.name,
207
182
  version: '0.0.0',
package/preset/library.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { styleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -153,35 +154,9 @@ cdk.context.json
153
154
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
154
155
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
155
156
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
156
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
157
- import { path } from '@vyriy/path';
158
-
159
- export default {
160
- ...config,
161
- stories: [
162
- path('**/*.mdx'),
163
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
164
- ],
165
- };
166
- `,
167
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
168
157
  'yarn.lock': '',
169
- 'tsconfig.json': JSON.stringify({
170
- extends: '@vyriy/typescript-config/index.json',
171
- include: [
172
- '.storybook/**/*.ts',
173
- '.storybook/**/*.tsx',
174
- 'packages/**/*.ts',
175
- 'packages/**/*.tsx',
176
- 'workspaces/**/*.ts',
177
- 'workspaces/**/*.tsx',
178
- '*.ts',
179
- ],
180
- }, null, 2) + '\n',
181
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
158
+ ...styleToolingFiles,
182
159
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
183
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
184
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
185
160
  'package.json': JSON.stringify({
186
161
  name: options.name,
187
162
  version: '0.0.0',
@@ -266,7 +241,6 @@ export default {
266
241
  allowImportingTsExtensions: false,
267
242
  },
268
243
  }, null, 2) + '\n',
269
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
270
244
  'packages/components/button/button.scss': `.button {
271
245
  border: 1px solid transparent;
272
246
  border-radius: 6px;
package/preset/mfe.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { reactStyleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -21,13 +22,10 @@ const projectFiles = {
21
22
  '.npmrc': 'engine-strict=true\n',
22
23
  '.nvmrc': 'lts/krypton\n',
23
24
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
24
- '.storybook/main.ts': "import config from '@vyriy/storybook-config';\nimport { path } from '@vyriy/path';\n\nexport default {\n ...config,\n stories: [\n path('**/*.mdx'),\n path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),\n ],\n};\n",
25
- '.storybook/preview.tsx': "import '../packages/components/styles.scss';\n\nexport { default } from '@vyriy/storybook-config/preview';\n",
26
25
  '.yarnrc.yml': 'nodeLinker: node-modules\n\nnpmMinimalAgeGate: 0\n',
26
+ ...reactStyleToolingFiles,
27
27
  'README.md': '# MFE\n\nProfile-card microfrontend starter for Vyriy and OpenMFE-oriented development.\n\nThe repository is split into reusable packages and runnable workspaces. Packages own typed component, API, event, query, and environment behavior.\nWorkspaces compose those packages into the local API server and browser custom element build.\n\n## Setup\n\n```bash\nyarn install\n```\n\n## Project Structure\n\n- `packages/api` builds demo HTML, prerendered custom element markup, JSON-LD, and the OpenMFE manifest.\n- `packages/components` provides the React profile-card component set.\n- `packages/env` reads required runtime environment values.\n- `packages/event` dispatches typed profile-card selection and analytics events.\n- `packages/query` parses API query strings into profile-card props.\n- `workspaces/api` serves the demo, prerender, semantic, and manifest endpoints.\n- `workspaces/ui` registers the `vyriy-profile-card` custom element and builds browser assets, including public images.\n\n## Start\n\nStart the API and UI dev server together:\n\n```bash\nyarn start\n```\n\nStart individual workspaces:\n\n```bash\nyarn start:api\nyarn start:ui\n```\n\n## Local URLs\n\nDefault ports and origins are defined in `workspaces/env.sh`:\n\n- API: `http://localhost:3000`\n- UI dev server: `http://localhost:3002`\n\nDefault runtime values:\n\n- `TAG=vyriy-profile-card`\n- `MODE=open`\n\nUseful API URLs:\n\n- Demo HTML: `http://localhost:3000/`\n- Prerendered custom element: `http://localhost:3000/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3002/avatar.svg`\n- Semantic JSON-LD: `http://localhost:3000/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3002/avatar.svg`\n- Manifest: `http://localhost:3000/manifest.yml`\n\n`/prerender` and `/semantic` require `name` and accept optional `title`, `description`, `avatarUrl`, and comma-separated `tags`.\n\n## Build\n\n```bash\nyarn build\n```\n\nThe build writes server output to `dist` and browser UI output to `dist/ui`.\n\n## Run Built Dist\n\n```bash\nyarn build\nsh start_dist.sh\n```\n\n`start_dist.sh` runs the generated `dist` output as a production-like local\nserver on `http://localhost:3000`. It expects `dist/index.js` and `dist/ui/*`\nto already exist, so run it after `yarn build`. The default runtime URLs are\nsame-origin: API routes are served from `http://localhost:3000`, and UI assets\nare served from `http://localhost:3000/ui`.\n\n## Validation\n\n```bash\nyarn check\n```\n\nFocused validation commands:\n\n```bash\nyarn lint\nyarn test\nyarn build\n```\n\n## Project Guidance\n\nThese articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:\n\n- [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.\n- [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.\n- [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.\n- [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/) - how to organize component code, tests, stories, and public exports.\n- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.\n',
28
28
  'doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"MFE\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
29
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
30
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
31
29
  'packages/api/README.md': "# API\n\nServer-side document builders for the profile-card microfrontend.\n\n## Exports\n\n- `demo()` returns a standalone HTML demo document.\n- `prerender(props)` returns SSR custom element markup with declarative shadow DOM.\n- `semantic(props)` returns Schema.org Person JSON-LD.\n- `manifest()` returns the OpenMFE manifest YAML.\n- `Demo`, `Prerender`, `Semantic`, and `Manifest` describe the public builder signatures.\n\n## Props\n\nThe renderers accept the shared profile-card data model from `@p/components`:\n\n- `name` is required.\n- `title`, `description`, `avatarUrl`, and `tags` are optional.\n\n`prerender(props)` serializes those values onto the configured custom element tag and includes the UI stylesheet inside the declarative shadow root.\n\n## Environment\n\nThe builders read required runtime configuration through `@p/env`:\n\n- `TAG` custom element tag name.\n- `MODE` shadow root mode.\n- `API` API origin used in the manifest.\n- `UI` UI asset origin used by demo, prerender output, and manifest assets.\n\n## Example\n\n```ts\nimport { prerender, semantic } from '@p/api';\n\nconst props = {\n name: 'Ada Lovelace',\n title: 'Mathematician',\n tags: ['math', 'computing'],\n};\n\nconst html = prerender(props);\nconst jsonLd = semantic(props);\n```\n",
32
30
  'packages/api/demo.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { demo } from './demo.js';\n\ndescribe('demo', () => {\n afterEach(() => {\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('builds the profile-card demo document', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n const document = demo();\n\n expect(document).toContain('<!DOCTYPE html>');\n expect(document).toContain('<vyriy-profile-card');\n expect(document).toContain('name=\"Developer\"');\n expect(document).toContain('rendered');\n expect(document).toContain('http://localhost:3002/avatar.svg');\n expect(document).toContain('http://localhost:3002/index.js');\n expect(document).toContain('vyriy-profile-card.select');\n });\n});\n",
33
31
  'packages/api/demo.ts': "import { html } from '@vyriy/html';\n\nimport { getUi } from '@p/env';\n\nimport { prerender } from './prerender.js';\nimport type { Demo } from './types.js';\n\n/** Builds the standalone HTML demo page for the profile-card microfrontend. */\nexport const demo: Demo = () =>\n html({\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Demo</title>',\n meta: '<meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />',\n body: prerender({\n name: 'Developer',\n title: 'Senior IT Professional',\n avatarUrl: `${getUi()}/avatar.svg`,\n }),\n script: [\n `<script defer=\"defer\" src=\"${getUi()}/index.js\"></script>`,\n `<script type=\"module\">\n const card = document.querySelector('vyriy-profile-card');\n card.addEventListener('vyriy-profile-card.select', (event) => {\n console.log('UI demo event:', event.detail);\n });\n </script>`,\n ].join(''),\n });\n",
@@ -175,10 +173,7 @@ const projectFiles = {
175
173
  'packages/query/profile-card.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { parseProfileCardQuery } from './profile-card.js';\n\ndescribe('parseProfileCardQuery', () => {\n it('returns undefined when name is missing', () => {\n expect(parseProfileCardQuery(undefined)).toBeUndefined();\n expect(parseProfileCardQuery({})).toBeUndefined();\n expect(parseProfileCardQuery({ name: '' })).toBeUndefined();\n });\n\n it('parses supported profile card fields', () => {\n expect(\n parseProfileCardQuery({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two,, three ',\n title: 'Title',\n }),\n ).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: ['one', 'two', 'three'],\n title: 'Title',\n });\n });\n\n it('omits tags when the query list is empty after trimming', () => {\n expect(\n parseProfileCardQuery({\n name: 'Name',\n tags: ', , ',\n }),\n ).toEqual({\n name: 'Name',\n tags: undefined,\n });\n });\n});\n",
176
174
  'packages/query/profile-card.ts': "import type { ParseProfileCardQuery, Query } from './types.js';\n\nconst getQueryValue = (query: Query, name: string): string | undefined => {\n const value = query?.[name];\n\n return value === '' ? undefined : value;\n};\n\nconst getQueryList = (query: Query, name: string): string[] | undefined => {\n const value = getQueryValue(query, name);\n\n if (!value) {\n return undefined;\n }\n\n const list = value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return list.length > 0 ? list : undefined;\n};\n\n/** Parses request query parameters into profile-card props. */\nexport const parseProfileCardQuery: ParseProfileCardQuery = (query) => {\n const name = getQueryValue(query, 'name');\n\n if (!name) {\n return undefined;\n }\n\n return {\n name,\n title: getQueryValue(query, 'title'),\n description: getQueryValue(query, 'description'),\n avatarUrl: getQueryValue(query, 'avatarUrl'),\n tags: getQueryList(query, 'tags'),\n };\n};\n",
177
175
  'packages/query/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Query string values provided by the API router. */\nexport type Query = Record<string, string | undefined> | undefined;\n\n/** Converts query string values into profile-card props or rejects incomplete input. */\nexport type ParseProfileCardQuery = (query: Query) => ProfileCard | undefined;\n",
178
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
179
176
  'start_dist.sh': '#!/usr/bin/env sh\n\nset -e\n\n: "${API:=http://localhost:3000}"\n: "${MODE:=open}"\n: "${TAG:=vyriy-profile-card}"\n: "${UI:=http://localhost:3000/ui}"\n: "${PORT:=3000}"\n\ncd "$PWD/dist"\n\nNODE_ENV=production \\\nTAG="$TAG" \\\nMODE="$MODE" \\\nAPI="$API" \\\nUI="$UI" \\\nLOG_LEVEL=info \\\nPORT="$PORT" \\\nexec node .\n',
180
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
181
- 'tsconfig.json': '{\n "extends": "@vyriy/typescript-config/index.json",\n "include": [\n ".storybook/**/*.ts",\n ".storybook/**/*.tsx",\n "packages/**/*.ts",\n "packages/**/*.tsx",\n "workspaces/**/*.ts",\n "workspaces/**/*.tsx",\n "*.ts"\n ]\n}\n',
182
177
  'workspaces/api/Dockerfile': 'FROM node:krypton-alpine\n\nWORKDIR /app\n\nENV PORT=3000\nENV LOG_LEVEL=info\nENV NODE_ENV=production\nENV TAG=vyriy-profile-card\nENV MODE=open\nENV API=.\nENV UI=/ui\n\nCOPY package.json .\n\nRUN npm install\n\nCOPY --chown=node:node . .\n\nUSER node\n\nEXPOSE 3000\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD wget -q -O /dev/null "http://127.0.0.1:${PORT}/healthcheck" || exit 1\n\nCMD ["node", "index.js"]\n',
183
178
  'workspaces/api/README.md': '# Api\n\nServer workspace for the profile-card microfrontend.\n\n## Routes\n\n- `GET /` returns a standalone HTML demo page.\n- `GET /prerender` returns server-rendered custom element HTML.\n- `GET /semantic` returns Schema.org Person JSON-LD.\n- `GET /manifest.yml` returns the OpenMFE manifest YAML.\n\n`/prerender` and `/semantic` require the `name` query parameter. They also accept `title`, `description`, `avatarUrl`, and comma-separated `tags`.\n\n## Local Development\n\n```bash\nyarn start:api\n```\n\nThe start script loads `workspaces/env.sh`, listens on `API_PORT`, and prints example URLs for the demo, prerender, semantic, and manifest endpoints.\n\nDefault local URL:\n\n```text\nhttp://localhost:3000\n```\n\n## Build\n\n```bash\nyarn build:api\n```\n\nThe build writes the server bundle to `dist/api`.\n\n## Docker Runtime\n\nThe API image listens on the internal `PORT` value, which defaults to `3000`.\nThe image uses same-origin runtime URLs by default: `API=.` and `UI=/ui`.\nBrowser-facing links therefore use whatever host and port served the page.\n\n```bash\ndocker run -p 3003:3000 <image>\n```\n',
184
179
  'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/package.json\nnpm pkg delete "type" --prefix dist\nnpm pkg delete "private" --prefix dist\nnpm install --prefix dist\nrm dist/package-lock.json\n',
package/preset/rest.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { baseToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -253,35 +254,9 @@ cdk.context.json
253
254
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
254
255
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
255
256
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
256
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
257
- import { path } from '@vyriy/path';
258
-
259
- export default {
260
- ...config,
261
- stories: [
262
- path('**/*.mdx'),
263
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
264
- ],
265
- };
266
- `,
267
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
268
257
  'yarn.lock': '',
269
- 'tsconfig.json': JSON.stringify({
270
- extends: '@vyriy/typescript-config/index.json',
271
- include: [
272
- '.storybook/**/*.ts',
273
- '.storybook/**/*.tsx',
274
- 'packages/**/*.ts',
275
- 'packages/**/*.tsx',
276
- 'workspaces/**/*.ts',
277
- 'workspaces/**/*.tsx',
278
- '*.ts',
279
- ],
280
- }, null, 2) + '\n',
281
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
258
+ ...baseToolingFiles,
282
259
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
283
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
284
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
285
260
  'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
286
261
 
287
262
  set -e
package/preset/spa.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { styleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -259,36 +260,9 @@ cdk.context.json
259
260
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
260
261
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
261
262
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
262
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
263
- import { path } from '@vyriy/path';
264
-
265
- export default {
266
- ...config,
267
- stories: [
268
- path('**/*.mdx'),
269
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
270
- ],
271
- };
272
- `,
273
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
274
263
  'yarn.lock': '',
275
- 'tsconfig.json': JSON.stringify({
276
- extends: '@vyriy/typescript-config/index.json',
277
- include: [
278
- '.storybook/**/*.ts',
279
- '.storybook/**/*.tsx',
280
- 'packages/**/*.ts',
281
- 'packages/**/*.tsx',
282
- 'workspaces/**/*.ts',
283
- 'workspaces/**/*.tsx',
284
- '*.ts',
285
- ],
286
- }, null, 2) + '\n',
287
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
264
+ ...styleToolingFiles,
288
265
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
289
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
290
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
291
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
292
266
  'assets.d.ts': "declare module '*.scss';\n",
293
267
  'packages/components/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
294
268
  import ReadMe from './README.md?raw';
package/preset/ssg.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { styleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -249,36 +250,9 @@ cdk.context.json
249
250
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
250
251
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
251
252
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
252
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
253
- import { path } from '@vyriy/path';
254
-
255
- export default {
256
- ...config,
257
- stories: [
258
- path('**/*.mdx'),
259
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
260
- ],
261
- };
262
- `,
263
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
264
253
  'yarn.lock': '',
265
- 'tsconfig.json': JSON.stringify({
266
- extends: '@vyriy/typescript-config/index.json',
267
- include: [
268
- '.storybook/**/*.ts',
269
- '.storybook/**/*.tsx',
270
- 'packages/**/*.ts',
271
- 'packages/**/*.tsx',
272
- 'workspaces/**/*.ts',
273
- 'workspaces/**/*.tsx',
274
- '*.ts',
275
- ],
276
- }, null, 2) + '\n',
277
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
254
+ ...styleToolingFiles,
278
255
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
279
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
280
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
281
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
282
256
  'assets.d.ts': "declare module '*.scss';\n",
283
257
  'packages/components/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
284
258
  import ReadMe from './README.md?raw';
package/preset/ssr.js CHANGED
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import packageJson from '../package.json' with { type: 'json' };
5
+ import { styleToolingFiles } from './tooling.js';
5
6
  const presetDir = dirname(fileURLToPath(import.meta.url));
6
7
  const agentsPath = [
7
8
  resolve(presetDir, '../../../AGENTS.md'),
@@ -243,36 +244,9 @@ cdk.context.json
243
244
  '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
244
245
  '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
245
246
  '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
246
- '.storybook/main.ts': `import config from '@vyriy/storybook-config';
247
- import { path } from '@vyriy/path';
248
-
249
- export default {
250
- ...config,
251
- stories: [
252
- path('**/*.mdx'),
253
- path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
254
- ],
255
- };
256
- `,
257
- '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
258
247
  'yarn.lock': '',
259
- 'tsconfig.json': JSON.stringify({
260
- extends: '@vyriy/typescript-config/index.json',
261
- include: [
262
- '.storybook/**/*.ts',
263
- '.storybook/**/*.tsx',
264
- 'packages/**/*.ts',
265
- 'packages/**/*.tsx',
266
- 'workspaces/**/*.ts',
267
- 'workspaces/**/*.tsx',
268
- '*.ts',
269
- ],
270
- }, null, 2) + '\n',
271
- 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
248
+ ...styleToolingFiles,
272
249
  '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
273
- 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
274
- 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
275
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
276
250
  'assets.d.ts': "declare module '*.scss';\n",
277
251
  'packages/components/package.json': JSON.stringify({
278
252
  name: '@p/components',
@@ -0,0 +1,3 @@
1
+ export declare const baseToolingFiles: import("@vyriy/tooling").ToolingConfigFileMap;
2
+ export declare const styleToolingFiles: import("@vyriy/tooling").ToolingConfigFileMap;
3
+ export declare const reactStyleToolingFiles: import("@vyriy/tooling").ToolingConfigFileMap;
@@ -0,0 +1,32 @@
1
+ import { createToolingConfigFiles } from '@vyriy/tooling';
2
+ const createPresetToolingConfigFiles = (names) => createToolingConfigFiles({
3
+ extension: 'ts',
4
+ names,
5
+ storybookPreviewPath: '.storybook/preview.tsx',
6
+ storybookPreviewSpecifier: 'extensionless',
7
+ storybookStories: 'path',
8
+ });
9
+ export const baseToolingFiles = createPresetToolingConfigFiles();
10
+ export const styleToolingFiles = createPresetToolingConfigFiles([
11
+ 'typescript',
12
+ 'eslint',
13
+ 'prettier',
14
+ 'jest',
15
+ 'storybook',
16
+ 'stylelint',
17
+ ]);
18
+ export const reactStyleToolingFiles = createToolingConfigFiles({
19
+ extension: 'ts',
20
+ names: [
21
+ 'typescript',
22
+ 'eslint',
23
+ 'prettier',
24
+ 'jest',
25
+ 'storybook',
26
+ 'stylelint',
27
+ ],
28
+ storybookPreviewPath: '.storybook/preview.tsx',
29
+ storybookPreviewSpecifier: 'extensionless',
30
+ storybookPreviewStyleImport: '../packages/components/styles.scss',
31
+ storybookStories: 'path',
32
+ });