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,28 +0,0 @@
1
- import packageJson from '../package.json';
2
- type PublishedPackageJson = typeof packageJson & {
3
- readonly engines: {
4
- readonly node: string;
5
- };
6
- readonly packageManager: string;
7
- };
8
- export declare const json: (value: unknown) => string;
9
- export declare const packageVersion: (version: string) => string;
10
- export declare const publishedPackageJson: PublishedPackageJson;
11
- export declare const peerDependencies: {
12
- "@storybook/react-webpack5": string;
13
- "@types/react": string;
14
- "@types/react-dom": string;
15
- "cross-env": string;
16
- eslint: string;
17
- husky: string;
18
- jest: string;
19
- "npm-run-all2": string;
20
- prettier: string;
21
- react: string;
22
- "react-dom": string;
23
- rimraf: string;
24
- storybook: string;
25
- stylelint: string;
26
- typescript: string;
27
- };
28
- export {};
package/presets/config.js DELETED
@@ -1,7 +0,0 @@
1
- import packageJson from '../package.json' with { type: 'json' };
2
- export const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
3
- export const packageVersion = (version) => `^${version}`;
4
- const assumePublishedPackageJson = () => { };
5
- assumePublishedPackageJson(packageJson);
6
- export const publishedPackageJson = packageJson;
7
- export const peerDependencies = publishedPackageJson.peerDependencies;
@@ -1,2 +0,0 @@
1
- import { CreateProjectFiles } from './types.js';
2
- export declare const createProjectFiles: CreateProjectFiles;
@@ -1,8 +0,0 @@
1
- import { createBaseFiles } from './base/createBaseFiles.js';
2
- import { createPackageFiles } from './packages/createPackageFiles.js';
3
- import { createWorkspaceFiles } from './workspaces/createWorkspaceFiles.js';
4
- export const createProjectFiles = (plan) => [
5
- ...createBaseFiles(plan),
6
- ...plan.packages.flatMap((packagePlan) => createPackageFiles(plan, packagePlan)),
7
- ...plan.workspaces.flatMap((workspacePlan) => createWorkspaceFiles(plan, workspacePlan)),
8
- ];
@@ -1,2 +0,0 @@
1
- export * from './createProjectFiles.js';
2
- export type * from './types.js';
package/presets/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './createProjectFiles.js';
@@ -1,3 +0,0 @@
1
- import { ProjectFile } from '../../file-plan/index.js';
2
- import type { VyriyPackagePlan, VyriyProjectPlan } from '../../project-plan/index.js';
3
- export declare const createLibraryUiFiles: (plan: VyriyProjectPlan, packagePlan: VyriyPackagePlan) => ProjectFile[];
@@ -1,127 +0,0 @@
1
- import { packageVersion, peerDependencies, publishedPackageJson } from '../config.js';
2
- import { createPackageManifest } from '../packages/createPackageManifest.js';
3
- export const createLibraryUiFiles = (plan, packagePlan) => [
4
- createPackageManifest({
5
- dependencies: {
6
- '@vyriy/cn': packageVersion(publishedPackageJson.version),
7
- },
8
- packageScope: plan.packageScope,
9
- peerDependencies: {
10
- react: peerDependencies.react,
11
- },
12
- workspaceName: packagePlan.name,
13
- }),
14
- {
15
- path: `packages/${packagePlan.name}/README.md`,
16
- content: `# ${plan.packageScope}/${packagePlan.name}\n\n${plan.description}\n`,
17
- },
18
- {
19
- path: `packages/${packagePlan.name}/index.ts`,
20
- content: "export * from './button.js';\n",
21
- },
22
- {
23
- path: `packages/${packagePlan.name}/button.tsx`,
24
- content: `import type { ComponentProps, FC } from 'react';
25
- import { cn } from '@vyriy/cn';
26
-
27
- import './button.scss';
28
-
29
- export type ButtonProps = ComponentProps<'button'> & {
30
- readonly variant?: 'primary' | 'secondary';
31
- };
32
-
33
- export type ButtonType = FC<ButtonProps>;
34
-
35
- export const Button: ButtonType = ({ className, type = 'button', variant = 'primary', ...props }) => (
36
- <button className={cn('button', \`button--\${variant}\`, className)} type={type} {...props} />
37
- );
38
- `,
39
- },
40
- {
41
- path: `packages/${packagePlan.name}/button.scss`,
42
- content: `.button {
43
- border: 1px solid transparent;
44
- border-radius: 6px;
45
- cursor: pointer;
46
- font: inherit;
47
- padding: 0.5rem 0.875rem;
48
- }
49
-
50
- .button--primary {
51
- background: #1f6feb;
52
- color: #fff;
53
- }
54
-
55
- .button--secondary {
56
- background: #fff;
57
- border-color: #d0d7de;
58
- color: #24292f;
59
- }
60
- `,
61
- },
62
- {
63
- path: `packages/${packagePlan.name}/styles.d.ts`,
64
- content: "declare module '*.scss';\n",
65
- },
66
- {
67
- path: `packages/${packagePlan.name}/button.stories.tsx`,
68
- content: `import type { Meta, StoryObj } from '@storybook/react-webpack5';
69
-
70
- import { Button } from './button.js';
71
-
72
- const meta = {
73
- title: 'UI/Button',
74
- component: Button,
75
- args: {
76
- children: 'Button',
77
- },
78
- } satisfies Meta<typeof Button>;
79
-
80
- export default meta;
81
-
82
- type Story = StoryObj<typeof meta>;
83
-
84
- export const Primary: Story = {};
85
-
86
- export const Secondary: Story = {
87
- args: {
88
- variant: 'secondary',
89
- },
90
- };
91
- `,
92
- },
93
- {
94
- path: `packages/${packagePlan.name}/button.test.tsx`,
95
- content: `import type { ReactElement } from 'react';
96
- import { describe, expect, it } from '@jest/globals';
97
-
98
- import { Button } from './button.js';
99
-
100
- type ButtonElement = ReactElement<{
101
- readonly className: string;
102
- readonly type: string;
103
- }>;
104
-
105
- describe('Button', () => {
106
- it('creates a primary button by default', () => {
107
- const element = Button({ children: 'Save' }) as ButtonElement;
108
-
109
- expect(element.props.className).toBe('button button--primary');
110
- expect(element.props.type).toBe('button');
111
- });
112
-
113
- it('composes secondary and custom classes', () => {
114
- const element = Button({
115
- children: 'Cancel',
116
- className: 'wide',
117
- type: 'submit',
118
- variant: 'secondary',
119
- }) as ButtonElement;
120
-
121
- expect(element.props.className).toBe('button button--secondary wide');
122
- expect(element.props.type).toBe('submit');
123
- });
124
- });
125
- `,
126
- },
127
- ];
@@ -1,3 +0,0 @@
1
- import { ProjectFile } from '../../file-plan/index.js';
2
- import type { VyriyPackagePlan, VyriyProjectPlan } from '../../project-plan/index.js';
3
- export declare const createPackageFiles: (plan: VyriyProjectPlan, packagePlan: VyriyPackagePlan) => ProjectFile[];
@@ -1,39 +0,0 @@
1
- import { createLibraryUiFiles } from '../library/createLibraryUiFiles.js';
2
- import { createPackageManifest } from './createPackageManifest.js';
3
- const createGenericPackageFiles = (plan, packagePlan) => [
4
- createPackageManifest({
5
- packageScope: plan.packageScope,
6
- workspaceName: packagePlan.name,
7
- }),
8
- {
9
- path: `packages/${packagePlan.name}/README.md`,
10
- content: `# ${plan.packageScope}/${packagePlan.name}\n\n${plan.description}\n`,
11
- },
12
- {
13
- path: `packages/${packagePlan.name}/index.ts`,
14
- content: packagePlan.kind === 'stack' ? "export * from './stack.js';\n" : "export type * from './types.js';\n",
15
- },
16
- ...(packagePlan.kind === 'stack'
17
- ? [
18
- {
19
- path: `packages/${packagePlan.name}/stack.ts`,
20
- content: 'export type StackName = string;\n',
21
- },
22
- {
23
- path: `packages/${packagePlan.name}/stack.test.ts`,
24
- content: "import { describe, expect, it } from '@jest/globals';\n\ndescribe('stack', () => {\n it('has a test harness', () => {\n expect(true).toBe(true);\n });\n});\n",
25
- },
26
- ]
27
- : [
28
- {
29
- path: `packages/${packagePlan.name}/types.ts`,
30
- content: 'export type PackageName = string;\n',
31
- },
32
- {
33
- path: `packages/${packagePlan.name}/${packagePlan.name}.test.ts`,
34
- content: "import { describe, expect, it } from '@jest/globals';\n\ndescribe('package', () => {\n it('has a test harness', () => {\n expect(true).toBe(true);\n });\n});\n",
35
- },
36
- ]),
37
- ];
38
- const createPresetPackageFiles = (plan, packagePlan) => plan.preset === 'library' && packagePlan.kind === 'ui' ? createLibraryUiFiles(plan, packagePlan) : undefined;
39
- export const createPackageFiles = (plan, packagePlan) => createPresetPackageFiles(plan, packagePlan) ?? createGenericPackageFiles(plan, packagePlan);
@@ -1,7 +0,0 @@
1
- import { ProjectFile } from '../../file-plan/index.js';
2
- export declare const createPackageManifest: ({ dependencies, packageScope, peerDependencies, workspaceName, }: {
3
- readonly dependencies?: Record<string, string>;
4
- readonly packageScope: string;
5
- readonly peerDependencies?: Record<string, string>;
6
- readonly workspaceName: string;
7
- }) => ProjectFile;
@@ -1,13 +0,0 @@
1
- import { json } from '../config.js';
2
- export const createPackageManifest = ({ dependencies = {}, packageScope, peerDependencies = {}, workspaceName, }) => ({
3
- path: `packages/${workspaceName}/package.json`,
4
- content: json({
5
- name: `${packageScope}/${workspaceName}`,
6
- version: '0.0.0',
7
- private: true,
8
- type: 'module',
9
- main: 'index.js',
10
- ...(Object.keys(dependencies).length > 0 ? { dependencies } : {}),
11
- ...(Object.keys(peerDependencies).length > 0 ? { peerDependencies } : {}),
12
- }),
13
- });
@@ -1,3 +0,0 @@
1
- import { ProjectFile } from '../file-plan/index.js';
2
- import { VyriyProjectPlan } from '../project-plan/index.js';
3
- export type CreateProjectFiles = (plan: VyriyProjectPlan) => ProjectFile[];
@@ -1,3 +0,0 @@
1
- import { ProjectFile } from '../../file-plan/index.js';
2
- import type { VyriyProjectPlan, VyriyWorkspacePlan } from '../../project-plan/index.js';
3
- export declare const createWorkspaceFiles: (plan: VyriyProjectPlan, workspacePlan: VyriyWorkspacePlan) => ProjectFile[];
@@ -1,98 +0,0 @@
1
- import { json, packageVersion, publishedPackageJson } from '../config.js';
2
- const getWorkspacePath = (workspacePlan) => workspacePlan.kind === 'lambda' && workspacePlan.name === 'api'
3
- ? `workspaces/lambda/${workspacePlan.name}`
4
- : `workspaces/${workspacePlan.name}`;
5
- const getWorkspacePackageName = ({ packageScope, workspacePlan, }) => workspacePlan.kind === 'lambda' && workspacePlan.name === 'api'
6
- ? `${packageScope}/lambda-api-workspace`
7
- : `${packageScope}/${workspacePlan.name}-workspace`;
8
- const isApiWorkspace = (workspacePlan) => [
9
- 'api',
10
- 'lambda',
11
- 'fargate',
12
- ].includes(workspacePlan.kind);
13
- const createApiWorkspaceDependencies = (workspacePlan) => isApiWorkspace(workspacePlan)
14
- ? {
15
- '@vyriy/handler': packageVersion(publishedPackageJson.version),
16
- '@vyriy/server': packageVersion(publishedPackageJson.version),
17
- }
18
- : {};
19
- const createApiHandlerFile = (workspacePath) => ({
20
- path: `${workspacePath}/handler.ts`,
21
- content: `import { api } from '@vyriy/handler';
22
-
23
- export const handler = api(async (event) => ({
24
- statusCode: 200,
25
- body: JSON.stringify({
26
- path: event.path,
27
- }),
28
- }));
29
- `,
30
- });
31
- const createApiServerFile = ({ entrypoint, workspacePath, }) => ({
32
- path: `${workspacePath}/${entrypoint}`,
33
- content: `import { server } from '@vyriy/server';
34
-
35
- import { handler } from './handler.js';
36
-
37
- server(handler);
38
- `,
39
- });
40
- const createDockerfile = (workspacePath) => ({
41
- path: `${workspacePath}/Dockerfile`,
42
- content: `FROM node:24-alpine
43
-
44
- WORKDIR /app
45
-
46
- COPY package.json yarn.lock .yarnrc.yml ./
47
- COPY .yarn ./.yarn
48
- COPY packages ./packages
49
- COPY workspaces ./workspaces
50
-
51
- RUN corepack enable && yarn install --immutable
52
- RUN yarn build
53
-
54
- CMD ["node", "workspaces/api/index.js"]
55
- `,
56
- });
57
- const createApiWorkspaceFiles = (plan, workspacePlan) => {
58
- const workspacePath = getWorkspacePath(workspacePlan);
59
- const isLambda = workspacePlan.kind === 'lambda';
60
- return [
61
- createApiHandlerFile(workspacePath),
62
- createApiServerFile({ entrypoint: isLambda ? 'server.ts' : 'index.ts', workspacePath }),
63
- {
64
- path: `${workspacePath}/${workspacePlan.name}.test.ts`,
65
- content: "import { describe, expect, it } from '@jest/globals';\n\nimport { handler } from './handler.js';\n\ndescribe('api workspace', () => {\n it('exports a handler', () => {\n expect(handler).toEqual(expect.any(Function));\n });\n});\n",
66
- },
67
- ...(plan.features.includes('docker') && !isLambda ? [createDockerfile(workspacePath)] : []),
68
- ];
69
- };
70
- export const createWorkspaceFiles = (plan, workspacePlan) => {
71
- const workspacePath = getWorkspacePath(workspacePlan);
72
- const dependencies = createApiWorkspaceDependencies(workspacePlan);
73
- return [
74
- {
75
- path: `${workspacePath}/package.json`,
76
- content: json({
77
- name: getWorkspacePackageName({ packageScope: plan.packageScope, workspacePlan }),
78
- version: '0.0.0',
79
- private: true,
80
- type: 'module',
81
- main: workspacePlan.kind === 'lambda' ? 'server.js' : 'index.js',
82
- ...(Object.keys(dependencies).length > 0 ? { dependencies } : {}),
83
- }),
84
- },
85
- ...(isApiWorkspace(workspacePlan)
86
- ? createApiWorkspaceFiles(plan, workspacePlan)
87
- : [
88
- {
89
- path: `${workspacePath}/index.ts`,
90
- content: 'export type WorkspaceName = string;\n',
91
- },
92
- {
93
- path: `${workspacePath}/${workspacePlan.name}.test.ts`,
94
- content: "import { describe, expect, it } from '@jest/globals';\n\ndescribe('workspace', () => {\n it('has a test harness', () => {\n expect(true).toBe(true);\n });\n});\n",
95
- },
96
- ]),
97
- ];
98
- };
@@ -1,6 +0,0 @@
1
- import { CreateApiPlan, GetApiRuntimeFromPreset, GetDefaultApiStyleFromPreset, GetFeaturesFromApiPlan, IsApiPreset } from './types.js';
2
- export declare const isApiPreset: IsApiPreset;
3
- export declare const getApiRuntimeFromPreset: GetApiRuntimeFromPreset;
4
- export declare const getDefaultApiStyleFromPreset: GetDefaultApiStyleFromPreset;
5
- export declare const getFeaturesFromApiPlan: GetFeaturesFromApiPlan;
6
- export declare const createApiPlan: CreateApiPlan;
@@ -1,44 +0,0 @@
1
- const apiPresets = [
2
- 'api',
3
- 'fullstack',
4
- 'mfe',
5
- ];
6
- export const isApiPreset = (preset) => apiPresets.includes(preset);
7
- export const getApiRuntimeFromPreset = () => 'docker';
8
- export const getDefaultApiStyleFromPreset = () => 'rest';
9
- export const getFeaturesFromApiPlan = (api) => {
10
- if (!api) {
11
- return [];
12
- }
13
- return api.style === 'rest' ? ['rest-api'] : ['graphql-api'];
14
- };
15
- export const createApiPlan = ({ preset, runtime = getApiRuntimeFromPreset(preset), style = getDefaultApiStyleFromPreset(preset), }) => {
16
- if (!isApiPreset(preset)) {
17
- return undefined;
18
- }
19
- const basePlan = {
20
- enabled: true,
21
- style,
22
- runtime,
23
- };
24
- const restPlan = {
25
- rest: {
26
- router: 'vyriy-router',
27
- packageName: '@vyriy/router',
28
- },
29
- };
30
- const graphqlPlan = {
31
- graphql: {
32
- packageName: 'graphql',
33
- },
34
- };
35
- return style === 'rest'
36
- ? {
37
- ...basePlan,
38
- ...restPlan,
39
- }
40
- : {
41
- ...basePlan,
42
- ...graphqlPlan,
43
- };
44
- };
@@ -1,2 +0,0 @@
1
- export * from './api.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './api.js';
@@ -1,11 +0,0 @@
1
- import { VyriyApiPlan, VyriyApiRuntime, VyriyApiStyle, VyriyFeature, VyriyPreset } from '../types.js';
2
- export type CreateApiPlanOptions = {
3
- readonly preset: VyriyPreset;
4
- readonly runtime?: VyriyApiRuntime;
5
- readonly style?: VyriyApiStyle;
6
- };
7
- export type CreateApiPlan = (options: CreateApiPlanOptions) => VyriyApiPlan | undefined;
8
- export type IsApiPreset = (preset: VyriyPreset) => boolean;
9
- export type GetApiRuntimeFromPreset = (preset: VyriyPreset) => VyriyApiRuntime;
10
- export type GetDefaultApiStyleFromPreset = (preset: VyriyPreset) => VyriyApiStyle;
11
- export type GetFeaturesFromApiPlan = (api: VyriyApiPlan | undefined) => VyriyFeature[];
@@ -1,3 +0,0 @@
1
- import { CreateCiPlan } from './types.js';
2
- export declare const defaultValidationPipelines: readonly ["install", "lint", "test", "build", "deploy", "smoke", "e2e"];
3
- export declare const createCiPlan: CreateCiPlan;
@@ -1,20 +0,0 @@
1
- export const defaultValidationPipelines = [
2
- 'install',
3
- 'lint',
4
- 'test',
5
- 'build',
6
- 'deploy',
7
- 'smoke',
8
- 'e2e',
9
- ];
10
- export const createCiPlan = ({ provider = 'none' } = {}) => provider === 'none'
11
- ? {
12
- enabled: false,
13
- providers: [],
14
- pipelines: [],
15
- }
16
- : {
17
- enabled: true,
18
- providers: [provider],
19
- pipelines: [...defaultValidationPipelines],
20
- };
@@ -1,2 +0,0 @@
1
- export * from './ci.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './ci.js';
@@ -1,6 +0,0 @@
1
- import { VyriyCiPlan, VyriyCiProvider } from '../types.js';
2
- export type VyriyCiPromptProvider = 'none' | VyriyCiProvider;
3
- export type CreateCiPlanOptions = {
4
- readonly provider?: VyriyCiPromptProvider;
5
- };
6
- export type CreateCiPlan = (options?: CreateCiPlanOptions) => VyriyCiPlan;
@@ -1,2 +0,0 @@
1
- import { CreateProjectPlanFromPreset } from './types.js';
2
- export declare const createProjectPlanFromPreset: CreateProjectPlanFromPreset;
@@ -1,129 +0,0 @@
1
- import { createApiPlan, getFeaturesFromApiPlan } from '../api/index.js';
2
- import { createCiPlan } from '../ci/index.js';
3
- import { getProjectKindFromPreset } from '../kind/index.js';
4
- const baseFeatures = [
5
- 'typescript',
6
- 'eslint',
7
- 'prettier',
8
- 'jest',
9
- 'storybook',
10
- ];
11
- const presetFeatures = {
12
- empty: [],
13
- library: ['react'],
14
- api: [],
15
- csr: ['react', 'webpack'],
16
- ssr: ['react', 'webpack'],
17
- ssg: ['react', 'webpack'],
18
- fullstack: ['react', 'webpack'],
19
- mfe: ['react', 'webpack', 'openmfe'],
20
- };
21
- const packagePlans = {
22
- empty: [],
23
- library: [{ name: 'ui', kind: 'ui', publishable: true }],
24
- api: [{ name: 'api', kind: 'api', publishable: false }],
25
- csr: [
26
- { name: 'app', kind: 'app', publishable: false },
27
- { name: 'ui', kind: 'ui', publishable: true },
28
- ],
29
- ssr: [
30
- { name: 'app', kind: 'app', publishable: false },
31
- { name: 'ui', kind: 'ui', publishable: true },
32
- { name: 'ssr', kind: 'app', publishable: false },
33
- ],
34
- ssg: [
35
- { name: 'app', kind: 'app', publishable: false },
36
- { name: 'ui', kind: 'ui', publishable: true },
37
- { name: 'ssg', kind: 'app', publishable: false },
38
- { name: 'content', kind: 'utils', publishable: false },
39
- ],
40
- fullstack: [
41
- { name: 'app', kind: 'app', publishable: false },
42
- { name: 'ui', kind: 'ui', publishable: true },
43
- { name: 'api', kind: 'api', publishable: false },
44
- ],
45
- mfe: [
46
- { name: 'mfe', kind: 'app', publishable: false },
47
- { name: 'ui', kind: 'ui', publishable: true },
48
- { name: 'api', kind: 'api', publishable: false },
49
- { name: 'openmfe-contract', kind: 'config', publishable: true },
50
- ],
51
- };
52
- const workspacePlans = {
53
- empty: [],
54
- library: [],
55
- api: [{ name: 'api', kind: 'api' }],
56
- csr: [{ name: 'web', kind: 'ui' }],
57
- ssr: [
58
- { name: 'ssr', kind: 'ui' },
59
- { name: 'web', kind: 'ui' },
60
- ],
61
- ssg: [
62
- { name: 'ssg', kind: 'ui' },
63
- { name: 'web', kind: 'ui' },
64
- ],
65
- fullstack: [
66
- { name: 'web', kind: 'ui' },
67
- { name: 'api', kind: 'api' },
68
- ],
69
- mfe: [
70
- { name: 'mfe', kind: 'ui' },
71
- { name: 'api', kind: 'api' },
72
- ],
73
- };
74
- const uniqueFeatures = (features) => [...new Set(features)];
75
- const getApiRuntimeFromFeatures = (features) => features.includes('lambda') ? 'lambda' : 'docker';
76
- const awsInfrastructureFeatures = [
77
- 'aws-cdk',
78
- 'lambda',
79
- 'fargate',
80
- 's3',
81
- 'cloudfront',
82
- ];
83
- const getApiWorkspaceKindFromFeatures = (features) => {
84
- if (features.includes('lambda')) {
85
- return 'lambda';
86
- }
87
- if (features.includes('fargate')) {
88
- return 'fargate';
89
- }
90
- return 'api';
91
- };
92
- const createWorkspacePlans = ({ features, preset, }) => {
93
- const apiWorkspaceKind = getApiWorkspaceKindFromFeatures(features);
94
- const workspaces = workspacePlans[preset].map((workspacePlan) => workspacePlan.name === 'api'
95
- ? {
96
- ...workspacePlan,
97
- kind: apiWorkspaceKind,
98
- }
99
- : workspacePlan);
100
- if (features.some((feature) => awsInfrastructureFeatures.includes(feature))) {
101
- return [
102
- ...workspaces,
103
- { name: 'stack', kind: 'stack' },
104
- ];
105
- }
106
- return workspaces;
107
- };
108
- export const createProjectPlanFromPreset = ({ description, apiStyle, ciProvider, features = [], packageScope, preset, projectName, targetDirectory, }) => {
109
- const api = createApiPlan({ preset, runtime: getApiRuntimeFromFeatures(features), style: apiStyle });
110
- const apiFeatures = getFeaturesFromApiPlan(api);
111
- return {
112
- projectName,
113
- targetDirectory,
114
- packageScope,
115
- description,
116
- preset,
117
- projectKind: getProjectKindFromPreset(preset),
118
- features: uniqueFeatures([
119
- ...baseFeatures,
120
- ...presetFeatures[preset],
121
- ...apiFeatures,
122
- ...features,
123
- ]),
124
- packages: [...packagePlans[preset]],
125
- workspaces: createWorkspacePlans({ features, preset }),
126
- ci: createCiPlan({ provider: ciProvider }),
127
- ...(api ? { api } : {}),
128
- };
129
- };
@@ -1,2 +0,0 @@
1
- export * from './create.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './create.js';
@@ -1,13 +0,0 @@
1
- import { VyriyApiStyle, VyriyFeature, VyriyPreset, VyriyProjectPlan } from '../types.js';
2
- import { VyriyCiPromptProvider } from '../ci/index.js';
3
- export type CreateProjectPlanFromPresetOptions = {
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 CreateProjectPlanFromPreset = (options: CreateProjectPlanFromPresetOptions) => VyriyProjectPlan;
@@ -1,6 +0,0 @@
1
- export * from './api/index.js';
2
- export * from './ci/index.js';
3
- export * from './create/index.js';
4
- export * from './kind/index.js';
5
- export * from './print/index.js';
6
- export type * from './types.js';
@@ -1,5 +0,0 @@
1
- export * from './api/index.js';
2
- export * from './ci/index.js';
3
- export * from './create/index.js';
4
- export * from './kind/index.js';
5
- export * from './print/index.js';
@@ -1,2 +0,0 @@
1
- export * from './kind.js';
2
- export type * from './types.js';
@@ -1 +0,0 @@
1
- export * from './kind.js';