vyriy 0.3.4 → 0.3.8
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 +46 -21
- package/cli/args/args.js +4 -0
- package/cli/args/types.d.ts +4 -0
- package/cli/cli.js +13 -2
- package/commands/new/new.js +77 -6
- package/commands/new/types.d.ts +2 -0
- package/package.json +21 -1
- package/presets/agentsTemplate.d.ts +1 -0
- package/presets/agentsTemplate.js +105 -0
- package/presets/createProjectFiles.js +374 -18
- package/project-plan/api/api.js +5 -17
- package/project-plan/api/types.d.ts +1 -0
- package/project-plan/ci/ci.d.ts +1 -1
- package/project-plan/ci/ci.js +3 -2
- package/project-plan/create/create.js +70 -74
- package/project-plan/kind/kind.js +1 -16
- package/project-plan/types.d.ts +8 -8
- package/prompts/project-plan/project-plan.js +87 -25
- package/shared/index.d.ts +1 -0
- package/shared/index.js +1 -0
- package/shared/runCommand.d.ts +9 -0
- package/shared/runCommand.js +34 -0
- package/shared/types.d.ts +7 -0
|
@@ -1,52 +1,408 @@
|
|
|
1
|
+
import { agentsTemplate } from './agentsTemplate.js';
|
|
2
|
+
import rootPackageJson from '../../../package.json' with { type: 'json' };
|
|
1
3
|
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
2
|
-
const
|
|
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, }) => ({
|
|
3
26
|
path: 'package.json',
|
|
4
27
|
content: json({
|
|
5
28
|
name: `${packageScope}/${projectName}`,
|
|
6
|
-
version: '0.
|
|
29
|
+
version: '0.0.0',
|
|
7
30
|
description,
|
|
8
31
|
private: true,
|
|
9
32
|
type: 'module',
|
|
10
|
-
packageManager:
|
|
33
|
+
packageManager: rootPackageJson.packageManager,
|
|
11
34
|
engines: {
|
|
12
|
-
node:
|
|
35
|
+
node: rootPackageJson.engines.node,
|
|
13
36
|
},
|
|
37
|
+
workspaces: [
|
|
38
|
+
'packages/*',
|
|
39
|
+
'workspaces/*',
|
|
40
|
+
],
|
|
14
41
|
scripts: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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',
|
|
18
58
|
},
|
|
19
|
-
devDependencies: {
|
|
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',
|
|
20
73
|
}),
|
|
21
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';
|
|
22
212
|
export const createProjectFiles = (plan) => [
|
|
23
|
-
|
|
213
|
+
createRootPackageJson({
|
|
214
|
+
...plan,
|
|
215
|
+
stylelint: shouldCreateStylelintConfig(plan),
|
|
216
|
+
}),
|
|
24
217
|
{
|
|
25
218
|
path: 'README.md',
|
|
26
219
|
content: `# ${plan.projectName}\n\n${plan.description}\n`,
|
|
27
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
|
+
},
|
|
28
231
|
{
|
|
29
232
|
path: 'AGENTS.md',
|
|
30
|
-
content:
|
|
233
|
+
content: agentsTemplate,
|
|
31
234
|
},
|
|
32
235
|
{
|
|
33
236
|
path: '.editorconfig',
|
|
34
|
-
content:
|
|
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`,
|
|
35
271
|
},
|
|
36
272
|
{
|
|
37
273
|
path: '.gitignore',
|
|
38
|
-
content:
|
|
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",
|
|
39
368
|
},
|
|
40
369
|
{
|
|
41
|
-
path: '
|
|
42
|
-
content:
|
|
370
|
+
path: '.prettierignore',
|
|
371
|
+
content: 'node_modules\ndist\ncoverage\nstorybook-static\n',
|
|
43
372
|
},
|
|
44
373
|
{
|
|
45
|
-
path: '
|
|
46
|
-
content: "
|
|
374
|
+
path: 'eslint.config.ts',
|
|
375
|
+
content: "export { default } from '@vyriy/eslint-config';\n",
|
|
47
376
|
},
|
|
48
377
|
{
|
|
49
|
-
path: '
|
|
50
|
-
content:
|
|
378
|
+
path: 'jest.config.ts',
|
|
379
|
+
content: "export { default } from '@vyriy/jest-config';\n",
|
|
51
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)),
|
|
52
408
|
];
|
package/project-plan/api/api.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
const apiPresets = [
|
|
2
2
|
'api',
|
|
3
3
|
'fullstack',
|
|
4
|
-
'mfe
|
|
5
|
-
'openmfe-bff',
|
|
6
|
-
'aws-serverless',
|
|
4
|
+
'mfe',
|
|
7
5
|
];
|
|
8
6
|
export const isApiPreset = (preset) => apiPresets.includes(preset);
|
|
9
|
-
export const getApiRuntimeFromPreset = (
|
|
10
|
-
export const getDefaultApiStyleFromPreset = (
|
|
7
|
+
export const getApiRuntimeFromPreset = () => 'docker';
|
|
8
|
+
export const getDefaultApiStyleFromPreset = () => 'rest';
|
|
11
9
|
export const getFeaturesFromApiPlan = (api) => {
|
|
12
10
|
if (!api) {
|
|
13
11
|
return [];
|
|
14
12
|
}
|
|
15
|
-
if (api.style === 'mixed') {
|
|
16
|
-
return ['rest-api', 'graphql-api'];
|
|
17
|
-
}
|
|
18
13
|
return api.style === 'rest' ? ['rest-api'] : ['graphql-api'];
|
|
19
14
|
};
|
|
20
|
-
export const createApiPlan = ({ preset, style = getDefaultApiStyleFromPreset(preset) }) => {
|
|
15
|
+
export const createApiPlan = ({ preset, runtime = getApiRuntimeFromPreset(preset), style = getDefaultApiStyleFromPreset(preset), }) => {
|
|
21
16
|
if (!isApiPreset(preset)) {
|
|
22
17
|
return undefined;
|
|
23
18
|
}
|
|
24
19
|
const basePlan = {
|
|
25
20
|
enabled: true,
|
|
26
21
|
style,
|
|
27
|
-
runtime
|
|
22
|
+
runtime,
|
|
28
23
|
};
|
|
29
24
|
const restPlan = {
|
|
30
25
|
rest: {
|
|
@@ -37,13 +32,6 @@ export const createApiPlan = ({ preset, style = getDefaultApiStyleFromPreset(pre
|
|
|
37
32
|
packageName: 'graphql',
|
|
38
33
|
},
|
|
39
34
|
};
|
|
40
|
-
if (style === 'mixed') {
|
|
41
|
-
return {
|
|
42
|
-
...basePlan,
|
|
43
|
-
...restPlan,
|
|
44
|
-
...graphqlPlan,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
35
|
return style === 'rest'
|
|
48
36
|
? {
|
|
49
37
|
...basePlan,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VyriyApiPlan, VyriyApiRuntime, VyriyApiStyle, VyriyFeature, VyriyPreset } from '../types.js';
|
|
2
2
|
export type CreateApiPlanOptions = {
|
|
3
3
|
readonly preset: VyriyPreset;
|
|
4
|
+
readonly runtime?: VyriyApiRuntime;
|
|
4
5
|
readonly style?: VyriyApiStyle;
|
|
5
6
|
};
|
|
6
7
|
export type CreateApiPlan = (options: CreateApiPlanOptions) => VyriyApiPlan | undefined;
|
package/project-plan/ci/ci.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CreateCiPlan } from './types.js';
|
|
2
|
-
export declare const defaultValidationPipelines: readonly ["install", "
|
|
2
|
+
export declare const defaultValidationPipelines: readonly ["install", "lint", "test", "build", "deploy", "smoke", "e2e"];
|
|
3
3
|
export declare const createCiPlan: CreateCiPlan;
|
package/project-plan/ci/ci.js
CHANGED