vyriy 0.3.9 → 0.4.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.
Files changed (189) hide show
  1. package/README.md +74 -179
  2. package/bin/vyriy.js +2 -2
  3. package/cli/args.js +29 -0
  4. package/cli/cli.d.ts +2 -2
  5. package/cli/cli.js +18 -69
  6. package/cli/index.d.ts +1 -1
  7. package/cli/index.js +1 -1
  8. package/cli/types.d.ts +12 -3
  9. package/commands/check-env.d.ts +2 -0
  10. package/commands/check-env.js +65 -0
  11. package/commands/create/index.d.ts +2 -0
  12. package/commands/create/index.js +121 -0
  13. package/commands/create/plan/index.d.ts +4 -0
  14. package/commands/create/plan/index.js +3 -0
  15. package/commands/create/plan/plan.d.ts +9 -0
  16. package/commands/create/plan/plan.js +34 -0
  17. package/commands/create/plan/question.d.ts +2 -0
  18. package/commands/create/plan/question.js +25 -0
  19. package/commands/create/plan/types.d.ts +14 -0
  20. package/commands/create/preset/api.d.ts +2 -0
  21. package/commands/create/preset/api.js +16 -0
  22. package/commands/create/preset/base.d.ts +2 -0
  23. package/commands/create/preset/base.js +195 -0
  24. package/commands/create/preset/gql.d.ts +2 -0
  25. package/commands/create/preset/gql.js +16 -0
  26. package/commands/create/preset/index.d.ts +12 -0
  27. package/commands/create/preset/index.js +14 -0
  28. package/commands/create/preset/library.d.ts +2 -0
  29. package/commands/create/preset/library.js +227 -0
  30. package/commands/create/preset/mfe.d.ts +2 -0
  31. package/commands/create/preset/mfe.js +16 -0
  32. package/commands/create/preset/rest.d.ts +2 -0
  33. package/commands/create/preset/rest.js +16 -0
  34. package/commands/create/preset/spa.d.ts +2 -0
  35. package/commands/create/preset/spa.js +16 -0
  36. package/commands/create/preset/ssg.d.ts +2 -0
  37. package/commands/create/preset/ssg.js +16 -0
  38. package/commands/create/preset/ssr.d.ts +2 -0
  39. package/commands/create/preset/ssr.js +16 -0
  40. package/commands/create/preset/types.d.ts +15 -0
  41. package/commands/create/prompt/conflict-strategy.d.ts +5 -0
  42. package/commands/create/prompt/conflict-strategy.js +22 -0
  43. package/commands/create/prompt/index.d.ts +7 -0
  44. package/commands/create/prompt/index.js +6 -0
  45. package/commands/create/prompt/preset.d.ts +4 -0
  46. package/commands/create/prompt/preset.js +11 -0
  47. package/commands/create/prompt/prompt.d.ts +2 -0
  48. package/commands/create/prompt/prompt.js +4 -0
  49. package/commands/create/prompt/provider.d.ts +2 -0
  50. package/commands/create/prompt/provider.js +13 -0
  51. package/commands/create/prompt/resolve-option.d.ts +6 -0
  52. package/commands/create/prompt/resolve-option.js +8 -0
  53. package/commands/create/prompt/scope.d.ts +2 -0
  54. package/commands/create/prompt/scope.js +2 -0
  55. package/commands/create/prompt/types.d.ts +4 -0
  56. package/commands/dist.d.ts +2 -0
  57. package/commands/{publish/publish.js → dist.js} +8 -8
  58. package/commands/help.d.ts +3 -0
  59. package/commands/help.js +24 -0
  60. package/commands/index.d.ts +5 -0
  61. package/commands/index.js +5 -0
  62. package/commands/{publish/types.d.ts → types.d.ts} +18 -4
  63. package/commands/version.d.ts +2 -0
  64. package/commands/version.js +6 -0
  65. package/package.json +280 -551
  66. package/checks/node/index.d.ts +0 -2
  67. package/checks/node/index.js +0 -1
  68. package/checks/node/node.d.ts +0 -2
  69. package/checks/node/node.js +0 -22
  70. package/checks/node/types.d.ts +0 -11
  71. package/checks/yarn/index.d.ts +0 -2
  72. package/checks/yarn/index.js +0 -1
  73. package/checks/yarn/types.d.ts +0 -7
  74. package/checks/yarn/yarn.d.ts +0 -2
  75. package/checks/yarn/yarn.js +0 -40
  76. package/cli/args/args.js +0 -40
  77. package/cli/args/index.d.ts +0 -2
  78. package/cli/args/index.js +0 -1
  79. package/cli/args/types.d.ts +0 -24
  80. package/commands/doctor/doctor.d.ts +0 -2
  81. package/commands/doctor/doctor.js +0 -9
  82. package/commands/doctor/index.d.ts +0 -2
  83. package/commands/doctor/index.js +0 -1
  84. package/commands/doctor/types.d.ts +0 -8
  85. package/commands/init/index.d.ts +0 -2
  86. package/commands/init/index.js +0 -1
  87. package/commands/init/init.d.ts +0 -2
  88. package/commands/init/init.js +0 -7
  89. package/commands/init/types.d.ts +0 -5
  90. package/commands/new/index.d.ts +0 -2
  91. package/commands/new/index.js +0 -1
  92. package/commands/new/new.d.ts +0 -3
  93. package/commands/new/new.js +0 -189
  94. package/commands/new/types.d.ts +0 -15
  95. package/commands/publish/index.d.ts +0 -2
  96. package/commands/publish/index.js +0 -1
  97. package/commands/publish/publish.d.ts +0 -2
  98. package/doctor/checkCorepack.d.ts +0 -2
  99. package/doctor/checkCorepack.js +0 -24
  100. package/doctor/checkGit.d.ts +0 -2
  101. package/doctor/checkGit.js +0 -23
  102. package/doctor/checkNodeVersion.d.ts +0 -5
  103. package/doctor/checkNodeVersion.js +0 -24
  104. package/doctor/checkYarn.d.ts +0 -10
  105. package/doctor/checkYarn.js +0 -45
  106. package/doctor/createDoctorReport.d.ts +0 -2
  107. package/doctor/createDoctorReport.js +0 -17
  108. package/doctor/index.d.ts +0 -7
  109. package/doctor/index.js +0 -6
  110. package/doctor/printDoctorReport.d.ts +0 -2
  111. package/doctor/printDoctorReport.js +0 -42
  112. package/doctor/types.d.ts +0 -25
  113. package/file-plan/createFilePlan.d.ts +0 -4
  114. package/file-plan/createFilePlan.js +0 -29
  115. package/file-plan/index.d.ts +0 -4
  116. package/file-plan/index.js +0 -3
  117. package/file-plan/printFilePlan.d.ts +0 -2
  118. package/file-plan/printFilePlan.js +0 -44
  119. package/file-plan/types.d.ts +0 -12
  120. package/file-plan/writeFilePlan.d.ts +0 -2
  121. package/file-plan/writeFilePlan.js +0 -12
  122. package/index.d.ts +0 -12
  123. package/index.js +0 -12
  124. package/presets/agentsTemplate.d.ts +0 -1
  125. package/presets/agentsTemplate.js +0 -105
  126. package/presets/base/createBaseFiles.d.ts +0 -3
  127. package/presets/base/createBaseFiles.js +0 -307
  128. package/presets/config.d.ts +0 -28
  129. package/presets/config.js +0 -7
  130. package/presets/createProjectFiles.d.ts +0 -2
  131. package/presets/createProjectFiles.js +0 -8
  132. package/presets/index.d.ts +0 -2
  133. package/presets/index.js +0 -1
  134. package/presets/library/createLibraryUiFiles.d.ts +0 -3
  135. package/presets/library/createLibraryUiFiles.js +0 -127
  136. package/presets/packages/createPackageFiles.d.ts +0 -3
  137. package/presets/packages/createPackageFiles.js +0 -39
  138. package/presets/packages/createPackageManifest.d.ts +0 -7
  139. package/presets/packages/createPackageManifest.js +0 -13
  140. package/presets/types.d.ts +0 -3
  141. package/presets/workspaces/createWorkspaceFiles.d.ts +0 -3
  142. package/presets/workspaces/createWorkspaceFiles.js +0 -98
  143. package/project-plan/api/api.d.ts +0 -6
  144. package/project-plan/api/api.js +0 -44
  145. package/project-plan/api/index.d.ts +0 -2
  146. package/project-plan/api/index.js +0 -1
  147. package/project-plan/api/types.d.ts +0 -11
  148. package/project-plan/ci/ci.d.ts +0 -3
  149. package/project-plan/ci/ci.js +0 -20
  150. package/project-plan/ci/index.d.ts +0 -2
  151. package/project-plan/ci/index.js +0 -1
  152. package/project-plan/ci/types.d.ts +0 -6
  153. package/project-plan/create/create.d.ts +0 -2
  154. package/project-plan/create/create.js +0 -129
  155. package/project-plan/create/index.d.ts +0 -2
  156. package/project-plan/create/index.js +0 -1
  157. package/project-plan/create/types.d.ts +0 -13
  158. package/project-plan/index.d.ts +0 -6
  159. package/project-plan/index.js +0 -5
  160. package/project-plan/kind/index.d.ts +0 -2
  161. package/project-plan/kind/index.js +0 -1
  162. package/project-plan/kind/kind.d.ts +0 -2
  163. package/project-plan/kind/kind.js +0 -1
  164. package/project-plan/kind/types.d.ts +0 -2
  165. package/project-plan/print/index.d.ts +0 -2
  166. package/project-plan/print/index.js +0 -1
  167. package/project-plan/print/print.d.ts +0 -2
  168. package/project-plan/print/print.js +0 -47
  169. package/project-plan/print/types.d.ts +0 -2
  170. package/project-plan/types.d.ts +0 -46
  171. package/prompts/project-plan/index.d.ts +0 -2
  172. package/prompts/project-plan/index.js +0 -1
  173. package/prompts/project-plan/project-plan.d.ts +0 -2
  174. package/prompts/project-plan/project-plan.js +0 -198
  175. package/prompts/project-plan/types.d.ts +0 -18
  176. package/shared/commandExists.d.ts +0 -2
  177. package/shared/commandExists.js +0 -10
  178. package/shared/execCommand.d.ts +0 -2
  179. package/shared/execCommand.js +0 -7
  180. package/shared/fileExists.d.ts +0 -2
  181. package/shared/fileExists.js +0 -10
  182. package/shared/index.d.ts +0 -6
  183. package/shared/index.js +0 -5
  184. package/shared/runCommand.d.ts +0 -9
  185. package/shared/runCommand.js +0 -34
  186. package/shared/semver.d.ts +0 -1
  187. package/shared/semver.js +0 -4
  188. package/shared/types.d.ts +0 -12
  189. /package/cli/{args/args.d.ts → args.d.ts} +0 -0
