vyriy 0.3.8 → 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.
- package/README.md +74 -172
- package/bin/vyriy.js +2 -2
- package/cli/args.js +29 -0
- package/cli/cli.d.ts +2 -2
- package/cli/cli.js +18 -64
- package/cli/index.d.ts +1 -1
- package/cli/index.js +1 -1
- package/cli/types.d.ts +12 -3
- package/commands/check-env.d.ts +2 -0
- package/commands/check-env.js +65 -0
- package/commands/create/index.d.ts +2 -0
- package/commands/create/index.js +121 -0
- package/commands/create/plan/index.d.ts +4 -0
- package/commands/create/plan/index.js +3 -0
- package/commands/create/plan/plan.d.ts +9 -0
- package/commands/create/plan/plan.js +34 -0
- package/commands/create/plan/question.d.ts +2 -0
- package/commands/create/plan/question.js +25 -0
- package/commands/create/plan/types.d.ts +14 -0
- package/commands/create/preset/api.d.ts +2 -0
- package/commands/create/preset/api.js +16 -0
- package/commands/create/preset/base.d.ts +2 -0
- package/commands/create/preset/base.js +195 -0
- package/commands/create/preset/gql.d.ts +2 -0
- package/commands/create/preset/gql.js +16 -0
- package/commands/create/preset/index.d.ts +12 -0
- package/commands/create/preset/index.js +14 -0
- package/commands/create/preset/library.d.ts +2 -0
- package/commands/create/preset/library.js +227 -0
- package/commands/create/preset/mfe.d.ts +2 -0
- package/commands/create/preset/mfe.js +16 -0
- package/commands/create/preset/rest.d.ts +2 -0
- package/commands/create/preset/rest.js +16 -0
- package/commands/create/preset/spa.d.ts +2 -0
- package/commands/create/preset/spa.js +16 -0
- package/commands/create/preset/ssg.d.ts +2 -0
- package/commands/create/preset/ssg.js +16 -0
- package/commands/create/preset/ssr.d.ts +2 -0
- package/commands/create/preset/ssr.js +16 -0
- package/commands/create/preset/types.d.ts +15 -0
- package/commands/create/prompt/conflict-strategy.d.ts +5 -0
- package/commands/create/prompt/conflict-strategy.js +22 -0
- package/commands/create/prompt/index.d.ts +7 -0
- package/commands/create/prompt/index.js +6 -0
- package/commands/create/prompt/preset.d.ts +4 -0
- package/commands/create/prompt/preset.js +11 -0
- package/commands/create/prompt/prompt.d.ts +2 -0
- package/commands/create/prompt/prompt.js +4 -0
- package/commands/create/prompt/provider.d.ts +2 -0
- package/commands/create/prompt/provider.js +13 -0
- package/commands/create/prompt/resolve-option.d.ts +6 -0
- package/commands/create/prompt/resolve-option.js +8 -0
- package/commands/create/prompt/scope.d.ts +2 -0
- package/commands/create/prompt/scope.js +2 -0
- package/commands/create/prompt/types.d.ts +4 -0
- package/commands/dist.d.ts +2 -0
- package/commands/dist.js +274 -0
- package/commands/help.d.ts +3 -0
- package/commands/help.js +24 -0
- package/commands/index.d.ts +5 -0
- package/commands/index.js +5 -0
- package/commands/types.d.ts +45 -0
- package/commands/version.d.ts +2 -0
- package/commands/version.js +6 -0
- package/package.json +341 -464
- package/checks/node/index.d.ts +0 -2
- package/checks/node/index.js +0 -1
- package/checks/node/node.d.ts +0 -2
- package/checks/node/node.js +0 -22
- package/checks/node/types.d.ts +0 -11
- package/checks/yarn/index.d.ts +0 -2
- package/checks/yarn/index.js +0 -1
- package/checks/yarn/types.d.ts +0 -7
- package/checks/yarn/yarn.d.ts +0 -2
- package/checks/yarn/yarn.js +0 -40
- package/cli/args/args.js +0 -38
- package/cli/args/index.d.ts +0 -2
- package/cli/args/index.js +0 -1
- package/cli/args/types.d.ts +0 -24
- package/commands/doctor/doctor.d.ts +0 -2
- package/commands/doctor/doctor.js +0 -9
- package/commands/doctor/index.d.ts +0 -2
- package/commands/doctor/index.js +0 -1
- package/commands/doctor/types.d.ts +0 -8
- package/commands/init/index.d.ts +0 -2
- package/commands/init/index.js +0 -1
- package/commands/init/init.d.ts +0 -2
- package/commands/init/init.js +0 -7
- package/commands/init/types.d.ts +0 -5
- package/commands/new/index.d.ts +0 -2
- package/commands/new/index.js +0 -1
- package/commands/new/new.d.ts +0 -3
- package/commands/new/new.js +0 -189
- package/commands/new/types.d.ts +0 -15
- package/doctor/checkCorepack.d.ts +0 -2
- package/doctor/checkCorepack.js +0 -24
- package/doctor/checkGit.d.ts +0 -2
- package/doctor/checkGit.js +0 -23
- package/doctor/checkNodeVersion.d.ts +0 -5
- package/doctor/checkNodeVersion.js +0 -24
- package/doctor/checkYarn.d.ts +0 -10
- package/doctor/checkYarn.js +0 -45
- package/doctor/createDoctorReport.d.ts +0 -2
- package/doctor/createDoctorReport.js +0 -17
- package/doctor/index.d.ts +0 -7
- package/doctor/index.js +0 -6
- package/doctor/printDoctorReport.d.ts +0 -2
- package/doctor/printDoctorReport.js +0 -42
- package/doctor/types.d.ts +0 -25
- package/file-plan/createFilePlan.d.ts +0 -4
- package/file-plan/createFilePlan.js +0 -29
- package/file-plan/index.d.ts +0 -4
- package/file-plan/index.js +0 -3
- package/file-plan/printFilePlan.d.ts +0 -2
- package/file-plan/printFilePlan.js +0 -44
- package/file-plan/types.d.ts +0 -12
- package/file-plan/writeFilePlan.d.ts +0 -2
- package/file-plan/writeFilePlan.js +0 -12
- package/index.d.ts +0 -11
- package/index.js +0 -11
- package/presets/agentsTemplate.d.ts +0 -1
- package/presets/agentsTemplate.js +0 -105
- package/presets/createProjectFiles.d.ts +0 -2
- package/presets/createProjectFiles.js +0 -408
- package/presets/index.d.ts +0 -2
- package/presets/index.js +0 -1
- package/presets/types.d.ts +0 -3
- package/project-plan/api/api.d.ts +0 -6
- package/project-plan/api/api.js +0 -44
- package/project-plan/api/index.d.ts +0 -2
- package/project-plan/api/index.js +0 -1
- package/project-plan/api/types.d.ts +0 -11
- package/project-plan/ci/ci.d.ts +0 -3
- package/project-plan/ci/ci.js +0 -20
- package/project-plan/ci/index.d.ts +0 -2
- package/project-plan/ci/index.js +0 -1
- package/project-plan/ci/types.d.ts +0 -6
- package/project-plan/create/create.d.ts +0 -2
- package/project-plan/create/create.js +0 -129
- package/project-plan/create/index.d.ts +0 -2
- package/project-plan/create/index.js +0 -1
- package/project-plan/create/types.d.ts +0 -13
- package/project-plan/index.d.ts +0 -6
- package/project-plan/index.js +0 -5
- package/project-plan/kind/index.d.ts +0 -2
- package/project-plan/kind/index.js +0 -1
- package/project-plan/kind/kind.d.ts +0 -2
- package/project-plan/kind/kind.js +0 -1
- package/project-plan/kind/types.d.ts +0 -2
- package/project-plan/print/index.d.ts +0 -2
- package/project-plan/print/index.js +0 -1
- package/project-plan/print/print.d.ts +0 -2
- package/project-plan/print/print.js +0 -47
- package/project-plan/print/types.d.ts +0 -2
- package/project-plan/types.d.ts +0 -46
- package/prompts/project-plan/index.d.ts +0 -2
- package/prompts/project-plan/index.js +0 -1
- package/prompts/project-plan/project-plan.d.ts +0 -2
- package/prompts/project-plan/project-plan.js +0 -194
- package/prompts/project-plan/types.d.ts +0 -18
- package/shared/commandExists.d.ts +0 -2
- package/shared/commandExists.js +0 -10
- package/shared/execCommand.d.ts +0 -2
- package/shared/execCommand.js +0 -7
- package/shared/fileExists.d.ts +0 -2
- package/shared/fileExists.js +0 -10
- package/shared/index.d.ts +0 -6
- package/shared/index.js +0 -5
- package/shared/runCommand.d.ts +0 -9
- package/shared/runCommand.js +0 -34
- package/shared/semver.d.ts +0 -1
- package/shared/semver.js +0 -4
- package/shared/types.d.ts +0 -12
- /package/cli/{args/args.d.ts → args.d.ts} +0 -0
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import { agentsTemplate } from './agentsTemplate.js';
|
|
2
|
-
import rootPackageJson from '../../../package.json' with { type: 'json' };
|
|
3
|
-
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
4
|
-
const packageVersion = (version) => `^${version}`;
|
|
5
|
-
const baseRootDevDependencies = {
|
|
6
|
-
'@vyriy/typescript-config': packageVersion(rootPackageJson.version),
|
|
7
|
-
typescript: rootPackageJson.dependencies.typescript,
|
|
8
|
-
'@vyriy/prettier-config': packageVersion(rootPackageJson.version),
|
|
9
|
-
prettier: rootPackageJson.dependencies.prettier,
|
|
10
|
-
'@vyriy/eslint-config': packageVersion(rootPackageJson.version),
|
|
11
|
-
eslint: rootPackageJson.dependencies.eslint,
|
|
12
|
-
'@vyriy/jest-config': packageVersion(rootPackageJson.version),
|
|
13
|
-
jest: rootPackageJson.dependencies.jest,
|
|
14
|
-
'@vyriy/storybook-config': packageVersion(rootPackageJson.version),
|
|
15
|
-
storybook: rootPackageJson.dependencies.storybook,
|
|
16
|
-
'@vyriy/path': packageVersion(rootPackageJson.version),
|
|
17
|
-
husky: rootPackageJson.dependencies.husky,
|
|
18
|
-
'npm-run-all2': rootPackageJson.dependencies['npm-run-all2'],
|
|
19
|
-
'cross-env': rootPackageJson.dependencies['cross-env'],
|
|
20
|
-
};
|
|
21
|
-
const stylelintDevDependencies = {
|
|
22
|
-
'@vyriy/stylelint-config': packageVersion(rootPackageJson.version),
|
|
23
|
-
stylelint: rootPackageJson.dependencies.stylelint,
|
|
24
|
-
};
|
|
25
|
-
const createRootPackageJson = ({ description, packageScope, projectName, stylelint, }) => ({
|
|
26
|
-
path: 'package.json',
|
|
27
|
-
content: json({
|
|
28
|
-
name: `${packageScope}/${projectName}`,
|
|
29
|
-
version: '0.0.0',
|
|
30
|
-
description,
|
|
31
|
-
private: true,
|
|
32
|
-
type: 'module',
|
|
33
|
-
packageManager: rootPackageJson.packageManager,
|
|
34
|
-
engines: {
|
|
35
|
-
node: rootPackageJson.engines.node,
|
|
36
|
-
},
|
|
37
|
-
workspaces: [
|
|
38
|
-
'packages/*',
|
|
39
|
-
'workspaces/*',
|
|
40
|
-
],
|
|
41
|
-
scripts: {
|
|
42
|
-
storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
|
|
43
|
-
check: 'run-s lint build test',
|
|
44
|
-
fix: "run-s 'fix:*'",
|
|
45
|
-
lint: "run-s 'lint:*'",
|
|
46
|
-
build: "run-s 'build:*'",
|
|
47
|
-
test: "run-s 'test:*'",
|
|
48
|
-
'fix:prettier': 'prettier . --write',
|
|
49
|
-
'fix:eslint': 'eslint . --fix',
|
|
50
|
-
'lint:ts': 'tsc --pretty false',
|
|
51
|
-
'lint:prettier': 'prettier . --check',
|
|
52
|
-
'lint:eslint': 'eslint .',
|
|
53
|
-
...(stylelint ? { 'lint:stylelint': 'stylelint "packages/**/*.{scss,css}"' } : {}),
|
|
54
|
-
'build:dist': 'echo "Build dist is not configured yet."',
|
|
55
|
-
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
56
|
-
'test:jest': 'jest --passWithNoTests',
|
|
57
|
-
postinstall: 'husky',
|
|
58
|
-
},
|
|
59
|
-
devDependencies: {
|
|
60
|
-
...baseRootDevDependencies,
|
|
61
|
-
...(stylelint ? stylelintDevDependencies : {}),
|
|
62
|
-
},
|
|
63
|
-
}),
|
|
64
|
-
});
|
|
65
|
-
const createPackageManifest = ({ packageScope, workspaceName, }) => ({
|
|
66
|
-
path: `packages/${workspaceName}/package.json`,
|
|
67
|
-
content: json({
|
|
68
|
-
name: `${packageScope}/${workspaceName}`,
|
|
69
|
-
version: '0.0.0',
|
|
70
|
-
private: true,
|
|
71
|
-
type: 'module',
|
|
72
|
-
main: 'index.js',
|
|
73
|
-
}),
|
|
74
|
-
});
|
|
75
|
-
const getWorkspacePath = (workspacePlan) => workspacePlan.kind === 'lambda' && workspacePlan.name === 'api'
|
|
76
|
-
? `workspaces/lambda/${workspacePlan.name}`
|
|
77
|
-
: `workspaces/${workspacePlan.name}`;
|
|
78
|
-
const getWorkspacePackageName = ({ packageScope, workspacePlan, }) => workspacePlan.kind === 'lambda' && workspacePlan.name === 'api'
|
|
79
|
-
? `${packageScope}/lambda-api-workspace`
|
|
80
|
-
: `${packageScope}/${workspacePlan.name}-workspace`;
|
|
81
|
-
const isApiWorkspace = (workspacePlan) => [
|
|
82
|
-
'api',
|
|
83
|
-
'lambda',
|
|
84
|
-
'fargate',
|
|
85
|
-
].includes(workspacePlan.kind);
|
|
86
|
-
const createApiWorkspaceDependencies = (workspacePlan) => isApiWorkspace(workspacePlan)
|
|
87
|
-
? {
|
|
88
|
-
'@vyriy/handler': packageVersion(rootPackageJson.version),
|
|
89
|
-
'@vyriy/server': packageVersion(rootPackageJson.version),
|
|
90
|
-
}
|
|
91
|
-
: {};
|
|
92
|
-
const createPackageFiles = (plan, packagePlan) => [
|
|
93
|
-
createPackageManifest({
|
|
94
|
-
packageScope: plan.packageScope,
|
|
95
|
-
workspaceName: packagePlan.name,
|
|
96
|
-
}),
|
|
97
|
-
{
|
|
98
|
-
path: `packages/${packagePlan.name}/README.md`,
|
|
99
|
-
content: `# ${plan.packageScope}/${packagePlan.name}\n\n${plan.description}\n`,
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
path: `packages/${packagePlan.name}/index.ts`,
|
|
103
|
-
content: packagePlan.kind === 'stack' ? "export * from './stack.js';\n" : "export type * from './types.js';\n",
|
|
104
|
-
},
|
|
105
|
-
...(packagePlan.kind === 'stack'
|
|
106
|
-
? [
|
|
107
|
-
{
|
|
108
|
-
path: `packages/${packagePlan.name}/stack.ts`,
|
|
109
|
-
content: 'export type StackName = string;\n',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
path: `packages/${packagePlan.name}/stack.test.ts`,
|
|
113
|
-
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",
|
|
114
|
-
},
|
|
115
|
-
]
|
|
116
|
-
: [
|
|
117
|
-
{
|
|
118
|
-
path: `packages/${packagePlan.name}/types.ts`,
|
|
119
|
-
content: 'export type PackageName = string;\n',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
path: `packages/${packagePlan.name}/${packagePlan.name}.test.ts`,
|
|
123
|
-
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",
|
|
124
|
-
},
|
|
125
|
-
]),
|
|
126
|
-
];
|
|
127
|
-
const createApiHandlerFile = (workspacePath) => ({
|
|
128
|
-
path: `${workspacePath}/handler.ts`,
|
|
129
|
-
content: `import { api } from '@vyriy/handler';
|
|
130
|
-
|
|
131
|
-
export const handler = api(async (event) => ({
|
|
132
|
-
statusCode: 200,
|
|
133
|
-
body: JSON.stringify({
|
|
134
|
-
path: event.path,
|
|
135
|
-
}),
|
|
136
|
-
}));
|
|
137
|
-
`,
|
|
138
|
-
});
|
|
139
|
-
const createApiServerFile = ({ entrypoint, workspacePath, }) => ({
|
|
140
|
-
path: `${workspacePath}/${entrypoint}`,
|
|
141
|
-
content: `import { server } from '@vyriy/server';
|
|
142
|
-
|
|
143
|
-
import { handler } from './handler.js';
|
|
144
|
-
|
|
145
|
-
server(handler);
|
|
146
|
-
`,
|
|
147
|
-
});
|
|
148
|
-
const createDockerfile = (workspacePath) => ({
|
|
149
|
-
path: `${workspacePath}/Dockerfile`,
|
|
150
|
-
content: `FROM node:24-alpine
|
|
151
|
-
|
|
152
|
-
WORKDIR /app
|
|
153
|
-
|
|
154
|
-
COPY package.json yarn.lock .yarnrc.yml ./
|
|
155
|
-
COPY .yarn ./.yarn
|
|
156
|
-
COPY packages ./packages
|
|
157
|
-
COPY workspaces ./workspaces
|
|
158
|
-
|
|
159
|
-
RUN corepack enable && yarn install --immutable
|
|
160
|
-
RUN yarn build
|
|
161
|
-
|
|
162
|
-
CMD ["node", "workspaces/api/index.js"]
|
|
163
|
-
`,
|
|
164
|
-
});
|
|
165
|
-
const createApiWorkspaceFiles = (plan, workspacePlan) => {
|
|
166
|
-
const workspacePath = getWorkspacePath(workspacePlan);
|
|
167
|
-
const isLambda = workspacePlan.kind === 'lambda';
|
|
168
|
-
return [
|
|
169
|
-
createApiHandlerFile(workspacePath),
|
|
170
|
-
createApiServerFile({ entrypoint: isLambda ? 'server.ts' : 'index.ts', workspacePath }),
|
|
171
|
-
{
|
|
172
|
-
path: `${workspacePath}/${workspacePlan.name}.test.ts`,
|
|
173
|
-
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",
|
|
174
|
-
},
|
|
175
|
-
...(plan.features.includes('docker') && !isLambda ? [createDockerfile(workspacePath)] : []),
|
|
176
|
-
];
|
|
177
|
-
};
|
|
178
|
-
const createWorkspaceFiles = (plan, workspacePlan) => {
|
|
179
|
-
const workspacePath = getWorkspacePath(workspacePlan);
|
|
180
|
-
const dependencies = createApiWorkspaceDependencies(workspacePlan);
|
|
181
|
-
return [
|
|
182
|
-
{
|
|
183
|
-
path: `${workspacePath}/package.json`,
|
|
184
|
-
content: json({
|
|
185
|
-
name: getWorkspacePackageName({ packageScope: plan.packageScope, workspacePlan }),
|
|
186
|
-
version: '0.0.0',
|
|
187
|
-
private: true,
|
|
188
|
-
type: 'module',
|
|
189
|
-
main: workspacePlan.kind === 'lambda' ? 'server.js' : 'index.js',
|
|
190
|
-
...(Object.keys(dependencies).length > 0 ? { dependencies } : {}),
|
|
191
|
-
}),
|
|
192
|
-
},
|
|
193
|
-
...(isApiWorkspace(workspacePlan)
|
|
194
|
-
? createApiWorkspaceFiles(plan, workspacePlan)
|
|
195
|
-
: [
|
|
196
|
-
{
|
|
197
|
-
path: `${workspacePath}/index.ts`,
|
|
198
|
-
content: 'export type WorkspaceName = string;\n',
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
path: `${workspacePath}/${workspacePlan.name}.test.ts`,
|
|
202
|
-
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",
|
|
203
|
-
},
|
|
204
|
-
]),
|
|
205
|
-
];
|
|
206
|
-
};
|
|
207
|
-
const shouldCreateStylelintConfig = (plan) => plan.features.some((feature) => [
|
|
208
|
-
'react',
|
|
209
|
-
'webpack',
|
|
210
|
-
].includes(feature));
|
|
211
|
-
const getStylePackageName = (plan) => plan.packages.find((packagePlan) => packagePlan.kind === 'ui')?.name ?? 'ui';
|
|
212
|
-
export const createProjectFiles = (plan) => [
|
|
213
|
-
createRootPackageJson({
|
|
214
|
-
...plan,
|
|
215
|
-
stylelint: shouldCreateStylelintConfig(plan),
|
|
216
|
-
}),
|
|
217
|
-
{
|
|
218
|
-
path: 'README.md',
|
|
219
|
-
content: `# ${plan.projectName}\n\n${plan.description}\n`,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
path: 'doc.mdx',
|
|
223
|
-
content: `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
224
|
-
import ReadMe from './README.md?raw';
|
|
225
|
-
|
|
226
|
-
<Meta title="${plan.projectName}" />
|
|
227
|
-
|
|
228
|
-
<Markdown>{ReadMe}</Markdown>
|
|
229
|
-
`,
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
path: 'AGENTS.md',
|
|
233
|
-
content: agentsTemplate,
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
path: '.editorconfig',
|
|
237
|
-
content: `# https://editorconfig.org
|
|
238
|
-
root = true
|
|
239
|
-
|
|
240
|
-
[*]
|
|
241
|
-
charset = utf-8
|
|
242
|
-
end_of_line = lf
|
|
243
|
-
insert_final_newline = true
|
|
244
|
-
trim_trailing_whitespace = true
|
|
245
|
-
|
|
246
|
-
indent_style = space
|
|
247
|
-
indent_size = 2
|
|
248
|
-
|
|
249
|
-
max_line_length = 100
|
|
250
|
-
|
|
251
|
-
# Markdown
|
|
252
|
-
[*.md]
|
|
253
|
-
trim_trailing_whitespace = false
|
|
254
|
-
max_line_length = off
|
|
255
|
-
|
|
256
|
-
# YAML / YML
|
|
257
|
-
[*.{yml,yaml}]
|
|
258
|
-
indent_size = 2
|
|
259
|
-
|
|
260
|
-
# JSON
|
|
261
|
-
[*.json]
|
|
262
|
-
indent_size = 2
|
|
263
|
-
|
|
264
|
-
# TypeScript / JavaScript
|
|
265
|
-
[*.{ts,tsx,js,jsx}]
|
|
266
|
-
indent_size = 2
|
|
267
|
-
|
|
268
|
-
# Shell / Bash
|
|
269
|
-
[*.sh]
|
|
270
|
-
indent_size = 2`,
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
path: '.gitignore',
|
|
274
|
-
content: `.yarn/*
|
|
275
|
-
!.yarn/cache
|
|
276
|
-
!.yarn/patches
|
|
277
|
-
!.yarn/plugins
|
|
278
|
-
!.yarn/releases
|
|
279
|
-
!.yarn/sdks
|
|
280
|
-
!.yarn/versions
|
|
281
|
-
|
|
282
|
-
.DS_Store
|
|
283
|
-
.idea
|
|
284
|
-
node_modules
|
|
285
|
-
coverage
|
|
286
|
-
dist
|
|
287
|
-
storybook-static
|
|
288
|
-
*storybook.log
|
|
289
|
-
consumer
|
|
290
|
-
|
|
291
|
-
cdk.out
|
|
292
|
-
cdk.context.json
|
|
293
|
-
|
|
294
|
-
!/**/.gitkeep`,
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
path: '.npmrc',
|
|
298
|
-
content: 'engine-strict=true\n',
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
path: '.nvmrc',
|
|
302
|
-
content: 'lts/krypton',
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
path: '.yarnrc.yml',
|
|
306
|
-
content: 'nodeLinker: node-modules\n',
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
path: '.husky/commit-msg',
|
|
310
|
-
content: '#!/bin/sh\n',
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
path: '.husky/post-checkout',
|
|
314
|
-
content: '#!/bin/sh\n\nyarn\n',
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
path: '.husky/post-merge',
|
|
318
|
-
content: '#!/bin/sh\n\nyarn\n',
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
path: '.husky/pre-commit',
|
|
322
|
-
content: '#!/bin/sh\n\nyarn check\n',
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
path: '.husky/pre-push',
|
|
326
|
-
content: '#!/bin/sh\n\nyarn check\n',
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
path: '.storybook/main.ts',
|
|
330
|
-
content: `import config from '@vyriy/storybook-config';
|
|
331
|
-
import { path } from '@vyriy/path';
|
|
332
|
-
|
|
333
|
-
export default {
|
|
334
|
-
...config,
|
|
335
|
-
stories: [
|
|
336
|
-
path('**/*.mdx'),
|
|
337
|
-
path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
|
|
338
|
-
],
|
|
339
|
-
};
|
|
340
|
-
`,
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
path: '.storybook/preview.tsx',
|
|
344
|
-
content: "export { default } from '@vyriy/storybook-config/preview';\n",
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
path: 'yarn.lock',
|
|
348
|
-
content: '',
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
path: 'tsconfig.json',
|
|
352
|
-
content: json({
|
|
353
|
-
extends: '@vyriy/typescript-config/index.json',
|
|
354
|
-
include: [
|
|
355
|
-
'.storybook/**/*.ts',
|
|
356
|
-
'.storybook/**/*.tsx',
|
|
357
|
-
'packages/**/*.ts',
|
|
358
|
-
'packages/**/*.tsx',
|
|
359
|
-
'workspaces/**/*.ts',
|
|
360
|
-
'workspaces/**/*.tsx',
|
|
361
|
-
'*.ts',
|
|
362
|
-
],
|
|
363
|
-
}),
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
path: 'prettier.config.ts',
|
|
367
|
-
content: "export { default } from '@vyriy/prettier-config';\n",
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
path: '.prettierignore',
|
|
371
|
-
content: 'node_modules\ndist\ncoverage\nstorybook-static\n',
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
path: 'eslint.config.ts',
|
|
375
|
-
content: "export { default } from '@vyriy/eslint-config';\n",
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
path: 'jest.config.ts',
|
|
379
|
-
content: "export { default } from '@vyriy/jest-config';\n",
|
|
380
|
-
},
|
|
381
|
-
...(shouldCreateStylelintConfig(plan)
|
|
382
|
-
? [
|
|
383
|
-
{
|
|
384
|
-
path: 'stylelint.config.ts',
|
|
385
|
-
content: "export { default } from '@vyriy/stylelint-config';\n",
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
path: `packages/${getStylePackageName(plan)}/reset.scss`,
|
|
389
|
-
content: `html {
|
|
390
|
-
box-sizing: border-box;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
*,
|
|
394
|
-
*::before,
|
|
395
|
-
*::after {
|
|
396
|
-
box-sizing: inherit;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
body {
|
|
400
|
-
margin: 0;
|
|
401
|
-
}
|
|
402
|
-
`,
|
|
403
|
-
},
|
|
404
|
-
]
|
|
405
|
-
: []),
|
|
406
|
-
...plan.packages.flatMap((packagePlan) => createPackageFiles(plan, packagePlan)),
|
|
407
|
-
...plan.workspaces.flatMap((workspacePlan) => createWorkspaceFiles(plan, workspacePlan)),
|
|
408
|
-
];
|
package/presets/index.d.ts
DELETED
package/presets/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './createProjectFiles.js';
|
package/presets/types.d.ts
DELETED
|
@@ -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;
|
package/project-plan/api/api.js
DELETED
|
@@ -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 +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[];
|
package/project-plan/ci/ci.d.ts
DELETED
package/project-plan/ci/ci.js
DELETED
|
@@ -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
|
-
};
|
package/project-plan/ci/index.js
DELETED
|
@@ -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,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 +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;
|