vyriy 0.5.0 → 0.5.2

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.
@@ -124,12 +124,11 @@ const projectFiles = {
124
124
  'packages/components/styles.scss': "@use './avatar/styles' as avatar;\n@use './badge/styles' as badge;\n@use './button-link/styles' as button-link;\n@use './card/styles' as card;\n@use './icon-link/styles' as icon-link;\n@use './profile-card/styles' as profile-card;\n@use './profile-details/styles' as profile-details;\n@use './profile-header/styles' as profile-header;\n@use './profile-links/styles' as profile-links;\n@use './profile-meta/styles' as profile-meta;\n@use './profile-tags/styles' as profile-tags;\n",
125
125
  '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",
126
126
  'packages/env/env.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { getApi, getCdn, getMode, getTag, getUi } from './env.js';\n\ndescribe('env getters', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.CDN;\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('reads required environment values', () => {\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(getApi()).toBe('http://localhost:3000');\n expect(getCdn()).toBe('http://localhost:3001');\n expect(getMode()).toBe('open');\n expect(getTag()).toBe('vyriy-profile-card');\n expect(getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment value is missing', () => {\n expect(() => getUi()).toThrow('Environment variable UI is not defined!');\n });\n});\n",
127
- 'packages/env/env.ts': "import type { GetEnv, GetMode } from './types.js';\n\nconst getEnv = (name: string, value: string | undefined): string => {\n if (value === undefined) {\n throw new Error(`Environment variable ${name} is not defined!`);\n }\n\n return value;\n};\n\n/** Reads the configured custom element tag name. */\nexport const getTag: GetEnv = () => getEnv('TAG', process.env.TAG);\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode: GetMode = () => getEnv('MODE', process.env.MODE) as ReturnType<GetMode>;\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi: GetEnv = () => getEnv('API', process.env.API);\n\n/** Reads the CDN origin used for static assets. */\nexport const getCdn: GetEnv = () => getEnv('CDN', process.env.CDN);\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi: GetEnv = () => getEnv('UI', process.env.UI);\n",
127
+ 'packages/env/env.ts': "import { getEnv } from '@vyriy/env';\n\n/** Reads the configured custom element tag name. */\nexport const getTag = () => getEnv('TAG');\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode = () => getEnv('MODE');\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi = () => getEnv('API');\n\n/** Reads the CDN origin used for static assets. */\nexport const getCdn = () => getEnv('CDN');\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi = () => getEnv('UI');\n",
128
128
  'packages/env/index.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\nconst ENV_NAMES = [\n 'TAG',\n 'MODE',\n 'API',\n 'CDN',\n 'UI',\n] as const;\n\nconst clearEnv = () => {\n for (const name of ENV_NAMES) {\n delete process.env[name];\n }\n};\n\ndescribe('env public API', () => {\n afterEach(() => {\n clearEnv();\n });\n\n it('exports env getters', () => {\n expect(publicApi.getTag).toBeDefined();\n expect(publicApi.getMode).toBeDefined();\n expect(publicApi.getApi).toBeDefined();\n expect(publicApi.getCdn).toBeDefined();\n expect(publicApi.getUi).toBeDefined();\n });\n\n it('reads environment variables by public getter name', () => {\n process.env.TAG = 'vyriy-profile-card';\n process.env.MODE = 'open';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n expect(publicApi.getTag()).toBe('vyriy-profile-card');\n expect(publicApi.getMode()).toBe('open');\n expect(publicApi.getApi()).toBe('http://localhost:3000');\n expect(publicApi.getCdn()).toBe('http://localhost:3001');\n expect(publicApi.getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment variable is missing', () => {\n clearEnv();\n\n expect(() => publicApi.getApi()).toThrow('Environment variable API is not defined!');\n });\n});\n",
129
- 'packages/env/index.ts': "export * from './env.js';\nexport type * from './types.js';\n",
129
+ 'packages/env/index.ts': "export * from './env.js';\n",
130
130
  'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
131
131
  'packages/env/README.md': '# @p/env\n\nRequired environment readers shared by API and UI workspaces.\n\n## Exports\n\n- `getTag()` reads `TAG`.\n- `getMode()` reads `MODE`.\n- `getApi()` reads `API`.\n- `getCdn()` reads `CDN`.\n- `getUi()` reads `UI`.\n\nEach getter throws when its environment variable is missing.\n',
132
- 'packages/env/types.ts': "/** Reads a required string environment variable. */\nexport type GetEnv = () => string | never;\n\n/** Reads the required declarative shadow DOM mode. */\nexport type GetMode = () => 'open' | 'closed' | never;\n",
133
132
  'packages/event/constants.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\n\ndescribe('event constants', () => {\n it('matches the manifest event names', () => {\n expect(PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n });\n});\n",
134
133
  'packages/event/constants.ts': "/** Custom event emitted when the profile card is selected. */\nexport const PROFILE_CARD_SELECT_EVENT_NAME = 'vyriy-profile-card.select';\n\n/** Standard OpenMFE analytics event emitted for profile-card interactions. */\nexport const PROFILE_CARD_ANALYTICS_EVENT_NAME = 'openmfe.analytics';\n",
135
134
  'packages/event/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Event\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
@@ -159,7 +158,7 @@ const projectFiles = {
159
158
  'workspaces/api/README.md': '# app API\n\nCalm cloud-ready application\n',
160
159
  'workspaces/api/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\nimport { path } from '@vyriy/path';\nimport { ssr, external } from '@vyriy/webpack-config';\n\nexport default ssr(\n '@w/api',\n {\n path: path('dist', 'api'),\n filename: 'index.js',\n library: { type: 'commonjs2' },\n },\n (config) => ({\n ...config,\n externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin([\n 'API',\n 'CDN',\n 'MODE',\n 'TAG',\n 'UI',\n ]),\n ],\n }),\n);\n",
161
160
  'workspaces/env.sh': '#!/usr/bin/env sh\n\n: "${API_PORT:=3000}"\n: "${CDN_PORT:=3001}"\n: "${UI_PORT:=3002}"\n: "${API:=http://localhost:$API_PORT}"\n: "${CDN:=http://localhost:$CDN_PORT}"\n: "${UI:=http://localhost:$UI_PORT}"\n: "${TAG:=vyriy-profile-card}"\n: "${MODE:=open}"\n\nexport API_PORT\nexport CDN_PORT\nexport UI_PORT\nexport API\nexport CDN\nexport UI\nexport TAG\nexport MODE\n',
162
- 'workspaces/static/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\ndistdir="$PWD/dist/ui";\n\n. "$PWD/workspaces/env.sh"\n\ncp -R $scriptdir/public/* $distdir/\n',
161
+ 'workspaces/static/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\ndistdir="$PWD/dist/cdn";\n\ncp -R $scriptdir/public/* $distdir/\n',
163
162
  'workspaces/static/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\n\n. "$PWD/workspaces/env.sh"\n\nnpx serve --cors -p $CDN_PORT $scriptdir/public\n',
164
163
  'workspaces/static/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/Static\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
165
164
  'workspaces/static/package.json': '{\n "name": "@w/static",\n "type": "module",\n "private": true\n}\n',
@@ -177,89 +176,88 @@ const projectFiles = {
177
176
  'workspaces/ui/README.md': '# @w/ui\n\nDemo entry point.\n',
178
177
  'workspaces/ui/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\n\nimport { csr, html } from '@vyriy/webpack-config';\nimport { path } from '@vyriy/path';\n\nexport default csr(\n '@w/ui',\n {\n path: path('dist', 'cdn'),\n filename: 'index.js',\n },\n (config) => ({\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin(['API', 'CDN', 'UI']),\n html(\n {\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: '<vyriy-profile-card name=\"Developer\" title=\"Senior IT Professional\" avatarUrl=\"http://localhost:3001/avatar.svg\"></vyriy-profile-card>',\n script: [\n '<script defer=\"defer\" src=\"/index.js\"></script>',\n [\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 '</scr' + 'ipt>',\n ].join(''),\n ].join(''),\n },\n { inject: false },\n ),\n ],\n }),\n);\n",
179
178
  };
180
- export const mfe = {
181
- files: (options) => ({
182
- ...base.files(options),
183
- ...projectFiles,
184
- 'package.json': JSON.stringify({
185
- name: options.name,
186
- version: '0.0.0',
187
- description: options.description,
188
- private: true,
189
- type: 'module',
190
- agents: './AGENTS.md',
191
- packageManager: packageJson.packageManager,
192
- engines: {
193
- node: packageJson.engines.node,
194
- },
195
- workspaces: [
196
- 'packages/*',
197
- 'workspaces/*',
198
- ],
199
- scripts: {
200
- storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
201
- check: 'run-s lint build test',
202
- fix: "run-s 'fix:*'",
203
- start: "run-p 'start:*'",
204
- lint: "run-s 'lint:*'",
205
- build: "run-s 'build:*'",
206
- test: "run-s 'test:*'",
207
- 'fix:prettier': 'prettier . --write',
208
- 'fix:eslint': 'eslint . --fix',
209
- 'fix:stylelint': "stylelint '**/*.{css,scss}' --fix",
210
- 'start:api': 'sh workspaces/api/bin/start.sh',
211
- 'start:static': 'sh workspaces/static/bin/start.sh',
212
- 'start:ui': 'sh workspaces/ui/bin/start.sh',
213
- 'lint:ts': 'tsc',
214
- 'lint:prettier': 'prettier . --check',
215
- 'lint:eslint': 'eslint .',
216
- 'lint:stylelint': "stylelint '**/*.{css,scss}'",
217
- 'build:api': 'sh workspaces/api/bin/build.sh',
218
- 'build:static': 'sh workspaces/api/bin/build.sh',
219
- 'build:ui': 'sh workspaces/ui/bin/build.sh',
220
- 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
221
- 'test:jest': 'jest',
222
- prebuild: 'rimraf dist',
223
- postinstall: 'husky',
224
- },
225
- dependencies: {
226
- '@testing-library/dom': packageJson.peerDependencies['@testing-library/dom'],
227
- '@testing-library/react': packageJson.peerDependencies['@testing-library/react'],
228
- '@types/jest': packageJson.peerDependencies['@types/jest'],
229
- '@vyriy/browserslist-config': `^${packageJson.version}`,
230
- '@vyriy/cn': `^${packageJson.version}`,
231
- '@vyriy/env': `^${packageJson.version}`,
232
- '@vyriy/eslint-config': `^${packageJson.version}`,
233
- '@vyriy/event': `^${packageJson.version}`,
234
- '@vyriy/handler': `^${packageJson.version}`,
235
- '@vyriy/html': `^${packageJson.version}`,
236
- '@vyriy/jest-config': `^${packageJson.version}`,
237
- '@vyriy/path': `^${packageJson.version}`,
238
- '@vyriy/prettier-config': `^${packageJson.version}`,
239
- '@vyriy/render': `^${packageJson.version}`,
240
- '@vyriy/router': `^${packageJson.version}`,
241
- '@vyriy/server': `^${packageJson.version}`,
242
- '@vyriy/storybook-config': `^${packageJson.version}`,
243
- '@vyriy/stylelint-config': `^${packageJson.version}`,
244
- '@vyriy/typescript-config': `^${packageJson.version}`,
245
- '@vyriy/webpack-config': `^${packageJson.version}`,
246
- 'cross-env': packageJson.peerDependencies['cross-env'],
247
- eslint: packageJson.peerDependencies['eslint'],
248
- husky: packageJson.peerDependencies['husky'],
249
- jest: packageJson.peerDependencies['jest'],
250
- 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
251
- prettier: packageJson.peerDependencies['prettier'],
252
- rimraf: packageJson.peerDependencies['rimraf'],
253
- serve: packageJson.peerDependencies['serve'],
254
- storybook: packageJson.peerDependencies['storybook'],
255
- stylelint: packageJson.peerDependencies['stylelint'],
256
- tsx: packageJson.peerDependencies['tsx'],
257
- typescript: packageJson.peerDependencies['typescript'],
258
- webpack: packageJson.peerDependencies['webpack'],
259
- 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
260
- },
261
- }, null, 2) + '\n',
262
- 'README.md': `# ${options.name}
179
+ export const mfe = (options) => ({
180
+ ...base(options),
181
+ ...projectFiles,
182
+ 'package.json': JSON.stringify({
183
+ name: options.name,
184
+ version: '0.0.0',
185
+ description: options.description,
186
+ private: true,
187
+ type: 'module',
188
+ agents: './AGENTS.md',
189
+ packageManager: packageJson.packageManager,
190
+ engines: {
191
+ node: packageJson.engines.node,
192
+ },
193
+ workspaces: [
194
+ 'packages/*',
195
+ 'workspaces/*',
196
+ ],
197
+ scripts: {
198
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
199
+ check: 'run-s lint build test',
200
+ fix: "run-s 'fix:*'",
201
+ start: "run-p 'start:*'",
202
+ lint: "run-s 'lint:*'",
203
+ build: "run-s 'build:*'",
204
+ test: "run-s 'test:*'",
205
+ 'fix:prettier': 'prettier . --write',
206
+ 'fix:eslint': 'eslint . --fix',
207
+ 'fix:stylelint': "stylelint '**/*.{css,scss}' --fix",
208
+ 'start:api': 'sh workspaces/api/bin/start.sh',
209
+ 'start:static': 'sh workspaces/static/bin/start.sh',
210
+ 'start:ui': 'sh workspaces/ui/bin/start.sh',
211
+ 'lint:ts': 'tsc',
212
+ 'lint:prettier': 'prettier . --check',
213
+ 'lint:eslint': 'eslint .',
214
+ 'lint:stylelint': "stylelint '**/*.{css,scss}'",
215
+ 'build:api': 'sh workspaces/api/bin/build.sh',
216
+ 'build:ui': 'sh workspaces/ui/bin/build.sh',
217
+ 'build:static': 'sh workspaces/static/bin/build.sh',
218
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
219
+ 'test:jest': 'jest',
220
+ prebuild: 'rimraf dist',
221
+ postinstall: 'husky',
222
+ },
223
+ dependencies: {
224
+ '@testing-library/dom': packageJson.peerDependencies['@testing-library/dom'],
225
+ '@testing-library/react': packageJson.peerDependencies['@testing-library/react'],
226
+ '@types/jest': packageJson.peerDependencies['@types/jest'],
227
+ '@vyriy/browserslist-config': `^${packageJson.version}`,
228
+ '@vyriy/cn': `^${packageJson.version}`,
229
+ '@vyriy/env': `^${packageJson.version}`,
230
+ '@vyriy/eslint-config': `^${packageJson.version}`,
231
+ '@vyriy/event': `^${packageJson.version}`,
232
+ '@vyriy/handler': `^${packageJson.version}`,
233
+ '@vyriy/html': `^${packageJson.version}`,
234
+ '@vyriy/jest-config': `^${packageJson.version}`,
235
+ '@vyriy/path': `^${packageJson.version}`,
236
+ '@vyriy/prettier-config': `^${packageJson.version}`,
237
+ '@vyriy/render': `^${packageJson.version}`,
238
+ '@vyriy/router': `^${packageJson.version}`,
239
+ '@vyriy/server': `^${packageJson.version}`,
240
+ '@vyriy/storybook-config': `^${packageJson.version}`,
241
+ '@vyriy/stylelint-config': `^${packageJson.version}`,
242
+ '@vyriy/typescript-config': `^${packageJson.version}`,
243
+ '@vyriy/webpack-config': `^${packageJson.version}`,
244
+ 'cross-env': packageJson.peerDependencies['cross-env'],
245
+ eslint: packageJson.peerDependencies['eslint'],
246
+ husky: packageJson.peerDependencies['husky'],
247
+ jest: packageJson.peerDependencies['jest'],
248
+ 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
249
+ prettier: packageJson.peerDependencies['prettier'],
250
+ rimraf: packageJson.peerDependencies['rimraf'],
251
+ serve: packageJson.peerDependencies['serve'],
252
+ storybook: packageJson.peerDependencies['storybook'],
253
+ stylelint: packageJson.peerDependencies['stylelint'],
254
+ tsx: packageJson.peerDependencies['tsx'],
255
+ typescript: packageJson.peerDependencies['typescript'],
256
+ webpack: packageJson.peerDependencies['webpack'],
257
+ 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
258
+ },
259
+ }, null, 2) + '\n',
260
+ 'README.md': `# ${options.name}
263
261
 
264
262
  ${options.description}
265
263
 
@@ -308,26 +306,21 @@ yarn test
308
306
  yarn build
309
307
  \`\`\`
310
308
  `,
311
- 'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
309
+ 'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
312
310
  import ReadMe from './README.md?raw';
313
311
 
314
312
  <Meta title="${options.name}" />
315
313
 
316
314
  <Markdown>{ReadMe}</Markdown>
317
315
  `,
318
- 'packages/components/package.json': JSON.stringify({
319
- name: '@p/components',
320
- type: 'module',
321
- private: true,
322
- }, null, 2) + '\n',
323
- 'packages/event/package.json': JSON.stringify({
324
- name: '@p/event',
325
- type: 'module',
326
- private: true,
327
- }, null, 2) + '\n',
328
- }),
329
- ci: {
330
- ...base.ci,
331
- },
332
- deploy: {},
333
- };
316
+ 'packages/components/package.json': JSON.stringify({
317
+ name: '@p/components',
318
+ type: 'module',
319
+ private: true,
320
+ }, null, 2) + '\n',
321
+ 'packages/event/package.json': JSON.stringify({
322
+ name: '@p/event',
323
+ type: 'module',
324
+ private: true,
325
+ }, null, 2) + '\n',
326
+ });
@@ -1,20 +1,19 @@
1
1
  import packageJson from '../../../package.json' with { type: 'json' };
2
2
  import { base } from './base.js';
3
3
  import { apiWorkspaceBaseFiles, baseToolingDeps, buildPackageJson, serverDeps, webpackDeps, workspaceScripts, } from './shared.js';
4
- export const rest = {
5
- files: (options) => ({
6
- ...base.files(options),
7
- ...apiWorkspaceBaseFiles(options.name, options.description),
8
- 'package.json': buildPackageJson(options, [
9
- 'workspaces/*',
10
- ], workspaceScripts('api'), {
11
- ...baseToolingDeps(),
12
- ...webpackDeps(),
13
- ...serverDeps(),
14
- '@vyriy/router': `^${packageJson.version}`,
15
- '@vyriy/html': `^${packageJson.version}`,
16
- }),
17
- 'workspaces/api/index.ts': `import { server } from '@vyriy/server';
4
+ export const rest = (options) => ({
5
+ ...base(options),
6
+ ...apiWorkspaceBaseFiles(options.name, options.description),
7
+ 'package.json': buildPackageJson(options, [
8
+ 'workspaces/*',
9
+ ], workspaceScripts('api'), {
10
+ ...baseToolingDeps(),
11
+ ...webpackDeps(),
12
+ ...serverDeps(),
13
+ '@vyriy/router': `^${packageJson.version}`,
14
+ '@vyriy/html': `^${packageJson.version}`,
15
+ }),
16
+ 'workspaces/api/index.ts': `import { server } from '@vyriy/server';
18
17
  import { api } from '@vyriy/handler';
19
18
  import { createRouter } from '@vyriy/router';
20
19
  import { html, minify } from '@vyriy/html';
@@ -110,7 +109,7 @@ router.get('/', async () => {
110
109
 
111
110
  server(api(async (event) => router.route(event)));
112
111
  `,
113
- 'workspaces/api/index.test.ts': `import { describe, expect, it, jest } from '@jest/globals';
112
+ 'workspaces/api/index.test.ts': `import { describe, expect, it, jest } from '@jest/globals';
114
113
  import type { APIGatewayProxyEvent } from '@vyriy/router';
115
114
 
116
115
  const apiMock = jest.fn((handler) => ({
@@ -240,9 +239,4 @@ describe('workspaces/api/index.ts', () => {
240
239
  });
241
240
  });
242
241
  `,
243
- }),
244
- ci: {
245
- ...base.ci,
246
- },
247
- deploy: {},
248
- };
242
+ });
@@ -1,25 +1,24 @@
1
1
  import packageJson from '../../../package.json' with { type: 'json' };
2
2
  import { base } from './base.js';
3
3
  import { assetsDeclarationFile, baseToolingDeps, buildPackageJson, reactComponentFiles, reactDeps, reactWorkspaceScripts, stylelintConfigFile, stylelintDeps, webpackDeps, } from './shared.js';
4
- export const spa = {
5
- files: (options) => ({
6
- ...base.files(options),
7
- ...stylelintConfigFile(),
8
- ...assetsDeclarationFile(),
9
- ...reactComponentFiles(),
10
- 'package.json': buildPackageJson(options, [
11
- 'packages/*',
12
- 'workspaces/*',
13
- ], reactWorkspaceScripts('spa'), {
14
- ...baseToolingDeps(),
15
- ...webpackDeps(),
16
- ...reactDeps(),
17
- ...stylelintDeps(),
18
- '@vyriy/cn': `^${packageJson.version}`,
19
- '@vyriy/html': `^${packageJson.version}`,
20
- '@vyriy/browserslist-config': `^${packageJson.version}`,
21
- }),
22
- '.browserslistrc': `[development]
4
+ export const spa = (options) => ({
5
+ ...base(options),
6
+ ...stylelintConfigFile(),
7
+ ...assetsDeclarationFile(),
8
+ ...reactComponentFiles(),
9
+ 'package.json': buildPackageJson(options, [
10
+ 'packages/*',
11
+ 'workspaces/*',
12
+ ], reactWorkspaceScripts('spa'), {
13
+ ...baseToolingDeps(),
14
+ ...webpackDeps(),
15
+ ...reactDeps(),
16
+ ...stylelintDeps(),
17
+ '@vyriy/cn': `^${packageJson.version}`,
18
+ '@vyriy/html': `^${packageJson.version}`,
19
+ '@vyriy/browserslist-config': `^${packageJson.version}`,
20
+ }),
21
+ '.browserslistrc': `[development]
23
22
  extends @vyriy/browserslist-config
24
23
 
25
24
  [ssr]
@@ -31,7 +30,7 @@ extends @vyriy/browserslist-config
31
30
  [modern]
32
31
  extends @vyriy/browserslist-config
33
32
  `,
34
- 'workspaces/spa/bin/build.sh': `#!/usr/bin/env sh
33
+ 'workspaces/spa/bin/build.sh': `#!/usr/bin/env sh
35
34
 
36
35
  set -e
37
36
 
@@ -39,7 +38,7 @@ scriptdir="$PWD/workspaces/spa";
39
38
 
40
39
  NODE_ENV=production npx webpack --config $scriptdir/webpack.config.ts
41
40
  `,
42
- 'workspaces/spa/bin/start.sh': `#!/usr/bin/env sh
41
+ 'workspaces/spa/bin/start.sh': `#!/usr/bin/env sh
43
42
 
44
43
  set -e
45
44
 
@@ -47,15 +46,15 @@ scriptdir="$PWD/workspaces/spa";
47
46
 
48
47
  npx webpack serve --open --config $scriptdir/webpack.config.ts
49
48
  `,
50
- 'workspaces/spa/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
49
+ 'workspaces/spa/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
51
50
  import ReadMe from './README.md?raw';
52
51
 
53
52
  <Meta title="Workspaces/SPA" />
54
53
 
55
54
  <Markdown>{ReadMe}</Markdown>
56
55
  `,
57
- 'workspaces/spa/README.md': `# ${options.name} SPA\n\n${options.description}\n`,
58
- 'workspaces/spa/webpack.config.ts': `import { csr, html } from '@vyriy/webpack-config';
56
+ 'workspaces/spa/README.md': `# ${options.name} SPA\n\n${options.description}\n`,
57
+ 'workspaces/spa/webpack.config.ts': `import { csr, html } from '@vyriy/webpack-config';
59
58
  import { path } from '@vyriy/path';
60
59
 
61
60
  export default csr(
@@ -78,12 +77,12 @@ export default csr(
78
77
  },
79
78
  );
80
79
  `,
81
- 'workspaces/spa/package.json': JSON.stringify({
82
- name: '@w/spa',
83
- type: 'module',
84
- private: true,
85
- }, null, 2) + '\n',
86
- 'workspaces/spa/index.tsx': `import { createRoot } from 'react-dom/client';
80
+ 'workspaces/spa/package.json': JSON.stringify({
81
+ name: '@w/spa',
82
+ type: 'module',
83
+ private: true,
84
+ }, null, 2) + '\n',
85
+ 'workspaces/spa/index.tsx': `import { createRoot } from 'react-dom/client';
87
86
 
88
87
  import { Page } from '@p/components';
89
88
 
@@ -91,7 +90,7 @@ import '@p/components/page/styles.scss';
91
90
 
92
91
  createRoot(document.getElementById('root')!).render(<Page content="Test content" />);
93
92
  `,
94
- 'workspaces/spa/index.test.tsx': `import type { ReactElement, ReactNode } from 'react';
93
+ 'workspaces/spa/index.test.tsx': `import type { ReactElement, ReactNode } from 'react';
95
94
  import { describe, expect, it, jest } from '@jest/globals';
96
95
 
97
96
  const renderMock = jest.fn<(children: ReactNode) => void>();
@@ -130,9 +129,4 @@ describe('workspaces/spa/index.tsx', () => {
130
129
  });
131
130
  });
132
131
  `,
133
- }),
134
- ci: {
135
- ...base.ci,
136
- },
137
- deploy: {},
138
- };
132
+ });
@@ -1,27 +1,26 @@
1
1
  import packageJson from '../../../package.json' with { type: 'json' };
2
2
  import { base } from './base.js';
3
3
  import { assetsDeclarationFile, baseToolingDeps, buildPackageJson, reactComponentFiles, reactDeps, reactServiceFiles, reactWorkspaceScripts, stylelintConfigFile, stylelintDeps, webpackDeps, } from './shared.js';
4
- export const ssg = {
5
- files: (options) => ({
6
- ...base.files(options),
7
- ...stylelintConfigFile(),
8
- ...assetsDeclarationFile(),
9
- ...reactComponentFiles(),
10
- ...reactServiceFiles(),
11
- 'package.json': buildPackageJson(options, [
12
- 'packages/*',
13
- 'workspaces/*',
14
- ], reactWorkspaceScripts('ssg'), {
15
- ...baseToolingDeps(),
16
- ...webpackDeps(),
17
- '@vyriy/script': `^${packageJson.version}`,
18
- ...reactDeps(),
19
- ...stylelintDeps(),
20
- '@vyriy/cn': `^${packageJson.version}`,
21
- '@vyriy/html': `^${packageJson.version}`,
22
- sass: packageJson.peerDependencies.sass,
23
- }),
24
- 'workspaces/ssg/bin/build.sh': `#!/usr/bin/env sh
4
+ export const ssg = (options) => ({
5
+ ...base(options),
6
+ ...stylelintConfigFile(),
7
+ ...assetsDeclarationFile(),
8
+ ...reactComponentFiles(),
9
+ ...reactServiceFiles(),
10
+ 'package.json': buildPackageJson(options, [
11
+ 'packages/*',
12
+ 'workspaces/*',
13
+ ], reactWorkspaceScripts('ssg'), {
14
+ ...baseToolingDeps(),
15
+ ...webpackDeps(),
16
+ '@vyriy/script': `^${packageJson.version}`,
17
+ ...reactDeps(),
18
+ ...stylelintDeps(),
19
+ '@vyriy/cn': `^${packageJson.version}`,
20
+ '@vyriy/html': `^${packageJson.version}`,
21
+ sass: packageJson.peerDependencies.sass,
22
+ }),
23
+ 'workspaces/ssg/bin/build.sh': `#!/usr/bin/env sh
25
24
 
26
25
  set -e
27
26
 
@@ -35,7 +34,7 @@ cp $scriptdir/package.json "$distdir/package.json"
35
34
  npm pkg delete "type" --prefix "$distdir"
36
35
  npm pkg delete "private" --prefix "$distdir"
37
36
  `,
38
- 'workspaces/ssg/bin/start.sh': `#!/usr/bin/env sh
37
+ 'workspaces/ssg/bin/start.sh': `#!/usr/bin/env sh
39
38
 
40
39
  set -e
41
40
 
@@ -47,15 +46,15 @@ yarn exec sass packages/components/page/styles.scss "$distdir/styles.css" --no-s
47
46
 
48
47
  PROJECT_CWD="$distdir" NODE_ENV=production LOG_LEVEL=info "$PWD/node_modules/.bin/tsx" $scriptdir/index.tsx
49
48
  `,
50
- 'workspaces/ssg/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
49
+ 'workspaces/ssg/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
51
50
  import ReadMe from './README.md?raw';
52
51
 
53
52
  <Meta title="Workspaces/SSG" />
54
53
 
55
54
  <Markdown>{ReadMe}</Markdown>
56
55
  `,
57
- 'workspaces/ssg/README.md': `# ${options.name} SSG\n\n${options.description}\n`,
58
- 'workspaces/ssg/webpack.config.ts': `import { path } from '@vyriy/path';
56
+ 'workspaces/ssg/README.md': `# ${options.name} SSG\n\n${options.description}\n`,
57
+ 'workspaces/ssg/webpack.config.ts': `import { path } from '@vyriy/path';
59
58
  import { ssr, external } from '@vyriy/webpack-config';
60
59
 
61
60
  export default ssr(
@@ -71,12 +70,12 @@ export default ssr(
71
70
  }),
72
71
  );
73
72
  `,
74
- 'workspaces/ssg/package.json': JSON.stringify({
75
- name: '@w/ssg',
76
- type: 'module',
77
- private: true,
78
- }, null, 2) + '\n',
79
- 'workspaces/ssg/index.tsx': `import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
73
+ 'workspaces/ssg/package.json': JSON.stringify({
74
+ name: '@w/ssg',
75
+ type: 'module',
76
+ private: true,
77
+ }, null, 2) + '\n',
78
+ 'workspaces/ssg/index.tsx': `import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
80
79
  import { renderToString } from 'react-dom/server';
81
80
 
82
81
  import { script } from '@vyriy/script';
@@ -108,7 +107,7 @@ void script(async () => {
108
107
  );
109
108
  });
110
109
  `,
111
- 'workspaces/ssg/index.test.tsx': `import { describe, expect, it, jest } from '@jest/globals';
110
+ 'workspaces/ssg/index.test.tsx': `import { describe, expect, it, jest } from '@jest/globals';
112
111
 
113
112
  const getContentMock = jest.fn(() =>
114
113
  Promise.resolve({
@@ -169,9 +168,4 @@ describe('workspaces/ssg/index.tsx', () => {
169
168
  });
170
169
  });
171
170
  `,
172
- }),
173
- ci: {
174
- ...base.ci,
175
- },
176
- deploy: {},
177
- };
171
+ });