vyriy 0.4.10 → 0.5.0

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.
@@ -1,115 +1,19 @@
1
1
  import packageJson from '../../../package.json' with { type: 'json' };
2
2
  import { base } from './base.js';
3
+ import { apiWorkspaceBaseFiles, baseToolingDeps, buildPackageJson, serverDeps, webpackDeps, workspaceScripts, } from './shared.js';
3
4
  export const rest = {
4
5
  files: (options) => ({
5
6
  ...base.files(options),
6
- 'package.json': JSON.stringify({
7
- name: options.name,
8
- version: '0.0.0',
9
- description: options.description,
10
- private: true,
11
- type: 'module',
12
- agents: './AGENTS.md',
13
- packageManager: packageJson.packageManager,
14
- engines: {
15
- node: packageJson.engines.node,
16
- },
17
- workspaces: [
18
- 'workspaces/*',
19
- ],
20
- scripts: {
21
- storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
22
- check: 'run-s lint build test',
23
- fix: "run-s 'fix:*'",
24
- start: "run-p 'start:*'",
25
- lint: "run-s 'lint:*'",
26
- build: "run-s 'build:*'",
27
- test: "run-s 'test:*'",
28
- 'fix:prettier': 'prettier . --write',
29
- 'fix:eslint': 'eslint . --fix',
30
- 'start:api': 'sh workspaces/api/bin/start.sh',
31
- 'lint:ts': 'tsc',
32
- 'lint:prettier': 'prettier . --check',
33
- 'lint:eslint': 'eslint .',
34
- 'build:api': 'rimraf dist && sh workspaces/api/bin/build.sh',
35
- 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
36
- 'test:jest': 'jest',
37
- postinstall: 'husky',
38
- },
39
- dependencies: {
40
- '@vyriy/typescript-config': `^${packageJson.version}`,
41
- typescript: packageJson.peerDependencies.typescript,
42
- '@vyriy/prettier-config': `^${packageJson.version}`,
43
- prettier: packageJson.peerDependencies.prettier,
44
- '@vyriy/eslint-config': `^${packageJson.version}`,
45
- eslint: packageJson.peerDependencies.eslint,
46
- '@vyriy/jest-config': `^${packageJson.version}`,
47
- jest: packageJson.peerDependencies.jest,
48
- '@vyriy/storybook-config': `^${packageJson.version}`,
49
- storybook: packageJson.peerDependencies.storybook,
50
- '@vyriy/path': `^${packageJson.version}`,
51
- husky: packageJson.peerDependencies.husky,
52
- 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
53
- 'cross-env': packageJson.peerDependencies['cross-env'],
54
- rimraf: packageJson.peerDependencies.rimraf,
55
- '@vyriy/webpack-config': `^${packageJson.version}`,
56
- '@vyriy/handler': `^${packageJson.version}`,
57
- '@vyriy/server': `^${packageJson.version}`,
58
- tsx: packageJson.peerDependencies.tsx,
59
- 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
60
- '@vyriy/router': `^${packageJson.version}`,
61
- '@vyriy/html': `^${packageJson.version}`,
62
- },
63
- }, null, 2) + '\n',
64
- 'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
65
-
66
- set -e
67
-
68
- scriptdir="$PWD/workspaces/api";
69
-
70
- NODE_ENV=production npx webpack --config $scriptdir/webpack.config.ts
71
-
72
- cp $scriptdir/package.json dist/api/package.json
73
- npm pkg delete "type" --prefix dist/api
74
- npm pkg delete "private" --prefix dist/api
75
- `,
76
- 'workspaces/api/bin/start.sh': `#!/usr/bin/env sh
77
-
78
- set -e
79
-
80
- scriptdir="$PWD/workspaces/api";
81
-
82
- NODE_ENV=production LOG_LEVEL=info tsx $scriptdir/index.ts
83
- `,
84
- 'workspaces/api/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
85
- import ReadMe from './README.md?raw';
86
-
87
- <Meta title="Workspaces/API" />
88
-
89
- <Markdown>{ReadMe}</Markdown>
90
- `,
91
- 'workspaces/api/README.md': `# ${options.name} API\n\n${options.description}\n`,
92
- 'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
93
- import { ssr, external } from '@vyriy/webpack-config';
94
-
95
- export default ssr(
96
- '@w/api',
97
- {
98
- path: path('dist', 'api'),
99
- filename: 'index.js',
100
- library: { type: 'commonjs2' },
101
- },
102
- (config) => ({
103
- ...config,
104
- externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],
105
- }),
106
- );
107
- `,
108
- 'workspaces/api/package.json': JSON.stringify({
109
- name: '@w/api',
110
- type: 'module',
111
- private: true,
112
- }, null, 2) + '\n',
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
+ }),
113
17
  'workspaces/api/index.ts': `import { server } from '@vyriy/server';
114
18
  import { api } from '@vyriy/handler';
115
19
  import { createRouter } from '@vyriy/router';
@@ -0,0 +1,116 @@
1
+ import type { PlanResult } from '../plan/types.js';
2
+ import type { FileMap } from './types.js';
3
+ export declare const baseToolingDeps: () => {
4
+ '@vyriy/typescript-config': string;
5
+ typescript: string;
6
+ '@vyriy/prettier-config': string;
7
+ prettier: string;
8
+ '@vyriy/eslint-config': string;
9
+ eslint: string;
10
+ '@vyriy/jest-config': string;
11
+ jest: string;
12
+ '@vyriy/storybook-config': string;
13
+ storybook: string;
14
+ '@vyriy/path': string;
15
+ husky: string;
16
+ 'npm-run-all2': string;
17
+ 'cross-env': string;
18
+ };
19
+ export declare const webpackDeps: () => {
20
+ rimraf: string;
21
+ '@vyriy/webpack-config': string;
22
+ tsx: string;
23
+ 'webpack-cli': string;
24
+ };
25
+ export declare const reactDeps: () => {
26
+ react: string;
27
+ 'react-dom': string;
28
+ '@types/react': string;
29
+ '@types/react-dom': string;
30
+ };
31
+ export declare const stylelintDeps: () => {
32
+ '@vyriy/stylelint-config': string;
33
+ stylelint: string;
34
+ };
35
+ export declare const serverDeps: () => {
36
+ '@vyriy/handler': string;
37
+ '@vyriy/server': string;
38
+ };
39
+ export declare const buildPackageJson: (options: Pick<PlanResult, "name" | "description">, workspaces: string[], scripts: Record<string, string>, dependencies: Record<string, string>) => string;
40
+ export declare const reactWorkspaceBaseScripts: () => {
41
+ storybook: string;
42
+ check: string;
43
+ fix: string;
44
+ start: string;
45
+ lint: string;
46
+ build: string;
47
+ test: string;
48
+ 'fix:prettier': string;
49
+ 'fix:eslint': string;
50
+ 'fix:stylelint': string;
51
+ 'lint:ts': string;
52
+ 'lint:prettier': string;
53
+ 'lint:eslint': string;
54
+ 'lint:stylelint': string;
55
+ 'build:storybook': string;
56
+ 'test:jest': string;
57
+ postinstall: string;
58
+ };
59
+ export declare const workspaceBaseScripts: () => {
60
+ storybook: string;
61
+ check: string;
62
+ fix: string;
63
+ start: string;
64
+ lint: string;
65
+ build: string;
66
+ test: string;
67
+ 'fix:prettier': string;
68
+ 'fix:eslint': string;
69
+ 'lint:ts': string;
70
+ 'lint:prettier': string;
71
+ 'lint:eslint': string;
72
+ 'build:storybook': string;
73
+ 'test:jest': string;
74
+ postinstall: string;
75
+ };
76
+ export declare const reactWorkspaceScripts: (workspaceName: string) => {
77
+ storybook: string;
78
+ check: string;
79
+ fix: string;
80
+ start: string;
81
+ lint: string;
82
+ build: string;
83
+ test: string;
84
+ 'fix:prettier': string;
85
+ 'fix:eslint': string;
86
+ 'fix:stylelint': string;
87
+ 'lint:ts': string;
88
+ 'lint:prettier': string;
89
+ 'lint:eslint': string;
90
+ 'lint:stylelint': string;
91
+ 'build:storybook': string;
92
+ 'test:jest': string;
93
+ postinstall: string;
94
+ };
95
+ export declare const workspaceScripts: (workspaceName: string) => {
96
+ storybook: string;
97
+ check: string;
98
+ fix: string;
99
+ start: string;
100
+ lint: string;
101
+ build: string;
102
+ test: string;
103
+ 'fix:prettier': string;
104
+ 'fix:eslint': string;
105
+ 'lint:ts': string;
106
+ 'lint:prettier': string;
107
+ 'lint:eslint': string;
108
+ 'build:storybook': string;
109
+ 'test:jest': string;
110
+ postinstall: string;
111
+ };
112
+ export declare const stylelintConfigFile: () => FileMap;
113
+ export declare const assetsDeclarationFile: () => FileMap;
114
+ export declare const reactComponentFiles: () => FileMap;
115
+ export declare const reactServiceFiles: () => FileMap;
116
+ export declare const apiWorkspaceBaseFiles: (name: string, description: string) => FileMap;
@@ -0,0 +1,245 @@
1
+ import packageJson from '../../../package.json' with { type: 'json' };
2
+ export const baseToolingDeps = () => ({
3
+ '@vyriy/typescript-config': `^${packageJson.version}`,
4
+ typescript: packageJson.peerDependencies.typescript,
5
+ '@vyriy/prettier-config': `^${packageJson.version}`,
6
+ prettier: packageJson.peerDependencies.prettier,
7
+ '@vyriy/eslint-config': `^${packageJson.version}`,
8
+ eslint: packageJson.peerDependencies.eslint,
9
+ '@vyriy/jest-config': `^${packageJson.version}`,
10
+ jest: packageJson.peerDependencies.jest,
11
+ '@vyriy/storybook-config': `^${packageJson.version}`,
12
+ storybook: packageJson.peerDependencies.storybook,
13
+ '@vyriy/path': `^${packageJson.version}`,
14
+ husky: packageJson.peerDependencies.husky,
15
+ 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
16
+ 'cross-env': packageJson.peerDependencies['cross-env'],
17
+ });
18
+ export const webpackDeps = () => ({
19
+ rimraf: packageJson.peerDependencies.rimraf,
20
+ '@vyriy/webpack-config': `^${packageJson.version}`,
21
+ tsx: packageJson.peerDependencies.tsx,
22
+ 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
23
+ });
24
+ export const reactDeps = () => ({
25
+ react: packageJson.peerDependencies.react,
26
+ 'react-dom': packageJson.peerDependencies['react-dom'],
27
+ '@types/react': packageJson.peerDependencies['@types/react'],
28
+ '@types/react-dom': packageJson.peerDependencies['@types/react-dom'],
29
+ });
30
+ export const stylelintDeps = () => ({
31
+ '@vyriy/stylelint-config': `^${packageJson.version}`,
32
+ stylelint: packageJson.peerDependencies.stylelint,
33
+ });
34
+ export const serverDeps = () => ({
35
+ '@vyriy/handler': `^${packageJson.version}`,
36
+ '@vyriy/server': `^${packageJson.version}`,
37
+ });
38
+ export const buildPackageJson = (options, workspaces, scripts, dependencies) => JSON.stringify({
39
+ name: options.name,
40
+ version: '0.0.0',
41
+ description: options.description,
42
+ private: true,
43
+ type: 'module',
44
+ agents: './AGENTS.md',
45
+ packageManager: packageJson.packageManager,
46
+ engines: {
47
+ node: packageJson.engines.node,
48
+ },
49
+ workspaces,
50
+ scripts,
51
+ dependencies,
52
+ }, null, 2) + '\n';
53
+ export const reactWorkspaceBaseScripts = () => ({
54
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
55
+ check: 'run-s lint build test',
56
+ fix: "run-s 'fix:*'",
57
+ start: "run-p 'start:*'",
58
+ lint: "run-s 'lint:*'",
59
+ build: "run-s 'build:*'",
60
+ test: "run-s 'test:*'",
61
+ 'fix:prettier': 'prettier . --write',
62
+ 'fix:eslint': 'eslint . --fix',
63
+ 'fix:stylelint': 'stylelint "**/*.{css,scss}" --fix',
64
+ 'lint:ts': 'tsc',
65
+ 'lint:prettier': 'prettier . --check',
66
+ 'lint:eslint': 'eslint .',
67
+ 'lint:stylelint': 'stylelint "**/*.{css,scss}"',
68
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
69
+ 'test:jest': 'jest',
70
+ postinstall: 'husky',
71
+ });
72
+ export const workspaceBaseScripts = () => ({
73
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
74
+ check: 'run-s lint build test',
75
+ fix: "run-s 'fix:*'",
76
+ start: "run-p 'start:*'",
77
+ lint: "run-s 'lint:*'",
78
+ build: "run-s 'build:*'",
79
+ test: "run-s 'test:*'",
80
+ 'fix:prettier': 'prettier . --write',
81
+ 'fix:eslint': 'eslint . --fix',
82
+ 'lint:ts': 'tsc',
83
+ 'lint:prettier': 'prettier . --check',
84
+ 'lint:eslint': 'eslint .',
85
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
86
+ 'test:jest': 'jest',
87
+ postinstall: 'husky',
88
+ });
89
+ export const reactWorkspaceScripts = (workspaceName) => ({
90
+ ...reactWorkspaceBaseScripts(),
91
+ [`start:${workspaceName}`]: `sh workspaces/${workspaceName}/bin/start.sh`,
92
+ [`build:${workspaceName}`]: `rimraf dist && sh workspaces/${workspaceName}/bin/build.sh`,
93
+ });
94
+ export const workspaceScripts = (workspaceName) => ({
95
+ ...workspaceBaseScripts(),
96
+ [`start:${workspaceName}`]: `sh workspaces/${workspaceName}/bin/start.sh`,
97
+ [`build:${workspaceName}`]: `rimraf dist && sh workspaces/${workspaceName}/bin/build.sh`,
98
+ });
99
+ export const stylelintConfigFile = () => ({
100
+ 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
101
+ });
102
+ export const assetsDeclarationFile = () => ({
103
+ 'assets.d.ts': "declare module '*.scss';\n",
104
+ });
105
+ export const reactComponentFiles = () => ({
106
+ 'packages/components/package.json': JSON.stringify({
107
+ name: '@p/components',
108
+ private: true,
109
+ type: 'module',
110
+ }, null, 2) + '\n',
111
+ 'packages/components/index.ts': "export * from './page/index.js';\n",
112
+ 'packages/components/index.test.tsx': `import { describe, expect, it } from '@jest/globals';
113
+
114
+ import { Page } from './index.js';
115
+ import { Page as PageImplementation } from './page/index.js';
116
+
117
+ describe('packages/components/page', () => {
118
+ it('re-exports the page component', () => {
119
+ expect(Page).toBe(PageImplementation);
120
+ });
121
+ });
122
+ `,
123
+ 'packages/components/page/index.ts': `export * from './page.js';
124
+ export type * from './types.js';
125
+ `,
126
+ 'packages/components/page/index.test.ts': `import { describe, expect, it } from '@jest/globals';
127
+
128
+ import { Page } from './index.js';
129
+ import { Page as PageImplementation } from './page.js';
130
+
131
+ describe('packages/components/page', () => {
132
+ it('re-exports the page component', () => {
133
+ expect(Page).toBe(PageImplementation);
134
+ });
135
+ });
136
+ `,
137
+ 'packages/components/page/types.ts': `import { FC } from 'react';
138
+
139
+ export type PageProps = {
140
+ content: string;
141
+ };
142
+
143
+ export type PageType = FC<PageProps>;
144
+ `,
145
+ 'packages/components/page/page.tsx': `import type { PageType } from './types.js';
146
+
147
+ export const Page: PageType = ({ content }) => <div className="content">{content}</div>;
148
+ `,
149
+ 'packages/components/page/styles.scss': `.content {
150
+ display: block;
151
+ }
152
+ `,
153
+ 'packages/components/page/page.test.tsx': `import { renderToStaticMarkup } from 'react-dom/server';
154
+ import { describe, expect, it } from '@jest/globals';
155
+
156
+ import { Page } from './page.js';
157
+
158
+ describe('packages/components/page/page', () => {
159
+ it('renders content inside the page content container', () => {
160
+ expect(renderToStaticMarkup(<Page content="Page body" />)).toBe('<div class="content">Page body</div>');
161
+ });
162
+ });
163
+ `,
164
+ });
165
+ export const reactServiceFiles = () => ({
166
+ 'packages/services/package.json': JSON.stringify({
167
+ name: '@p/services',
168
+ private: true,
169
+ type: 'module',
170
+ }, null, 2) + '\n',
171
+ 'packages/services/cms/index.ts': `export const cms = {
172
+ getContent: async () => {
173
+ // Placeholder for fetching content from a CMS
174
+ return Promise.resolve({
175
+ title: 'Sample Content',
176
+ body: 'This is a sample content fetched from the CMS.',
177
+ });
178
+ },
179
+ };
180
+ `,
181
+ 'packages/services/cms/index.test.ts': `import { describe, expect, it } from '@jest/globals';
182
+
183
+ import { cms } from './index.js';
184
+
185
+ describe('packages/services/cms', () => {
186
+ it('returns content for rendering a page', async () => {
187
+ await expect(cms.getContent()).resolves.toEqual({
188
+ title: 'Sample Content',
189
+ body: 'This is a sample content fetched from the CMS.',
190
+ });
191
+ });
192
+ });
193
+ `,
194
+ });
195
+ export const apiWorkspaceBaseFiles = (name, description) => ({
196
+ 'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
197
+
198
+ set -e
199
+
200
+ scriptdir="$PWD/workspaces/api";
201
+
202
+ NODE_ENV=production npx webpack --config $scriptdir/webpack.config.ts
203
+
204
+ cp $scriptdir/package.json dist/api/package.json
205
+ npm pkg delete "type" --prefix dist/api
206
+ npm pkg delete "private" --prefix dist/api
207
+ `,
208
+ 'workspaces/api/bin/start.sh': `#!/usr/bin/env sh
209
+
210
+ set -e
211
+
212
+ scriptdir="$PWD/workspaces/api";
213
+
214
+ NODE_ENV=production LOG_LEVEL=info tsx $scriptdir/index.ts
215
+ `,
216
+ 'workspaces/api/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
217
+ import ReadMe from './README.md?raw';
218
+
219
+ <Meta title="Workspaces/API" />
220
+
221
+ <Markdown>{ReadMe}</Markdown>
222
+ `,
223
+ 'workspaces/api/README.md': `# ${name} API\n\n${description}\n`,
224
+ 'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
225
+ import { ssr, external } from '@vyriy/webpack-config';
226
+
227
+ export default ssr(
228
+ '@w/api',
229
+ {
230
+ path: path('dist', 'api'),
231
+ filename: 'index.js',
232
+ library: { type: 'commonjs2' },
233
+ },
234
+ (config) => ({
235
+ ...config,
236
+ externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],
237
+ }),
238
+ );
239
+ `,
240
+ 'workspaces/api/package.json': JSON.stringify({
241
+ name: '@w/api',
242
+ type: 'module',
243
+ private: true,
244
+ }, null, 2) + '\n',
245
+ });
@@ -1,76 +1,24 @@
1
1
  import packageJson from '../../../package.json' with { type: 'json' };
2
2
  import { base } from './base.js';
3
+ import { assetsDeclarationFile, baseToolingDeps, buildPackageJson, reactComponentFiles, reactDeps, reactWorkspaceScripts, stylelintConfigFile, stylelintDeps, webpackDeps, } from './shared.js';
3
4
  export const spa = {
4
5
  files: (options) => ({
5
6
  ...base.files(options),
6
- 'package.json': JSON.stringify({
7
- name: options.name,
8
- version: '0.0.0',
9
- description: options.description,
10
- private: true,
11
- type: 'module',
12
- agents: './AGENTS.md',
13
- packageManager: packageJson.packageManager,
14
- engines: {
15
- node: packageJson.engines.node,
16
- },
17
- workspaces: [
18
- 'packages/*',
19
- 'workspaces/*',
20
- ],
21
- scripts: {
22
- storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
23
- check: 'run-s lint build test',
24
- fix: "run-s 'fix:*'",
25
- start: "run-p 'start:*'",
26
- lint: "run-s 'lint:*'",
27
- build: "run-s 'build:*'",
28
- test: "run-s 'test:*'",
29
- 'fix:prettier': 'prettier . --write',
30
- 'fix:eslint': 'eslint . --fix',
31
- 'fix:stylelint': 'stylelint "**/*.{css,scss}" --fix',
32
- 'start:spa': 'sh workspaces/spa/bin/start.sh',
33
- 'lint:ts': 'tsc',
34
- 'lint:prettier': 'prettier . --check',
35
- 'lint:eslint': 'eslint .',
36
- 'lint:stylelint': 'stylelint "**/*.{css,scss}"',
37
- 'build:spa': 'rimraf dist && sh workspaces/spa/bin/build.sh',
38
- 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
39
- 'test:jest': 'jest',
40
- postinstall: 'husky',
41
- },
42
- dependencies: {
43
- '@vyriy/typescript-config': `^${packageJson.version}`,
44
- typescript: packageJson.peerDependencies.typescript,
45
- '@vyriy/prettier-config': `^${packageJson.version}`,
46
- prettier: packageJson.peerDependencies.prettier,
47
- '@vyriy/eslint-config': `^${packageJson.version}`,
48
- eslint: packageJson.peerDependencies.eslint,
49
- '@vyriy/jest-config': `^${packageJson.version}`,
50
- jest: packageJson.peerDependencies.jest,
51
- '@vyriy/storybook-config': `^${packageJson.version}`,
52
- storybook: packageJson.peerDependencies.storybook,
53
- '@vyriy/path': `^${packageJson.version}`,
54
- husky: packageJson.peerDependencies.husky,
55
- 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
56
- 'cross-env': packageJson.peerDependencies['cross-env'],
57
- rimraf: packageJson.peerDependencies.rimraf,
58
- '@vyriy/webpack-config': `^${packageJson.version}`,
59
- tsx: packageJson.peerDependencies.tsx,
60
- 'webpack-cli': packageJson.peerDependencies['webpack-cli'],
61
- react: packageJson.peerDependencies.react,
62
- 'react-dom': packageJson.peerDependencies['react-dom'],
63
- '@types/react': packageJson.peerDependencies['@types/react'],
64
- '@types/react-dom': packageJson.peerDependencies['@types/react-dom'],
65
- '@vyriy/stylelint-config': `^${packageJson.version}`,
66
- '@vyriy/cn': `^${packageJson.version}`,
67
- '@vyriy/html': `^${packageJson.version}`,
68
- stylelint: packageJson.peerDependencies.stylelint,
69
- '@vyriy/browserslist-config': `^${packageJson.version}`,
70
- },
71
- }, null, 2) + '\n',
72
- 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
73
- 'assets.d.ts': "declare module '*.scss';\n",
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
+ }),
74
22
  '.browserslistrc': `[development]
75
23
  extends @vyriy/browserslist-config
76
24
 
@@ -82,64 +30,6 @@ extends @vyriy/browserslist-config
82
30
 
83
31
  [modern]
84
32
  extends @vyriy/browserslist-config
85
- `,
86
- 'packages/components/package.json': JSON.stringify({
87
- name: '@p/components',
88
- private: true,
89
- type: 'module',
90
- }, null, 2) + '\n',
91
- 'packages/components/index.ts': "export * from './page/index.js';\n",
92
- 'packages/components/index.test.tsx': `import { describe, expect, it } from '@jest/globals';
93
-
94
- import { Page } from './index.js';
95
- import { Page as PageImplementation } from './page/index.js';
96
-
97
- describe('packages/components/page', () => {
98
- it('re-exports the page component', () => {
99
- expect(Page).toBe(PageImplementation);
100
- });
101
- });
102
- `,
103
- 'packages/components/page/index.ts': `export * from './page.js';
104
- export type * from './types.js';
105
- `,
106
- 'packages/components/page/index.test.ts': `import { describe, expect, it } from '@jest/globals';
107
-
108
- import { Page } from './index.js';
109
- import { Page as PageImplementation } from './page.js';
110
-
111
- describe('packages/components/page', () => {
112
- it('re-exports the page component', () => {
113
- expect(Page).toBe(PageImplementation);
114
- });
115
- });
116
- `,
117
- 'packages/components/page/types.ts': `import { FC } from 'react';
118
-
119
- export type PageProps = {
120
- content: string;
121
- };
122
-
123
- export type PageType = FC<PageProps>;
124
- `,
125
- 'packages/components/page/page.tsx': `import type { PageType } from './types.js';
126
-
127
- export const Page: PageType = ({ content }) => <div className="content">{content}</div>;
128
- `,
129
- 'packages/components/page/styles.scss': `.content {
130
- display: block;
131
- }
132
- `,
133
- 'packages/components/page/page.test.tsx': `import { renderToStaticMarkup } from 'react-dom/server';
134
- import { describe, expect, it } from '@jest/globals';
135
-
136
- import { Page } from './page.js';
137
-
138
- describe('packages/components/page/page', () => {
139
- it('renders content inside the page content container', () => {
140
- expect(renderToStaticMarkup(<Page content="Page body" />)).toBe('<div class="content">Page body</div>');
141
- });
142
- });
143
33
  `,
144
34
  'workspaces/spa/bin/build.sh': `#!/usr/bin/env sh
145
35