@@ -0,0 +1,9 @@
1
+ export declare const plan: (dirName: string, appPath: string) => Promise<{
2
+ name: string;
3
+ description: string;
4
+ target: string;
5
+ preset: "base" | "library";
6
+ scope: string | undefined;
7
+ ci: import("../preset/types.js").CiProvider | undefined;
8
+ deploy: import("../preset/types.js").DeployProvider | undefined;
9
+ } | undefined>;
@@ -0,0 +1,34 @@
1
+ import { stdin, stdout } from 'node:process';
2
+ import { createInterface } from 'node:readline';
3
+ import { presets as appPreset } from '../preset/index.js';
4
+ import { prompt, provider as promptProvider, preset as promptPreset, scope as promptScope } from '../prompt/index.js';
5
+ import { question as createQuestion } from './question.js';
6
+ export const plan = async (dirName, appPath) => {
7
+ const readline = createInterface({ input: stdin, output: stdout });
8
+ const question = createQuestion(readline, stdout);
9
+ try {
10
+ stdout.write('\nVyriy Project Master\n\n');
11
+ const name = await prompt(question, 'Project name', dirName);
12
+ const description = await prompt(question, 'Project description', 'Calm cloud-ready application');
13
+ const target = await prompt(question, 'Target directory', appPath);
14
+ const preset = await promptPreset(question, stdout);
15
+ const scope = await promptScope(question, preset, name);
16
+ const ci = await promptProvider(question, stdout, 'CI/CD provider', appPreset[preset].preset.ci);
17
+ const deploy = await promptProvider(question, stdout, 'Deploy provider', appPreset[preset].preset.deploy);
18
+ const confirmation = (await prompt(question, 'Use this project plan?', 'y')).toLowerCase();
19
+ return confirmation === 'y'
20
+ ? {
21
+ name,
22
+ description,
23
+ target,
24
+ preset,
25
+ scope,
26
+ ci,
27
+ deploy,
28
+ }
29
+ : undefined;
30
+ }
31
+ finally {
32
+ readline.close();
33
+ }
34
+ };
@@ -0,0 +1,2 @@
1
+ import { Question } from './types.js';
2
+ export declare const question: Question;
@@ -0,0 +1,25 @@
1
+ export const question = (readline, output) => {
2
+ const queuedLines = [];
3
+ const pendingQuestions = [];
4
+ readline.on('line', (line) => {
5
+ const resolve = pendingQuestions.shift();
6
+ if (resolve) {
7
+ resolve(line);
8
+ return;
9
+ }
10
+ queuedLines.push(line);
11
+ });
12
+ readline.on('close', () => {
13
+ for (const resolve of pendingQuestions.splice(0)) {
14
+ resolve('');
15
+ }
16
+ });
17
+ return (query) => {
18
+ output.write(query);
19
+ const queuedLine = queuedLines.shift();
20
+ if (queuedLine !== undefined) {
21
+ return Promise.resolve(queuedLine);
22
+ }
23
+ return new Promise((resolve) => pendingQuestions.push(resolve));
24
+ };
25
+ };
@@ -0,0 +1,14 @@
1
+ import type { Interface } from 'node:readline';
2
+ import type { Writable } from 'node:stream';
3
+ export type Question = (readline: Interface, output: Writable) => (query: string) => Promise<string>;
4
+ export type Prompt = (question: (query: string) => Promise<string>, label: string, defaultValue: string) => Promise<string>;
5
+ export type PlanResult = {
6
+ name: string;
7
+ description: string;
8
+ target: string;
9
+ preset: string;
10
+ scope?: string;
11
+ ci?: string;
12
+ deploy?: string;
13
+ };
14
+ export type Plan = (dirName: string, appPath: string) => Promise<PlanResult | undefined>;
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const api: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const api = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const base: Preset;
@@ -0,0 +1,195 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import packageJson from '../../../package.json' with { type: 'json' };
5
+ const presetDir = dirname(fileURLToPath(import.meta.url));
6
+ const agentsPath = [
7
+ resolve(presetDir, '../../../AGENTS.md'),
8
+ resolve(presetDir, '../../../../AGENTS.md'),
9
+ ].find(existsSync) ?? '';
10
+ const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
11
+ export const base = {
12
+ files: ({ name, description }) => ({
13
+ 'package.json': JSON.stringify({
14
+ name,
15
+ version: '0.0.0',
16
+ description,
17
+ private: true,
18
+ type: 'module',
19
+ agents: './AGENTS.md',
20
+ packageManager: packageJson.packageManager,
21
+ engines: {
22
+ node: packageJson.engines.node,
23
+ },
24
+ scripts: {
25
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
26
+ check: 'run-s lint build test',
27
+ fix: "run-s 'fix:*'",
28
+ lint: "run-s 'lint:*'",
29
+ build: "run-s 'build:*'",
30
+ test: "run-s 'test:*'",
31
+ 'fix:prettier': 'prettier . --write',
32
+ 'fix:eslint': 'eslint . --fix',
33
+ 'lint:ts': 'tsc',
34
+ 'lint:prettier': 'prettier . --check',
35
+ 'lint:eslint': 'eslint .',
36
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
37
+ 'test:jest': 'jest --passWithNoTests',
38
+ postinstall: 'husky',
39
+ },
40
+ dependencies: {
41
+ '@vyriy/typescript-config': `^${packageJson.version}`,
42
+ typescript: packageJson.peerDependencies.typescript,
43
+ '@vyriy/prettier-config': `^${packageJson.version}`,
44
+ prettier: packageJson.peerDependencies.prettier,
45
+ '@vyriy/eslint-config': `^${packageJson.version}`,
46
+ eslint: packageJson.peerDependencies.eslint,
47
+ '@vyriy/jest-config': `^${packageJson.version}`,
48
+ jest: packageJson.peerDependencies.jest,
49
+ '@vyriy/storybook-config': `^${packageJson.version}`,
50
+ storybook: packageJson.peerDependencies.storybook,
51
+ '@vyriy/path': `^${packageJson.version}`,
52
+ husky: packageJson.peerDependencies.husky,
53
+ 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
54
+ 'cross-env': packageJson.peerDependencies['cross-env'],
55
+ },
56
+ }, null, 2),
57
+ 'README.md': `# ${name}\n\n${description}`,
58
+ 'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
59
+ import ReadMe from './README.md?raw';
60
+
61
+ <Meta title="${name}" />
62
+
63
+ <Markdown>{ReadMe}</Markdown>
64
+ `,
65
+ 'AGENTS.md': agentsContent,
66
+ '.editorconfig': `# https://editorconfig.org
67
+ root = true
68
+
69
+ [*]
70
+ charset = utf-8
71
+ end_of_line = lf
72
+ insert_final_newline = true
73
+ trim_trailing_whitespace = true
74
+
75
+ indent_style = space
76
+ indent_size = 2
77
+
78
+ max_line_length = 100
79
+
80
+ # Markdown
81
+ [*.md]
82
+ trim_trailing_whitespace = false
83
+ max_line_length = off
84
+
85
+ # YAML / YML
86
+ [*.{yml,yaml}]
87
+ indent_size = 2
88
+
89
+ # JSON
90
+ [*.json]
91
+ indent_size = 2
92
+
93
+ # TypeScript / JavaScript
94
+ [*.{ts,tsx,js,jsx}]
95
+ indent_size = 2
96
+
97
+ # Shell / Bash
98
+ [*.sh]
99
+ indent_size = 2
100
+ `,
101
+ '.gitignore': `.yarn/*
102
+ !.yarn/cache
103
+ !.yarn/patches
104
+ !.yarn/plugins
105
+ !.yarn/releases
106
+ !.yarn/sdks
107
+ !.yarn/versions
108
+
109
+ .DS_Store
110
+ .idea
111
+ node_modules
112
+ coverage
113
+ dist
114
+ storybook-static
115
+ *storybook.log
116
+ consumer
117
+
118
+ cdk.out
119
+ cdk.context.json
120
+
121
+ !/**/.gitkeep
122
+ `,
123
+ '.npmrc': 'engine-strict=true\n',
124
+ '.nvmrc': 'lts/krypton\n',
125
+ '.yarnrc.yml': 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
126
+ '.husky/commit-msg': '#!/bin/sh\n',
127
+ '.husky/post-checkout': '#!/bin/sh\n\nyarn\n',
128
+ '.husky/post-merge': '#!/bin/sh\n\nyarn\n',
129
+ '.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
130
+ '.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
131
+ '.storybook/main.ts': `import config from '@vyriy/storybook-config';
132
+ import { path } from '@vyriy/path';
133
+
134
+ export default {
135
+ ...config,
136
+ stories: [
137
+ path('**/*.mdx'),
138
+ path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
139
+ ],
140
+ };
141
+ `,
142
+ '.storybook/preview.tsx': "export { default } from '@vyriy/storybook-config/preview';\n",
143
+ 'yarn.lock': '',
144
+ 'tsconfig.json': JSON.stringify({
145
+ extends: '@vyriy/typescript-config/index.json',
146
+ include: [
147
+ '.storybook/**/*.ts',
148
+ '.storybook/**/*.tsx',
149
+ 'packages/**/*.ts',
150
+ 'packages/**/*.tsx',
151
+ 'workspaces/**/*.ts',
152
+ 'workspaces/**/*.tsx',
153
+ '*.ts',
154
+ ],
155
+ }, null, 2),
156
+ 'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
157
+ '.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\n',
158
+ 'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
159
+ 'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
160
+ }),
161
+ ci: {
162
+ gitlab: {
163
+ '.gitlab-ci.yml': `image: node:24
164
+
165
+ code:
166
+ script:
167
+ - corepack enable
168
+ - yarn install
169
+ - yarn check
170
+ `,
171
+ },
172
+ github: {
173
+ '.github/workflows/code.yml': `name: code
174
+
175
+ on:
176
+ push:
177
+ pull_request:
178
+
179
+ jobs:
180
+ code:
181
+ runs-on: ubuntu-latest
182
+ steps:
183
+ - uses: actions/checkout@v4
184
+ - uses: actions/setup-node@v4
185
+ with:
186
+ node-version: 24
187
+ - run: |
188
+ corepack enable
189
+ yarn install
190
+ yarn check
191
+ `,
192
+ },
193
+ },
194
+ deploy: {},
195
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const gql: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const gql = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,12 @@
1
+ export declare const presets: {
2
+ base: {
3
+ name: string;
4
+ description: string;
5
+ preset: import("./types.js").Preset;
6
+ };
7
+ library: {
8
+ name: string;
9
+ description: string;
10
+ preset: import("./types.js").Preset;
11
+ };
12
+ };
@@ -0,0 +1,14 @@
1
+ import { base } from './base.js';
2
+ import { library } from './library.js';
3
+ export const presets = {
4
+ base: {
5
+ name: 'Base',
6
+ description: 'Only configuration',
7
+ preset: base,
8
+ },
9
+ library: {
10
+ name: 'Library',
11
+ description: 'Preset to generate JS/React library',
12
+ preset: library,
13
+ },
14
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const library: Preset;
@@ -0,0 +1,227 @@
1
+ import packageJson from '../../../package.json' with { type: 'json' };
2
+ import { base } from './base.js';
3
+ export const library = {
4
+ files: (options) => {
5
+ const packageScope = options.scope ?? `@${options.name}`;
6
+ const packageName = `${packageScope}/${options.name}`;
7
+ return {
8
+ ...base.files(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
+ devDependencies: {
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),
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),
93
+ 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
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),
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';
110
+ import ReadMe from './README.md?raw';
111
+
112
+ <Meta title="UI/Button" />
113
+
114
+ <Markdown>{ReadMe}</Markdown>
115
+ `,
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';
118
+
119
+ export type ButtonProps = ComponentProps<'button'> & {
120
+ readonly variant?: 'primary' | 'secondary';
121
+ };
122
+
123
+ export type ButtonType = FC<ButtonProps>;
124
+ `,
125
+ [`packages/${options.name}/button.tsx`]: `import { cn } from '@vyriy/cn';
126
+
127
+ import type { ButtonType } from './types.js';
128
+
129
+ import './button.scss';
130
+
131
+ export const Button: ButtonType = ({ className, type = 'button', variant = 'primary', ...props }) => (
132
+ <button className={cn('button', \`button--\${variant}\`, className)} type={type} {...props} />
133
+ );
134
+ `,
135
+ [`packages/${options.name}/index.test.ts`]: `import { describe, expect, it } from '@jest/globals';
136
+
137
+ import { Button } from './button.js';
138
+ import { Button as PublicButton } from './index.js';
139
+
140
+ describe('ui entry point', () => {
141
+ it('exports Button', () => {
142
+ expect(PublicButton).toBe(Button);
143
+ });
144
+ });
145
+ `,
146
+ [`packages/${options.name}/button.scss`]: `.button {
147
+ border: 1px solid transparent;
148
+ border-radius: 6px;
149
+ cursor: pointer;
150
+ font: inherit;
151
+ padding: 0.5rem 0.875rem;
152
+ }
153
+
154
+ .button--primary {
155
+ background: #1f6feb;
156
+ color: #fff;
157
+ }
158
+
159
+ .button--secondary {
160
+ background: #fff;
161
+ border-color: #d0d7de;
162
+ color: #24292f;
163
+ }
164
+ `,
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';
167
+
168
+ import { Button } from './button.js';
169
+
170
+ const meta = {
171
+ title: 'UI/Button',
172
+ component: Button,
173
+ args: {
174
+ children: 'Button',
175
+ },
176
+ } satisfies Meta<typeof Button>;
177
+
178
+ export default meta;
179
+
180
+ type Story = StoryObj<typeof meta>;
181
+
182
+ export const Primary: Story = {};
183
+
184
+ export const Secondary: Story = {
185
+ args: {
186
+ variant: 'secondary',
187
+ },
188
+ };
189
+ `,
190
+ [`packages/${options.name}/button.test.tsx`]: `import type { ReactElement } from 'react';
191
+ import { describe, expect, it } from '@jest/globals';
192
+
193
+ import { Button } from './button.js';
194
+
195
+ type ButtonElement = ReactElement<{
196
+ readonly className: string;
197
+ readonly type: string;
198
+ }>;
199
+
200
+ describe('Button', () => {
201
+ it('creates a primary button by default', () => {
202
+ const element = Button({ children: 'Save' }) as ButtonElement;
203
+
204
+ expect(element.props.className).toBe('button button--primary');
205
+ expect(element.props.type).toBe('button');
206
+ });
207
+
208
+ it('composes secondary and custom classes', () => {
209
+ const element = Button({
210
+ children: 'Cancel',
211
+ className: 'wide',
212
+ type: 'submit',
213
+ variant: 'secondary',
214
+ }) as ButtonElement;
215
+
216
+ expect(element.props.className).toBe('button button--secondary wide');
217
+ expect(element.props.type).toBe('submit');
218
+ });
219
+ });
220
+ `,
221
+ };
222
+ },
223
+ ci: {
224
+ ...base.ci,
225
+ },
226
+ deploy: {},
227
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const mfe: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const mfe = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const rest: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const rest = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const spa: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const spa = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const ssg: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const ssg = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };