vyriy 0.5.1 → 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.
- package/commands/create/index.js +1 -6
- package/commands/create/plan/plan.d.ts +1 -3
- package/commands/create/plan/plan.js +8 -7
- package/commands/create/plan/types.d.ts +0 -2
- package/commands/create/preset/api.js +13 -19
- package/commands/create/preset/base.js +78 -114
- package/commands/create/preset/fullstack.d.ts +2 -0
- package/commands/create/preset/fullstack.js +158 -0
- package/commands/create/preset/gql.js +82 -88
- package/commands/create/preset/index.d.ts +5 -0
- package/commands/create/preset/index.js +6 -0
- package/commands/create/preset/library.js +115 -121
- package/commands/create/preset/mfe.js +97 -104
- package/commands/create/preset/rest.js +15 -21
- package/commands/create/preset/spa.js +31 -37
- package/commands/create/preset/ssg.js +32 -38
- package/commands/create/preset/ssr.js +32 -38
- package/commands/create/preset/types.d.ts +2 -8
- package/commands/create/prompt/index.d.ts +0 -1
- package/commands/create/prompt/index.js +0 -1
- package/package.json +1 -1
- package/commands/create/prompt/provider.d.ts +0 -2
- package/commands/create/prompt/provider.js +0 -13
|
@@ -1,76 +1,75 @@
|
|
|
1
1
|
import packageJson from '../../../package.json' with { type: 'json' };
|
|
2
2
|
import { base } from './base.js';
|
|
3
|
-
export const gql = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'packages/graphql/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
3
|
+
export const gql = (options) => ({
|
|
4
|
+
...base(options),
|
|
5
|
+
'package.json': JSON.stringify({
|
|
6
|
+
name: options.name,
|
|
7
|
+
version: '0.0.0',
|
|
8
|
+
description: options.description,
|
|
9
|
+
private: true,
|
|
10
|
+
type: 'module',
|
|
11
|
+
agents: './AGENTS.md',
|
|
12
|
+
packageManager: packageJson.packageManager,
|
|
13
|
+
engines: {
|
|
14
|
+
node: packageJson.engines.node,
|
|
15
|
+
},
|
|
16
|
+
workspaces: [
|
|
17
|
+
'packages/*',
|
|
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:graphql': 'sh workspaces/graphql/bin/start.sh',
|
|
31
|
+
'lint:ts': 'tsc',
|
|
32
|
+
'lint:prettier': 'prettier . --check',
|
|
33
|
+
'lint:eslint': 'eslint .',
|
|
34
|
+
'build:graphql': 'rimraf dist && sh workspaces/graphql/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
|
+
'@vyriy/router': `^${packageJson.version}`,
|
|
59
|
+
tsx: packageJson.peerDependencies.tsx,
|
|
60
|
+
'webpack-cli': packageJson.peerDependencies['webpack-cli'],
|
|
61
|
+
graphql: packageJson.peerDependencies.graphql,
|
|
62
|
+
'@vyriy/html': `^${packageJson.version}`,
|
|
63
|
+
},
|
|
64
|
+
}, null, 2) + '\n',
|
|
65
|
+
'packages/graphql/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
67
66
|
import ReadMe from './README.md?raw';
|
|
68
67
|
|
|
69
68
|
<Meta title="Packages/GraphQL" />
|
|
70
69
|
|
|
71
70
|
<Markdown>{ReadMe}</Markdown>
|
|
72
71
|
`,
|
|
73
|
-
|
|
72
|
+
'packages/graphql/graphiql.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
74
73
|
|
|
75
74
|
import { graphiql } from './graphiql.js';
|
|
76
75
|
|
|
@@ -92,7 +91,7 @@ describe('packages/graphql/graphiql.ts', () => {
|
|
|
92
91
|
});
|
|
93
92
|
});
|
|
94
93
|
`,
|
|
95
|
-
|
|
94
|
+
'packages/graphql/graphiql.ts': `import { html, minify } from '@vyriy/html';
|
|
96
95
|
|
|
97
96
|
export const graphiql = () =>
|
|
98
97
|
minify(
|
|
@@ -189,7 +188,7 @@ export const graphiql = () =>
|
|
|
189
188
|
}),
|
|
190
189
|
);
|
|
191
190
|
`,
|
|
192
|
-
|
|
191
|
+
'packages/graphql/index.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
193
192
|
|
|
194
193
|
import { router } from './router.js';
|
|
195
194
|
|
|
@@ -201,14 +200,14 @@ describe('packages/graphql/index.ts', () => {
|
|
|
201
200
|
});
|
|
202
201
|
});
|
|
203
202
|
`,
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
'packages/graphql/index.ts': "export * from './router.js';\n",
|
|
204
|
+
'packages/graphql/package.json': `{
|
|
206
205
|
"name": "@p/graphql",
|
|
207
206
|
"type": "module",
|
|
208
207
|
"private": true
|
|
209
208
|
}
|
|
210
209
|
`,
|
|
211
|
-
|
|
210
|
+
'packages/graphql/README.md': `# @p/graphql
|
|
212
211
|
|
|
213
212
|
Reusable GraphQL API package for the application.
|
|
214
213
|
|
|
@@ -252,7 +251,7 @@ mutation Ping($message: String) {
|
|
|
252
251
|
}
|
|
253
252
|
\`\`\`
|
|
254
253
|
`,
|
|
255
|
-
|
|
254
|
+
'packages/graphql/router.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
256
255
|
import type { APIGatewayProxyEvent, APIGatewayProxyResult } from '@vyriy/router';
|
|
257
256
|
|
|
258
257
|
import { router } from './router.js';
|
|
@@ -390,7 +389,7 @@ describe('packages/graphql/router.ts', () => {
|
|
|
390
389
|
});
|
|
391
390
|
});
|
|
392
391
|
`,
|
|
393
|
-
|
|
392
|
+
'packages/graphql/router.ts': `import { createRouter } from '@vyriy/router';
|
|
394
393
|
|
|
395
394
|
import { graphql } from 'graphql';
|
|
396
395
|
|
|
@@ -458,7 +457,7 @@ router.post('/', async (params) => {
|
|
|
458
457
|
};
|
|
459
458
|
});
|
|
460
459
|
`,
|
|
461
|
-
|
|
460
|
+
'packages/graphql/schema.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
462
461
|
import { graphql } from 'graphql';
|
|
463
462
|
|
|
464
463
|
import { schema } from './schema.js';
|
|
@@ -498,7 +497,7 @@ describe('packages/graphql/schema.ts', () => {
|
|
|
498
497
|
});
|
|
499
498
|
});
|
|
500
499
|
`,
|
|
501
|
-
|
|
500
|
+
'packages/graphql/schema.ts': `import { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLBoolean } from 'graphql';
|
|
502
501
|
|
|
503
502
|
const TestType = new GraphQLObjectType({
|
|
504
503
|
name: 'Test',
|
|
@@ -552,7 +551,7 @@ export const schema = new GraphQLSchema({
|
|
|
552
551
|
mutation: MutationType,
|
|
553
552
|
});
|
|
554
553
|
`,
|
|
555
|
-
|
|
554
|
+
'workspaces/graphql/bin/build.sh': `#!/usr/bin/env sh
|
|
556
555
|
|
|
557
556
|
set -e
|
|
558
557
|
|
|
@@ -565,7 +564,7 @@ cp $scriptdir/package.json $distdir/package.json
|
|
|
565
564
|
npm pkg delete "type" --prefix $distdir
|
|
566
565
|
npm pkg delete "private" --prefix $distdir
|
|
567
566
|
`,
|
|
568
|
-
|
|
567
|
+
'workspaces/graphql/bin/start.sh': `#!/usr/bin/env sh
|
|
569
568
|
|
|
570
569
|
set -e
|
|
571
570
|
|
|
@@ -573,14 +572,14 @@ scriptdir="$PWD/workspaces/graphql";
|
|
|
573
572
|
|
|
574
573
|
NODE_ENV=production LOG_LEVEL=info tsx $scriptdir/index.ts
|
|
575
574
|
`,
|
|
576
|
-
|
|
575
|
+
'workspaces/graphql/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
577
576
|
import ReadMe from './README.md?raw';
|
|
578
577
|
|
|
579
578
|
<Meta title="Workspaces/Graphql" />
|
|
580
579
|
|
|
581
580
|
<Markdown>{ReadMe}</Markdown>
|
|
582
581
|
`,
|
|
583
|
-
|
|
582
|
+
'workspaces/graphql/index.test.ts': `import { describe, expect, it, jest } from '@jest/globals';
|
|
584
583
|
import type { APIGatewayProxyEvent } from '@vyriy/router';
|
|
585
584
|
|
|
586
585
|
const apiMock = jest.fn((handler) => ({
|
|
@@ -670,20 +669,20 @@ describe('workspaces/graphql/index.ts', () => {
|
|
|
670
669
|
});
|
|
671
670
|
});
|
|
672
671
|
`,
|
|
673
|
-
|
|
672
|
+
'workspaces/graphql/index.ts': `import { server } from '@vyriy/server';
|
|
674
673
|
import { api } from '@vyriy/handler';
|
|
675
674
|
|
|
676
675
|
import { router } from '@p/graphql';
|
|
677
676
|
|
|
678
677
|
server(api(async (event) => router.route(event)));
|
|
679
678
|
`,
|
|
680
|
-
|
|
679
|
+
'workspaces/graphql/package.json': `{
|
|
681
680
|
"name": "@w/graphql",
|
|
682
681
|
"type": "module",
|
|
683
682
|
"private": true
|
|
684
683
|
}
|
|
685
684
|
`,
|
|
686
|
-
|
|
685
|
+
'workspaces/graphql/README.md': `# @w/graphql
|
|
687
686
|
|
|
688
687
|
GraphQL runtime workspace for the application.
|
|
689
688
|
|
|
@@ -726,7 +725,7 @@ The workspace entrypoint is \`index.ts\`. It wraps the shared router with \`api(
|
|
|
726
725
|
server(api(async (event) => router.route(event)));
|
|
727
726
|
\`\`\`
|
|
728
727
|
`,
|
|
729
|
-
|
|
728
|
+
'workspaces/graphql/webpack.config.ts': `import { path } from '@vyriy/path';
|
|
730
729
|
import { ssr, external } from '@vyriy/webpack-config';
|
|
731
730
|
|
|
732
731
|
export default ssr(
|
|
@@ -742,9 +741,4 @@ export default ssr(
|
|
|
742
741
|
}),
|
|
743
742
|
);
|
|
744
743
|
`,
|
|
745
|
-
|
|
746
|
-
ci: {
|
|
747
|
-
...base.ci,
|
|
748
|
-
},
|
|
749
|
-
deploy: {},
|
|
750
|
-
};
|
|
744
|
+
});
|
|
@@ -7,6 +7,7 @@ import { spa } from './spa.js';
|
|
|
7
7
|
import { rest } from './rest.js';
|
|
8
8
|
import { gql } from './gql.js';
|
|
9
9
|
import { mfe } from './mfe.js';
|
|
10
|
+
import { fullstack } from './fullstack.js';
|
|
10
11
|
export const presets = {
|
|
11
12
|
base: {
|
|
12
13
|
name: 'Base',
|
|
@@ -53,4 +54,9 @@ export const presets = {
|
|
|
53
54
|
description: 'Preset for Micro Frontend',
|
|
54
55
|
preset: mfe,
|
|
55
56
|
},
|
|
57
|
+
fullstack: {
|
|
58
|
+
name: 'Fullstack',
|
|
59
|
+
description: 'Preset for fullstack React application',
|
|
60
|
+
preset: fullstack,
|
|
61
|
+
},
|
|
56
62
|
};
|
|
@@ -1,121 +1,120 @@
|
|
|
1
1
|
import packageJson from '../../../package.json' with { type: 'json' };
|
|
2
2
|
import { base } from './base.js';
|
|
3
3
|
import { stylelintConfigFile } from './shared.js';
|
|
4
|
-
export const library = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'tsconfig.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
[`packages/${options.name}/doc.mdx`]: `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
4
|
+
export const library = (options) => {
|
|
5
|
+
const packageScope = options.scope ?? `@${options.name}`;
|
|
6
|
+
const packageName = `${packageScope}/${options.name}`;
|
|
7
|
+
return {
|
|
8
|
+
...base(options),
|
|
9
|
+
'package.json': JSON.stringify({
|
|
10
|
+
name: options.name,
|
|
11
|
+
version: '0.0.0',
|
|
12
|
+
description: options.description,
|
|
13
|
+
private: true,
|
|
14
|
+
type: 'module',
|
|
15
|
+
agents: './AGENTS.md',
|
|
16
|
+
packageManager: packageJson.packageManager,
|
|
17
|
+
engines: {
|
|
18
|
+
node: packageJson.engines.node,
|
|
19
|
+
},
|
|
20
|
+
workspaces: [
|
|
21
|
+
'packages/*',
|
|
22
|
+
],
|
|
23
|
+
license: 'MIT',
|
|
24
|
+
repository: {
|
|
25
|
+
type: 'git',
|
|
26
|
+
url: `https://github.com/${options.name}/${options.name}`,
|
|
27
|
+
},
|
|
28
|
+
scripts: {
|
|
29
|
+
storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
|
|
30
|
+
check: 'run-s lint build test',
|
|
31
|
+
fix: "run-s 'fix:*'",
|
|
32
|
+
lint: "run-s 'lint:*'",
|
|
33
|
+
build: "run-s 'build:*'",
|
|
34
|
+
test: "run-s 'test:*'",
|
|
35
|
+
'fix:prettier': 'prettier . --write',
|
|
36
|
+
'fix:eslint': 'eslint . --fix',
|
|
37
|
+
'fix:stylelint': 'stylelint "**/*.{css,scss}" --fix',
|
|
38
|
+
'lint:ts': 'tsc',
|
|
39
|
+
'lint:prettier': 'prettier . --check',
|
|
40
|
+
'lint:eslint': 'eslint .',
|
|
41
|
+
'lint:stylelint': 'stylelint "**/*.{css,scss}"',
|
|
42
|
+
'build:dist': 'rimraf dist && tsc -p tsconfig.build.json && vyriy -d',
|
|
43
|
+
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
44
|
+
'test:jest': 'jest',
|
|
45
|
+
postinstall: 'husky',
|
|
46
|
+
},
|
|
47
|
+
dependencies: {
|
|
48
|
+
'@vyriy/typescript-config': `^${packageJson.version}`,
|
|
49
|
+
typescript: packageJson.peerDependencies.typescript,
|
|
50
|
+
'@vyriy/prettier-config': `^${packageJson.version}`,
|
|
51
|
+
prettier: packageJson.peerDependencies.prettier,
|
|
52
|
+
'@vyriy/eslint-config': `^${packageJson.version}`,
|
|
53
|
+
eslint: packageJson.peerDependencies.eslint,
|
|
54
|
+
'@vyriy/jest-config': `^${packageJson.version}`,
|
|
55
|
+
jest: packageJson.peerDependencies.jest,
|
|
56
|
+
'@vyriy/storybook-config': `^${packageJson.version}`,
|
|
57
|
+
storybook: packageJson.peerDependencies.storybook,
|
|
58
|
+
'@vyriy/path': `^${packageJson.version}`,
|
|
59
|
+
vyriy: `^${packageJson.version}`,
|
|
60
|
+
husky: packageJson.peerDependencies.husky,
|
|
61
|
+
'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
|
|
62
|
+
'cross-env': packageJson.peerDependencies['cross-env'],
|
|
63
|
+
react: packageJson.peerDependencies.react,
|
|
64
|
+
'react-dom': packageJson.peerDependencies['react-dom'],
|
|
65
|
+
'@types/react': packageJson.peerDependencies['@types/react'],
|
|
66
|
+
'@types/react-dom': packageJson.peerDependencies['@types/react-dom'],
|
|
67
|
+
'@vyriy/stylelint-config': `^${packageJson.version}`,
|
|
68
|
+
stylelint: packageJson.peerDependencies.stylelint,
|
|
69
|
+
rimraf: packageJson.peerDependencies.rimraf,
|
|
70
|
+
},
|
|
71
|
+
}, null, 2) + '\n',
|
|
72
|
+
'tsconfig.build.json': JSON.stringify({
|
|
73
|
+
extends: './tsconfig.json',
|
|
74
|
+
include: [
|
|
75
|
+
'packages/**/*.ts',
|
|
76
|
+
'packages/**/*.tsx',
|
|
77
|
+
'packages/**/*.json',
|
|
78
|
+
],
|
|
79
|
+
exclude: [
|
|
80
|
+
'**/*.test.ts',
|
|
81
|
+
'**/*.test.tsx',
|
|
82
|
+
'**/*.stories.ts',
|
|
83
|
+
'**/*.stories.tsx',
|
|
84
|
+
],
|
|
85
|
+
compilerOptions: {
|
|
86
|
+
rootDir: './packages',
|
|
87
|
+
outDir: './dist',
|
|
88
|
+
noEmit: false,
|
|
89
|
+
declaration: true,
|
|
90
|
+
allowImportingTsExtensions: false,
|
|
91
|
+
},
|
|
92
|
+
}, null, 2) + '\n',
|
|
93
|
+
...stylelintConfigFile(),
|
|
94
|
+
[`packages/${options.name}/package.json`]: JSON.stringify({
|
|
95
|
+
name: packageName,
|
|
96
|
+
version: '0.0.0',
|
|
97
|
+
description: options.description,
|
|
98
|
+
private: true,
|
|
99
|
+
type: 'module',
|
|
100
|
+
main: 'index.js',
|
|
101
|
+
dependencies: {
|
|
102
|
+
'@vyriy/cn': `^${packageJson.version}`,
|
|
103
|
+
},
|
|
104
|
+
peerDependencies: {
|
|
105
|
+
react: packageJson.peerDependencies.react,
|
|
106
|
+
},
|
|
107
|
+
}, null, 2) + '\n',
|
|
108
|
+
[`packages/${options.name}/README.md`]: `# ${packageName}\n\n${options.description}\n`,
|
|
109
|
+
[`packages/${options.name}/doc.mdx`]: `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
111
110
|
import ReadMe from './README.md?raw';
|
|
112
111
|
|
|
113
112
|
<Meta title="UI/Button" />
|
|
114
113
|
|
|
115
114
|
<Markdown>{ReadMe}</Markdown>
|
|
116
115
|
`,
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
[`packages/${options.name}/index.ts`]: "export * from './button.js';\nexport type * from './types.js';\n",
|
|
117
|
+
[`packages/${options.name}/types.ts`]: `import type { ComponentProps, FC } from 'react';
|
|
119
118
|
|
|
120
119
|
export type ButtonProps = ComponentProps<'button'> & {
|
|
121
120
|
readonly variant?: 'primary' | 'secondary';
|
|
@@ -123,7 +122,7 @@ export type ButtonProps = ComponentProps<'button'> & {
|
|
|
123
122
|
|
|
124
123
|
export type ButtonType = FC<ButtonProps>;
|
|
125
124
|
`,
|
|
126
|
-
|
|
125
|
+
[`packages/${options.name}/button.tsx`]: `import { cn } from '@vyriy/cn';
|
|
127
126
|
|
|
128
127
|
import type { ButtonType } from './types.js';
|
|
129
128
|
|
|
@@ -133,7 +132,7 @@ export const Button: ButtonType = ({ className, variant = 'primary', ...props })
|
|
|
133
132
|
<button type="button" className={cn('button', \`button--\${variant}\`, className)} {...props} />
|
|
134
133
|
);
|
|
135
134
|
`,
|
|
136
|
-
|
|
135
|
+
[`packages/${options.name}/index.test.ts`]: `import { describe, expect, it } from '@jest/globals';
|
|
137
136
|
|
|
138
137
|
import { Button } from './button.js';
|
|
139
138
|
import { Button as PublicButton } from './index.js';
|
|
@@ -144,7 +143,7 @@ describe('ui entry point', () => {
|
|
|
144
143
|
});
|
|
145
144
|
});
|
|
146
145
|
`,
|
|
147
|
-
|
|
146
|
+
[`packages/${options.name}/button.scss`]: `.button {
|
|
148
147
|
border: 1px solid transparent;
|
|
149
148
|
border-radius: 6px;
|
|
150
149
|
cursor: pointer;
|
|
@@ -163,8 +162,8 @@ describe('ui entry point', () => {
|
|
|
163
162
|
color: #24292f;
|
|
164
163
|
}
|
|
165
164
|
`,
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
[`packages/${options.name}/styles.d.ts`]: "declare module '*.scss';\n",
|
|
166
|
+
[`packages/${options.name}/button.stories.tsx`]: `import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
168
167
|
|
|
169
168
|
import { Button } from './button.js';
|
|
170
169
|
|
|
@@ -213,7 +212,7 @@ export const Secondary: Story = {
|
|
|
213
212
|
},
|
|
214
213
|
};
|
|
215
214
|
`,
|
|
216
|
-
|
|
215
|
+
[`packages/${options.name}/button.test.tsx`]: `import type { ReactElement } from 'react';
|
|
217
216
|
import { describe, expect, it } from '@jest/globals';
|
|
218
217
|
|
|
219
218
|
import { Button } from './button.js';
|
|
@@ -244,10 +243,5 @@ describe('Button', () => {
|
|
|
244
243
|
});
|
|
245
244
|
});
|
|
246
245
|
`,
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
ci: {
|
|
250
|
-
...base.ci,
|
|
251
|
-
},
|
|
252
|
-
deploy: {},
|
|
246
|
+
};
|
|
253
247
|
};
|