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
@@ -1,2 +0,0 @@
1
- import { GetProjectKindFromPreset } from './types.js';
2
- export declare const getProjectKindFromPreset: GetProjectKindFromPreset;
@@ -1 +0,0 @@
1
- export const getProjectKindFromPreset = (preset) => preset;
@@ -1,2 +0,0 @@
1
- import { VyriyPreset, VyriyProjectKind } from '../types.js';
2
- export type GetProjectKindFromPreset = (preset: VyriyPreset) => VyriyProjectKind;
@@ -1,2 +0,0 @@
1
- export * from './print.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './print.js';
@@ -1,2 +0,0 @@
1
- import { PrintProjectPlan } from './types.js';
2
- export declare const printProjectPlan: PrintProjectPlan;
@@ -1,47 +0,0 @@
1
- const printList = (values) => values.length === 0 ? ' - none' : values.map((value) => ` - ${value}`).join('\n');
2
- const printCi = (plan) => plan.ci.enabled
3
- ? `CI/CD:
4
- enabled: yes
5
- providers:
6
- ${printList(plan.ci.providers)}
7
- pipelines:
8
- ${printList(plan.ci.pipelines)}
9
- `
10
- : `CI/CD:
11
- enabled: no
12
- `;
13
- const printApi = (plan) => {
14
- if (!plan.api) {
15
- return '';
16
- }
17
- const rest = plan.api.rest
18
- ? ` REST:
19
- router: ${plan.api.rest.packageName}
20
- `
21
- : '';
22
- const graphql = plan.api.graphql
23
- ? ` GraphQL:
24
- package: ${plan.api.graphql.packageName}
25
- `
26
- : '';
27
- return `API:
28
- style: ${plan.api.style}
29
- runtime: ${plan.api.runtime}
30
- ${rest}${graphql}`;
31
- };
32
- export const printProjectPlan = (plan) => `Project summary:
33
-
34
- Name: ${plan.projectName}
35
- Target directory: ${plan.targetDirectory}
36
- Scope: ${plan.packageScope}
37
- Description: ${plan.description}
38
- Preset: ${plan.preset}
39
- Kind: ${plan.projectKind}
40
- Features:
41
- ${printList(plan.features)}
42
- Packages:
43
- ${printList(plan.packages.map((packagePlan) => `${packagePlan.name} (${packagePlan.kind})`))}
44
- Workspaces:
45
- ${printList(plan.workspaces.map((workspacePlan) => `${workspacePlan.name} (${workspacePlan.kind})`))}
46
- ${printApi(plan)}${printCi(plan)}
47
- `;
@@ -1,2 +0,0 @@
1
- import { VyriyProjectPlan } from '../types.js';
2
- export type PrintProjectPlan = (plan: VyriyProjectPlan) => string;
@@ -1,46 +0,0 @@
1
- export type VyriyProjectKind = 'library' | 'api' | 'csr' | 'ssr' | 'ssg' | 'mfe' | 'fullstack' | 'empty';
2
- export type VyriyPreset = 'empty' | 'library' | 'api' | 'ssr' | 'ssg' | 'csr' | 'fullstack' | 'mfe';
3
- export type VyriyFeature = 'typescript' | 'eslint' | 'prettier' | 'jest' | 'rest-api' | 'graphql-api' | 'react' | 'storybook' | 'webpack' | 'docker' | 'aws-cdk' | 'apigateway' | 'lambda' | 'fargate' | 's3' | 'cloudfront' | 'openmfe';
4
- export type VyriyPackagePlan = {
5
- readonly name: string;
6
- readonly kind: 'core' | 'ui' | 'api' | 'services' | 'stack' | 'config' | 'utils' | 'components' | 'app';
7
- readonly publishable: boolean;
8
- };
9
- export type VyriyWorkspacePlan = {
10
- readonly name: string;
11
- readonly kind: 'api' | 'ui' | 'stack' | 'lambda' | 'fargate';
12
- };
13
- export type VyriyCiProvider = 'gitlab' | 'github';
14
- export type VyriyCiPipeline = 'install' | 'lint' | 'test' | 'build' | 'deploy' | 'smoke' | 'e2e';
15
- export type VyriyCiPlan = {
16
- readonly enabled: boolean;
17
- readonly providers: VyriyCiProvider[];
18
- readonly pipelines: VyriyCiPipeline[];
19
- };
20
- export type VyriyApiStyle = 'rest' | 'graphql';
21
- export type VyriyApiRuntime = 'docker' | 'lambda';
22
- export type VyriyApiPlan = {
23
- readonly enabled: boolean;
24
- readonly style: VyriyApiStyle;
25
- readonly runtime: VyriyApiRuntime;
26
- readonly rest?: {
27
- readonly router: 'vyriy-router';
28
- readonly packageName: '@vyriy/router';
29
- };
30
- readonly graphql?: {
31
- readonly packageName: 'graphql';
32
- };
33
- };
34
- export type VyriyProjectPlan = {
35
- readonly projectName: string;
36
- readonly targetDirectory: string;
37
- readonly packageScope: string;
38
- readonly description: string;
39
- readonly projectKind: VyriyProjectKind;
40
- readonly preset: VyriyPreset;
41
- readonly features: VyriyFeature[];
42
- readonly packages: VyriyPackagePlan[];
43
- readonly workspaces: VyriyWorkspacePlan[];
44
- readonly ci: VyriyCiPlan;
45
- readonly api?: VyriyApiPlan;
46
- };
@@ -1,2 +0,0 @@
1
- export * from './project-plan.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './project-plan.js';
@@ -1,2 +0,0 @@
1
- import { PromptProjectPlan } from './types.js';
2
- export declare const askProjectPlan: PromptProjectPlan;
@@ -1,198 +0,0 @@
1
- import { stdin, stdout } from 'node:process';
2
- import { createInterface } from 'node:readline';
3
- import { createProjectPlanFromPreset, getDefaultApiStyleFromPreset, isApiPreset, } from '../../project-plan/index.js';
4
- const presets = [
5
- 'empty',
6
- 'library',
7
- 'api',
8
- 'ssr',
9
- 'ssg',
10
- 'csr',
11
- 'fullstack',
12
- 'mfe',
13
- ];
14
- const presetDescriptions = {
15
- empty: 'shared tooling without application code',
16
- library: 'publishable React package for reusable UI',
17
- api: 'REST or GraphQL backend API',
18
- ssr: 'server-rendered React application',
19
- ssg: 'build-time generated static React site',
20
- csr: 'browser-rendered React application',
21
- fullstack: 'React frontend with backend API',
22
- mfe: 'OpenMFE widget with UI, API, SSR, and manifest',
23
- };
24
- const infrastructureOptions = ['docker', 'aws'];
25
- const infrastructureFeatureMap = {
26
- docker: ['docker'],
27
- aws: [
28
- 'aws-cdk',
29
- 'lambda',
30
- 'apigateway',
31
- ],
32
- };
33
- const extraFeatureMap = {
34
- docker: ['docker'],
35
- 'aws-api': [
36
- 'aws-cdk',
37
- 'lambda',
38
- 'apigateway',
39
- ],
40
- 'aws-fargate': [
41
- 'aws-cdk',
42
- 'fargate',
43
- 'docker',
44
- ],
45
- 'aws-static': [
46
- 'aws-cdk',
47
- 's3',
48
- 'cloudfront',
49
- ],
50
- };
51
- const directFeatureInputs = [
52
- 'docker',
53
- 'aws-cdk',
54
- 'apigateway',
55
- 'lambda',
56
- 'fargate',
57
- 's3',
58
- 'cloudfront',
59
- ];
60
- const apiStyles = ['rest', 'graphql'];
61
- const ciProviders = ['none', 'gitlab', 'github'];
62
- const createQuestion = (readline, output) => {
63
- const queuedLines = [];
64
- const pendingQuestions = [];
65
- readline.on('line', (line) => {
66
- const resolve = pendingQuestions.shift();
67
- if (resolve) {
68
- resolve(line);
69
- return;
70
- }
71
- queuedLines.push(line);
72
- });
73
- readline.on('close', () => {
74
- for (const resolve of pendingQuestions.splice(0)) {
75
- resolve('');
76
- }
77
- });
78
- return (query) => {
79
- output.write(query);
80
- const queuedLine = queuedLines.shift();
81
- if (queuedLine !== undefined) {
82
- return Promise.resolve(queuedLine);
83
- }
84
- return new Promise((resolve) => pendingQuestions.push(resolve));
85
- };
86
- };
87
- const promptWithDefault = async (question, label, defaultValue) => {
88
- const answer = (await question(`${label} (${defaultValue}): `)).trim();
89
- return answer || defaultValue;
90
- };
91
- const parsePreset = (value, defaultValue) => {
92
- const normalizedValue = value.trim();
93
- const numericValue = Number.parseInt(normalizedValue, 10);
94
- if (Number.isInteger(numericValue) && presets[numericValue - 1]) {
95
- return presets[numericValue - 1];
96
- }
97
- return presets.includes(normalizedValue) ? normalizedValue : defaultValue;
98
- };
99
- const parseFeatures = (value) => [
100
- ...new Set(value
101
- .split(',')
102
- .map((feature) => feature.trim())
103
- .flatMap((feature) => extraFeatureMap[feature] ??
104
- (directFeatureInputs.includes(feature)
105
- ? [feature]
106
- : []))),
107
- ];
108
- const parseInfrastructure = (value, defaultValue) => {
109
- const normalizedValue = value.trim().toLowerCase();
110
- const numericValue = Number.parseInt(normalizedValue, 10);
111
- if (Number.isInteger(numericValue) && infrastructureOptions[numericValue - 1]) {
112
- return [...infrastructureFeatureMap[infrastructureOptions[numericValue - 1]]];
113
- }
114
- if (infrastructureOptions.includes(normalizedValue)) {
115
- return [...infrastructureFeatureMap[normalizedValue]];
116
- }
117
- const legacyFeatures = parseFeatures(value);
118
- return legacyFeatures.length > 0 ? legacyFeatures : [...infrastructureFeatureMap[defaultValue]];
119
- };
120
- const getDefaultInfrastructureInput = (features) => features?.some((feature) => [
121
- 'aws-cdk',
122
- 'lambda',
123
- 'apigateway',
124
- 'fargate',
125
- 's3',
126
- 'cloudfront',
127
- ].includes(feature))
128
- ? 'aws'
129
- : 'docker';
130
- const parseApiStyle = (value, defaultValue) => {
131
- const normalizedValue = value.trim().toLowerCase();
132
- const numericValue = Number.parseInt(normalizedValue, 10);
133
- if (Number.isInteger(numericValue) && apiStyles[numericValue - 1]) {
134
- return apiStyles[numericValue - 1];
135
- }
136
- return apiStyles.includes(normalizedValue) ? normalizedValue : defaultValue;
137
- };
138
- const parseCiProvider = (value, defaultValue) => {
139
- const normalizedValue = value.trim().toLowerCase();
140
- const numericValue = Number.parseInt(normalizedValue, 10);
141
- if (Number.isInteger(numericValue) && ciProviders[numericValue - 1]) {
142
- return ciProviders[numericValue - 1];
143
- }
144
- return ciProviders.includes(normalizedValue)
145
- ? normalizedValue
146
- : defaultValue;
147
- };
148
- export const askProjectPlan = async ({ defaults = {}, input = stdin, output = stdout } = {}) => {
149
- const readline = createInterface({ input, output });
150
- const question = createQuestion(readline, output);
151
- try {
152
- output.write('Vyriy Project Master\n\n');
153
- const projectName = await promptWithDefault(question, 'Project name', defaults.projectName ?? 'my-app');
154
- const targetDirectory = await promptWithDefault(question, 'Target directory', defaults.targetDirectory ?? projectName);
155
- const packageScope = await promptWithDefault(question, 'Package scope', defaults.packageScope ?? `@${projectName}`);
156
- const description = await promptWithDefault(question, 'Description', defaults.description ?? 'Calm cloud-ready application.');
157
- output.write('\nProject preset:\n');
158
- presets.forEach((preset, index) => output.write(` ${index + 1}. ${preset} - ${presetDescriptions[preset]}\n`));
159
- const defaultPreset = defaults.preset ?? 'empty';
160
- const presetAnswer = await promptWithDefault(question, 'Preset number or name', defaultPreset);
161
- const preset = parsePreset(presetAnswer, defaultPreset);
162
- const defaultApiStyle = defaults.apiStyle ?? getDefaultApiStyleFromPreset(preset);
163
- const apiStyle = isApiPreset(preset)
164
- ? parseApiStyle(await promptWithDefault(question, 'API style:\n 1. rest (@vyriy/router),\n 2. graphql', defaultApiStyle), defaultApiStyle)
165
- : undefined;
166
- output.write('\nCI/CD provider:\n');
167
- output.write(' 1. none\n');
168
- output.write(' 2. gitlab\n');
169
- output.write(' 3. github\n');
170
- const defaultCiProvider = defaults.ciProvider ?? 'none';
171
- const ciProvider = parseCiProvider(await promptWithDefault(question, 'CI/CD provider number or name', defaultCiProvider), defaultCiProvider);
172
- const features = isApiPreset(preset)
173
- ? await (async () => {
174
- output.write('\nInfrastructure:\n');
175
- output.write(' 1. Docker\n');
176
- output.write(' 2. AWS\n');
177
- const defaultInfrastructure = getDefaultInfrastructureInput(defaults.features);
178
- const featuresAnswer = await promptWithDefault(question, 'Infrastructure number or name', defaultInfrastructure);
179
- return parseInfrastructure(featuresAnswer, defaultInfrastructure);
180
- })()
181
- : [];
182
- const plan = createProjectPlanFromPreset({
183
- projectName,
184
- targetDirectory,
185
- packageScope,
186
- description,
187
- preset,
188
- features,
189
- apiStyle,
190
- ciProvider,
191
- });
192
- const confirmation = (await promptWithDefault(question, 'Use this project plan?', 'yes')).toLowerCase();
193
- return confirmation === 'yes' || confirmation === 'y' ? plan : undefined;
194
- }
195
- finally {
196
- readline.close();
197
- }
198
- };
@@ -1,18 +0,0 @@
1
- import { Readable, Writable } from 'node:stream';
2
- import { VyriyApiStyle, VyriyCiPromptProvider, VyriyFeature, VyriyPreset, VyriyProjectPlan } from '../../project-plan/index.js';
3
- export type PromptProjectPlanDefaults = {
4
- readonly projectName?: string;
5
- readonly targetDirectory?: string;
6
- readonly packageScope?: string;
7
- readonly description?: string;
8
- readonly preset?: VyriyPreset;
9
- readonly features?: readonly VyriyFeature[];
10
- readonly apiStyle?: VyriyApiStyle;
11
- readonly ciProvider?: VyriyCiPromptProvider;
12
- };
13
- export type PromptProjectPlanOptions = {
14
- readonly defaults?: PromptProjectPlanDefaults;
15
- readonly input?: Readable;
16
- readonly output?: Writable;
17
- };
18
- export type PromptProjectPlan = (options?: PromptProjectPlanOptions) => Promise<VyriyProjectPlan | undefined>;
@@ -1,2 +0,0 @@
1
- import { CommandExists } from './types.js';
2
- export declare const commandExists: CommandExists;
@@ -1,10 +0,0 @@
1
- import { execCommand as execCommandDefault } from './execCommand.js';
2
- export const commandExists = async (command, { execCommand = execCommandDefault } = {}) => {
3
- try {
4
- await execCommand(command, ['--version']);
5
- return true;
6
- }
7
- catch {
8
- return false;
9
- }
10
- };
@@ -1,2 +0,0 @@
1
- import { ExecCommand } from './types.js';
2
- export declare const execCommand: ExecCommand;
@@ -1,7 +0,0 @@
1
- import { execFile } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- const execFileAsync = promisify(execFile);
4
- export const execCommand = async (command, args = []) => {
5
- const { stdout } = await execFileAsync(command, args);
6
- return stdout.trim();
7
- };
@@ -1,2 +0,0 @@
1
- import { FileExists } from './types.js';
2
- export declare const fileExists: FileExists;
@@ -1,10 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- export const fileExists = async (filePath) => {
3
- try {
4
- await fs.access(filePath);
5
- return true;
6
- }
7
- catch {
8
- return false;
9
- }
10
- };
package/shared/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './commandExists.js';
2
- export * from './execCommand.js';
3
- export * from './fileExists.js';
4
- export * from './runCommand.js';
5
- export * from './semver.js';
6
- export type * from './types.js';
package/shared/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from './commandExists.js';
2
- export * from './execCommand.js';
3
- export * from './fileExists.js';
4
- export * from './runCommand.js';
5
- export * from './semver.js';
@@ -1,9 +0,0 @@
1
- import { RunCommand, RunCommandOptions } from './types.js';
2
- export declare class RunCommandError extends Error {
3
- readonly args: readonly string[];
4
- readonly command: string;
5
- readonly cwd: string;
6
- readonly exitCode: number | null;
7
- constructor({ args, command, cwd }: RunCommandOptions, exitCode: number | null);
8
- }
9
- export declare const runCommand: RunCommand;
@@ -1,34 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { env as processEnv } from 'node:process';
3
- export class RunCommandError extends Error {
4
- args;
5
- command;
6
- cwd;
7
- exitCode;
8
- constructor({ args = [], command, cwd }, exitCode) {
9
- super(`Command failed with exit code ${exitCode ?? 'unknown'}: ${command} ${args.join(' ')}`.trim());
10
- this.name = 'RunCommandError';
11
- this.args = args;
12
- this.command = command;
13
- this.cwd = cwd;
14
- this.exitCode = exitCode;
15
- }
16
- }
17
- export const runCommand = async (options) => {
18
- const child = spawn(options.command, [...(options.args ?? [])], {
19
- cwd: options.cwd,
20
- env: options.env ?? processEnv,
21
- shell: false,
22
- stdio: 'inherit',
23
- });
24
- await new Promise((resolve, reject) => {
25
- child.on('error', reject);
26
- child.on('close', (code) => {
27
- if (code === 0) {
28
- resolve();
29
- return;
30
- }
31
- reject(new RunCommandError(options, code));
32
- });
33
- });
34
- };
@@ -1 +0,0 @@
1
- export declare const getMajorVersion: (version: string) => number | undefined;
package/shared/semver.js DELETED
@@ -1,4 +0,0 @@
1
- export const getMajorVersion = (version) => {
2
- const majorVersion = /^v?(\d+)/.exec(version.trim())?.[1];
3
- return majorVersion ? Number.parseInt(majorVersion, 10) : undefined;
4
- };
package/shared/types.d.ts DELETED
@@ -1,12 +0,0 @@
1
- export type ExecCommand = (command: string, args?: readonly string[]) => Promise<string>;
2
- export type RunCommandOptions = {
3
- readonly command: string;
4
- readonly args?: readonly string[];
5
- readonly cwd: string;
6
- readonly env?: Record<string, string | undefined>;
7
- };
8
- export type RunCommand = (options: RunCommandOptions) => Promise<void>;
9
- export type CommandExists = (command: string, options?: {
10
- readonly execCommand?: ExecCommand;
11
- }) => Promise<boolean>;
12
- export type FileExists = (filePath: string) => Promise<boolean>;
File without changes