vyriy 0.5.1 → 0.5.3

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 (70) hide show
  1. package/README.md +23 -12
  2. package/args.js +40 -0
  3. package/bin/vyriy.js +1 -1
  4. package/cli.js +67 -0
  5. package/package.json +51 -6
  6. package/{cli/types.d.ts → types.d.ts} +7 -1
  7. package/cli/args.js +0 -29
  8. package/cli/cli.js +0 -28
  9. package/commands/check-env.d.ts +0 -2
  10. package/commands/check-env.js +0 -120
  11. package/commands/create/index.d.ts +0 -2
  12. package/commands/create/index.js +0 -135
  13. package/commands/create/plan/index.d.ts +0 -4
  14. package/commands/create/plan/index.js +0 -3
  15. package/commands/create/plan/plan.d.ts +0 -9
  16. package/commands/create/plan/plan.js +0 -34
  17. package/commands/create/plan/question.d.ts +0 -2
  18. package/commands/create/plan/question.js +0 -25
  19. package/commands/create/plan/types.d.ts +0 -14
  20. package/commands/create/preset/api.d.ts +0 -2
  21. package/commands/create/preset/api.js +0 -69
  22. package/commands/create/preset/base.d.ts +0 -2
  23. package/commands/create/preset/base.js +0 -195
  24. package/commands/create/preset/gql.d.ts +0 -2
  25. package/commands/create/preset/gql.js +0 -750
  26. package/commands/create/preset/index.d.ts +0 -47
  27. package/commands/create/preset/index.js +0 -56
  28. package/commands/create/preset/library.d.ts +0 -2
  29. package/commands/create/preset/library.js +0 -253
  30. package/commands/create/preset/mfe.d.ts +0 -2
  31. package/commands/create/preset/mfe.js +0 -333
  32. package/commands/create/preset/rest.d.ts +0 -2
  33. package/commands/create/preset/rest.js +0 -248
  34. package/commands/create/preset/shared.d.ts +0 -116
  35. package/commands/create/preset/shared.js +0 -245
  36. package/commands/create/preset/spa.d.ts +0 -2
  37. package/commands/create/preset/spa.js +0 -138
  38. package/commands/create/preset/ssg.d.ts +0 -2
  39. package/commands/create/preset/ssg.js +0 -177
  40. package/commands/create/preset/ssr.d.ts +0 -2
  41. package/commands/create/preset/ssr.js +0 -185
  42. package/commands/create/preset/types.d.ts +0 -15
  43. package/commands/create/prompt/conflict-strategy.d.ts +0 -5
  44. package/commands/create/prompt/conflict-strategy.js +0 -22
  45. package/commands/create/prompt/index.d.ts +0 -7
  46. package/commands/create/prompt/index.js +0 -6
  47. package/commands/create/prompt/preset.d.ts +0 -4
  48. package/commands/create/prompt/preset.js +0 -11
  49. package/commands/create/prompt/prompt.d.ts +0 -2
  50. package/commands/create/prompt/prompt.js +0 -4
  51. package/commands/create/prompt/provider.d.ts +0 -2
  52. package/commands/create/prompt/provider.js +0 -13
  53. package/commands/create/prompt/resolve-option.d.ts +0 -6
  54. package/commands/create/prompt/resolve-option.js +0 -8
  55. package/commands/create/prompt/scope.d.ts +0 -2
  56. package/commands/create/prompt/scope.js +0 -2
  57. package/commands/create/prompt/types.d.ts +0 -4
  58. package/commands/dist.d.ts +0 -2
  59. package/commands/dist.js +0 -287
  60. package/commands/help.d.ts +0 -3
  61. package/commands/help.js +0 -24
  62. package/commands/index.d.ts +0 -5
  63. package/commands/index.js +0 -5
  64. package/commands/types.d.ts +0 -44
  65. package/commands/version.d.ts +0 -2
  66. package/commands/version.js +0 -6
  67. /package/{cli/args.d.ts → args.d.ts} +0 -0
  68. /package/{cli/cli.d.ts → cli.d.ts} +0 -0
  69. /package/{cli/index.d.ts → index.d.ts} +0 -0
  70. /package/{cli/index.js → index.js} +0 -0
package/README.md CHANGED
@@ -25,22 +25,18 @@ yarn global add vyriy
25
25
  ## Usage
26
26
 
27
27
  ```bash
28
- vyriy [name] Create a new Vyriy project
29
- vyriy . Initialise a new Vyriy project in the current directory
28
+ vyriy create [name] Create a new Vyriy project
29
+ vyriy create . Initialise a new Vyriy project in the current directory
30
+ vyriy dist Prepare dist package metadata without publishing to npm
31
+ vyriy static [dir] Serve a static directory (defaults to dist)
32
+ vyriy check Check local environment (Node.js and Yarn versions)
30
33
  vyriy --help, -h Show help
31
34
  vyriy --version, -v Show version
32
- vyriy --check-env, -c Check local environment (Node.js and Yarn versions)
33
- vyriy --dist, -d Prepare dist package metadata without publishing to npm
34
- vyriy --dry-run Print the merged file plan without writing project files
35
- vyriy --overwrite Overwrite existing generated paths
36
- vyriy --skip-existing Leave existing generated paths untouched
37
- vyriy --no-install Create files without installing dependencies
38
- vyriy --no-verify Install dependencies without running checks
39
35
  ```
40
36
 
41
37
  ## Commands
42
38
 
43
- ### `create` (default)
39
+ ### `create`
44
40
 
45
41
  The interactive wizard collects project details and writes the scaffold:
46
42
 
@@ -60,12 +56,22 @@ When generated paths already exist, use `--overwrite` or `--skip-existing` to
60
56
  avoid the interactive conflict prompt. Without either flag, `vyriy` asks whether
61
57
  to overwrite existing files, skip them, or abort.
62
58
 
63
- ### `--check-env`
59
+ Create options:
60
+
61
+ ```bash
62
+ vyriy create --dry-run Print the merged file plan without writing project files
63
+ vyriy create --overwrite Overwrite existing generated paths
64
+ vyriy create --skip-existing Leave existing generated paths untouched
65
+ vyriy create --no-install Create files without installing dependencies
66
+ vyriy create --no-verify Install dependencies without running checks
67
+ ```
68
+
69
+ ### `check`
64
70
 
65
71
  Validates Node.js and Yarn versions against the engine requirements declared in
66
72
  `package.json`.
67
73
 
68
- ### `--dist`
74
+ ### `dist`
69
75
 
70
76
  Prepares every package inside the `dist/` directory for npm publishing:
71
77
 
@@ -74,6 +80,11 @@ Prepares every package inside the `dist/` directory for npm publishing:
74
80
  - Copies README, LICENSE, and AGENTS.md
75
81
  - Makes bin files executable
76
82
 
83
+ ### `static`
84
+
85
+ Starts the static server command. The implementation is currently a placeholder
86
+ while `@vyriy/static` grows the reusable server helpers.
87
+
77
88
  ## Presets
78
89
 
79
90
  Registered presets:
package/args.js ADDED
@@ -0,0 +1,40 @@
1
+ export const parseArgs = (args) => {
2
+ if (args.includes('--help') || args.includes('-h')) {
3
+ return { type: 'help' };
4
+ }
5
+ if (args.includes('--version') || args.includes('-v')) {
6
+ return { type: 'version' };
7
+ }
8
+ const [command = '', ...commandArgs] = args;
9
+ if (!command) {
10
+ return { type: 'help' };
11
+ }
12
+ if (command === 'dist') {
13
+ return { type: 'dist' };
14
+ }
15
+ if (command === 'check') {
16
+ return { type: 'check' };
17
+ }
18
+ if (command === 'static') {
19
+ const directory = commandArgs.find((arg) => !arg.startsWith('-')) ?? 'dist';
20
+ return { type: 'static', directory };
21
+ }
22
+ if (command !== 'create') {
23
+ return { type: 'unknown', command };
24
+ }
25
+ const dryRun = commandArgs.includes('--dry-run');
26
+ const overwrite = commandArgs.includes('--overwrite');
27
+ const skipExisting = commandArgs.includes('--skip-existing');
28
+ const install = !commandArgs.includes('--no-install');
29
+ const verify = install && !commandArgs.includes('--no-verify');
30
+ const directory = commandArgs.find((arg) => !arg.startsWith('-')) ?? '';
31
+ return {
32
+ type: 'create',
33
+ directory,
34
+ dryRun,
35
+ overwrite,
36
+ skipExisting,
37
+ install,
38
+ verify,
39
+ };
40
+ };
package/bin/vyriy.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { cli } from '../cli/index.js';
2
+ import { cli } from '../index.js';
3
3
  await cli(process.argv.slice(2));
package/cli.js ADDED
@@ -0,0 +1,67 @@
1
+ import { parseArgs } from './args.js';
2
+ import packageJson from './package.json' with { type: 'json' };
3
+ const text = `Vyriy Project Master
4
+
5
+ Usage:
6
+ vyriy create [name] Create a new Vyriy project
7
+ vyriy create . Initialize a new Vyriy project in the current directory
8
+ vyriy dist Prepare dist package metadata without publishing to npm
9
+ vyriy static [dir] Serve a static directory (defaults to dist)
10
+ vyriy check Check local environment
11
+ vyriy --help, -h Show help
12
+ vyriy --version, -v Show version
13
+
14
+ Create options:
15
+ vyriy create --dry-run Print the merged file plan without writing project files
16
+ vyriy create --overwrite Overwrite existing generated paths
17
+ vyriy create --skip-existing Leave existing generated paths untouched
18
+ vyriy create --no-install Create files without installing dependencies
19
+ vyriy create --no-verify Install dependencies without running checks
20
+
21
+ Examples:
22
+ vyriy create app
23
+ vyriy create app --dry-run
24
+ vyriy create .
25
+ vyriy create . --no-verify
26
+ vyriy dist
27
+ vyriy static
28
+ vyriy static dist
29
+ vyriy check`;
30
+ export const cli = async (args = []) => {
31
+ const command = parseArgs(args);
32
+ switch (command.type) {
33
+ case 'help':
34
+ console.log(text);
35
+ process.exitCode = 0;
36
+ break;
37
+ case 'version':
38
+ console.log(packageJson.version);
39
+ process.exitCode = 0;
40
+ break;
41
+ case 'dist': {
42
+ const { dist } = await import('@vyriy/dist');
43
+ process.exitCode = await dist();
44
+ break;
45
+ }
46
+ case 'check': {
47
+ const { checkEnv } = await import('@vyriy/check');
48
+ process.exitCode = await checkEnv();
49
+ break;
50
+ }
51
+ case 'static': {
52
+ const { staticServer } = await import('@vyriy/static');
53
+ process.exitCode = await staticServer(command);
54
+ break;
55
+ }
56
+ case 'create': {
57
+ const { create } = await import('@vyriy/create');
58
+ process.exitCode = await create(command);
59
+ break;
60
+ }
61
+ default:
62
+ console.error(`Unknown command: ${command.command}\n`);
63
+ console.log(text);
64
+ process.exitCode = 1;
65
+ break;
66
+ }
67
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vyriy",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Interactive project master for calm cloud-ready applications.",
5
5
  "type": "module",
6
6
  "bin": "./bin/vyriy.js",
@@ -8,25 +8,31 @@
8
8
  "node": ">=24.0.0"
9
9
  },
10
10
  "packageManager": "yarn@4.15.0",
11
+ "dependencies": {
12
+ "@vyriy/check": "0.5.3",
13
+ "@vyriy/create": "0.5.3",
14
+ "@vyriy/dist": "0.5.3",
15
+ "@vyriy/static": "0.5.3"
16
+ },
11
17
  "peerDependencies": {
12
18
  "@testing-library/dom": "^10.4.1",
13
19
  "@testing-library/react": "^16.3.2",
14
20
  "@types/jest": "^30.0.0",
15
- "@types/react": "^19.2.15",
21
+ "@types/react": "^19.2.16",
16
22
  "@types/react-dom": "^19.2.3",
17
23
  "cross-env": "^10.1.0",
18
24
  "eslint": "^10.4.1",
19
- "graphql": "^16.14.0",
25
+ "graphql": "^16.14.1",
20
26
  "husky": "^9.1.7",
21
27
  "jest": "^30.4.2",
22
28
  "npm-run-all2": "^9.0.1",
23
29
  "prettier": "^3.8.3",
24
- "react": "^19.2.6",
25
- "react-dom": "^19.2.6",
30
+ "react": "^19.2.7",
31
+ "react-dom": "^19.2.7",
26
32
  "rimraf": "^6.1.3",
27
33
  "sass": "^1.100.0",
28
34
  "serve": "^14.2.6",
29
- "storybook": "^10.4.1",
35
+ "storybook": "^10.4.2",
30
36
  "stylelint": "^17.12.0",
31
37
  "tsx": "^4.22.4",
32
38
  "typescript": "^6.0.3",
@@ -110,5 +116,44 @@
110
116
  "type": "git",
111
117
  "url": "https://github.com/evheniy/vyriy",
112
118
  "directory": "packages/vyriy"
119
+ },
120
+ "main": "./index.js",
121
+ "types": "./index.d.ts",
122
+ "exports": {
123
+ ".": {
124
+ "types": "./index.d.ts",
125
+ "import": "./index.js",
126
+ "default": "./index.js"
127
+ },
128
+ "./args": {
129
+ "types": "./args.d.ts",
130
+ "import": "./args.js",
131
+ "default": "./args.js"
132
+ },
133
+ "./args.js": {
134
+ "types": "./args.d.ts",
135
+ "import": "./args.js",
136
+ "default": "./args.js"
137
+ },
138
+ "./cli": {
139
+ "types": "./cli.d.ts",
140
+ "import": "./cli.js",
141
+ "default": "./cli.js"
142
+ },
143
+ "./cli.js": {
144
+ "types": "./cli.d.ts",
145
+ "import": "./cli.js",
146
+ "default": "./cli.js"
147
+ },
148
+ "./index": {
149
+ "types": "./index.d.ts",
150
+ "import": "./index.js",
151
+ "default": "./index.js"
152
+ },
153
+ "./index.js": {
154
+ "types": "./index.d.ts",
155
+ "import": "./index.js",
156
+ "default": "./index.js"
157
+ }
113
158
  }
114
159
  }
@@ -1,5 +1,8 @@
1
1
  export type Command = {
2
- readonly type: 'help' | 'version' | 'dist' | 'check-env';
2
+ readonly type: 'help' | 'version' | 'dist' | 'check';
3
+ } | {
4
+ readonly type: 'static';
5
+ readonly directory: string;
3
6
  } | {
4
7
  readonly type: 'create';
5
8
  readonly directory: string;
@@ -8,6 +11,9 @@ export type Command = {
8
11
  readonly skipExisting: boolean;
9
12
  readonly install: boolean;
10
13
  readonly verify: boolean;
14
+ } | {
15
+ readonly type: 'unknown';
16
+ readonly command: string;
11
17
  };
12
18
  export type ParseArgs = (args: readonly string[]) => Command;
13
19
  export type Cli = (args?: readonly string[]) => Promise<void>;
package/cli/args.js DELETED
@@ -1,29 +0,0 @@
1
- export const parseArgs = (args) => {
2
- if (args.includes('--help') || args.includes('-h')) {
3
- return { type: 'help' };
4
- }
5
- if (args.includes('--version') || args.includes('-v')) {
6
- return { type: 'version' };
7
- }
8
- if (args.includes('--dist') || args.includes('-d')) {
9
- return { type: 'dist' };
10
- }
11
- if (args.includes('--check-env') || args.includes('-c')) {
12
- return { type: 'check-env' };
13
- }
14
- const dryRun = args.includes('--dry-run');
15
- const overwrite = args.includes('--overwrite');
16
- const skipExisting = args.includes('--skip-existing');
17
- const install = !args.includes('--no-install');
18
- const verify = install && !args.includes('--no-verify');
19
- const directory = args.find((arg) => !arg.startsWith('-')) ?? '';
20
- return {
21
- type: 'create',
22
- directory,
23
- dryRun,
24
- overwrite,
25
- skipExisting,
26
- install,
27
- verify,
28
- };
29
- };
package/cli/cli.js DELETED
@@ -1,28 +0,0 @@
1
- import { parseArgs } from './args.js';
2
- import { help, version, dist, checkEnv, create } from '../commands/index.js';
3
- export const cli = async (args = []) => {
4
- const command = parseArgs(args);
5
- switch (command.type) {
6
- case 'help':
7
- process.exitCode = await help();
8
- break;
9
- case 'version':
10
- process.exitCode = await version();
11
- break;
12
- case 'dist':
13
- process.exitCode = await dist();
14
- break;
15
- case 'check-env': {
16
- process.exitCode = await checkEnv();
17
- break;
18
- }
19
- case 'create':
20
- process.exitCode = await create(command);
21
- break;
22
- default:
23
- console.error(`Unknown command.\n`);
24
- await help();
25
- process.exitCode = 1;
26
- break;
27
- }
28
- };
@@ -1,2 +0,0 @@
1
- import { Command } from './types.js';
2
- export declare const checkEnv: Command;
@@ -1,120 +0,0 @@
1
- import { exec as processExec } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- import packageJson from '../package.json' with { type: 'json' };
4
- const exec = promisify(processExec);
5
- const yarnStableHint = 'Try:\n corepack enable\n corepack prepare yarn@stable --activate';
6
- const node = () => {
7
- const majorVersion = Number.parseInt(process.versions.node.split('.')[0]);
8
- const minimumMajorVersion = Number.parseInt(packageJson.engines.node.match(/(\d+)/)?.[0]);
9
- if (majorVersion && majorVersion >= minimumMajorVersion) {
10
- return {
11
- ok: true,
12
- version: process.versions.node,
13
- message: `Node.js ${majorVersion}`,
14
- };
15
- }
16
- return {
17
- ok: false,
18
- version: process.versions.node,
19
- message: `Vyriy requires Node.js >= ${minimumMajorVersion}.\n\nCurrent version: ${process.versions.node}\n\nPlease upgrade Node.js and run the command again.`,
20
- };
21
- };
22
- const corepack = async () => {
23
- let currentVersion;
24
- try {
25
- const { stdout } = await exec('corepack --version');
26
- currentVersion = stdout.trim();
27
- }
28
- catch {
29
- return {
30
- ok: false,
31
- message: `Corepack was not found.\n\nVyriy uses Corepack to install Yarn stable.\n\nInstall a Node.js distribution that includes Corepack and run the command again.`,
32
- };
33
- }
34
- return {
35
- ok: true,
36
- message: `Corepack ${currentVersion}`,
37
- };
38
- };
39
- const activateYarnStable = async () => {
40
- try {
41
- await exec('corepack enable');
42
- await exec('corepack prepare yarn@stable --activate');
43
- }
44
- catch {
45
- return {
46
- ok: false,
47
- message: `Corepack could not activate Yarn stable.\n\n${yarnStableHint}`,
48
- };
49
- }
50
- return {
51
- ok: true,
52
- message: 'Yarn stable activated',
53
- };
54
- };
55
- const yarn = async () => {
56
- const minimumMajorVersion = Number.parseInt(packageJson.packageManager.match(/(\d+)/)?.[0]);
57
- let currentVersion;
58
- try {
59
- const { stdout } = await exec('yarn --version');
60
- currentVersion = stdout.trim();
61
- }
62
- catch {
63
- return {
64
- ok: false,
65
- message: `Yarn was not found.\n\nVyriy requires Yarn >= ${minimumMajorVersion}.\n\n${yarnStableHint}`,
66
- };
67
- }
68
- const majorVersion = Number.parseInt(currentVersion.match(/(\d+)/)?.[0]);
69
- if (majorVersion && majorVersion >= minimumMajorVersion) {
70
- return {
71
- ok: true,
72
- message: `Yarn ${currentVersion}`,
73
- };
74
- }
75
- return {
76
- ok: false,
77
- message: `Vyriy requires Yarn >= ${minimumMajorVersion}.\n\nCurrent version: ${currentVersion}\n\n${yarnStableHint}`,
78
- };
79
- };
80
- export const checkEnv = async () => {
81
- const nodeResults = node();
82
- console.log('Check env:');
83
- if (nodeResults.ok) {
84
- console.log(' ', nodeResults.message);
85
- }
86
- else {
87
- console.error(nodeResults.message);
88
- return 1;
89
- }
90
- const corepackResults = await corepack();
91
- if (corepackResults.ok) {
92
- console.log(' ', corepackResults.message);
93
- }
94
- else {
95
- console.error(corepackResults.message);
96
- return 1;
97
- }
98
- let yarnResults = await yarn();
99
- if (yarnResults.ok) {
100
- console.log(' ', yarnResults.message);
101
- return 0;
102
- }
103
- const yarnStableResults = await activateYarnStable();
104
- if (yarnStableResults.ok) {
105
- console.log(' ', yarnStableResults.message);
106
- }
107
- else {
108
- console.error(yarnStableResults.message);
109
- return 1;
110
- }
111
- yarnResults = await yarn();
112
- if (yarnResults.ok) {
113
- console.log(' ', yarnResults.message);
114
- }
115
- else {
116
- console.error(yarnResults.message);
117
- return 1;
118
- }
119
- return 0;
120
- };
@@ -1,2 +0,0 @@
1
- import { Create } from '../types.js';
2
- export declare const create: Create;
@@ -1,135 +0,0 @@
1
- import { cwd } from 'node:process';
2
- import { basename, dirname, resolve } from 'node:path';
3
- import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
4
- import { exec as processExec } from 'node:child_process';
5
- import { promisify } from 'node:util';
6
- import { checkEnv } from '../check-env.js';
7
- import { plan } from './plan/index.js';
8
- import { conflictStrategy as promptConflictStrategy } from './prompt/index.js';
9
- import { presets } from './preset/index.js';
10
- const exec = promisify(processExec);
11
- const getProviderFiles = (providers, provider) => provider === undefined ? {} : (providers[provider] ?? {});
12
- const isPresetName = (preset) => preset in presets;
13
- const mergeFiles = (planOption) => {
14
- if (!isPresetName(planOption.preset)) {
15
- return undefined;
16
- }
17
- const preset = presets[planOption.preset].preset;
18
- return {
19
- ...preset.files(planOption),
20
- ...getProviderFiles(preset.ci, planOption.ci),
21
- ...getProviderFiles(preset.deploy, planOption.deploy),
22
- };
23
- };
24
- const getSortedFileNames = (files) => Object.keys(files).sort((a, b) => a.localeCompare(b));
25
- const logFilePlan = (target, files) => {
26
- console.log(`\nFile plan (${target}):`);
27
- console.log(' ', getSortedFileNames(files).join('\n '));
28
- };
29
- const getExistingFiles = (target, files) => {
30
- const existingFiles = getSortedFileNames(files).filter((file) => existsSync(resolve(target, file)));
31
- if (existingFiles.length) {
32
- console.log('\nExisting files found:\n');
33
- existingFiles.forEach((file) => console.log(' ', file));
34
- }
35
- return existingFiles;
36
- };
37
- const resolveConflictStrategy = async (filesExist, overwrite, skipExisting) => {
38
- if (!filesExist || overwrite || skipExisting) {
39
- return { overwrite, skipExisting };
40
- }
41
- const strategy = await promptConflictStrategy();
42
- if (strategy) {
43
- return strategy;
44
- }
45
- console.error('\nCannot continue without a conflict strategy.\n');
46
- console.error('Use one of:\n\n vyriy --overwrite\n vyriy --skip-existing\n vyriy --dry-run');
47
- return undefined;
48
- };
49
- const writeFiles = (target, files, overwrite) => {
50
- console.log(`\nFile creating (${target}):`);
51
- getSortedFileNames(files).forEach((file) => {
52
- if (!existsSync(resolve(target, file)) || overwrite) {
53
- console.log(' ', file);
54
- const filePath = resolve(target, file);
55
- mkdirSync(dirname(filePath), { recursive: true });
56
- writeFileSync(filePath, files[file]);
57
- }
58
- });
59
- };
60
- const verifyProject = async (target) => {
61
- console.log('Running checks...');
62
- try {
63
- await exec(`yarn --cwd ${target} check`);
64
- }
65
- catch {
66
- console.log('Running fixes...');
67
- await exec(`yarn --cwd ${target} fix`);
68
- console.log('Running checks...');
69
- await exec(`yarn --cwd ${target} check`);
70
- }
71
- };
72
- const installAndVerify = async (target, install, verify) => {
73
- if (install) {
74
- console.log('Installing dependencies...');
75
- await exec(`yarn --cwd ${target} set version berry`);
76
- await exec(`yarn --cwd ${target} install`);
77
- }
78
- else {
79
- console.log('Installing dependencies... SKIPPED');
80
- console.log('Running checks... SKIPPED');
81
- console.log('\nProject files were created.');
82
- return 0;
83
- }
84
- if (verify) {
85
- await verifyProject(target);
86
- }
87
- else {
88
- console.log('Running checks... SKIPPED');
89
- console.log('\nProject files were created.');
90
- return 0;
91
- }
92
- return 0;
93
- };
94
- export const create = async (options) => {
95
- const { directory, dryRun, overwrite, skipExisting, install, verify } = options;
96
- const checkEnvCode = await checkEnv();
97
- if (checkEnvCode) {
98
- return checkEnvCode;
99
- }
100
- const cliPath = cwd();
101
- let dirName = 'app';
102
- let appPath = resolve(cliPath, dirName);
103
- if (directory) {
104
- if (directory === '.') {
105
- dirName = basename(cliPath);
106
- appPath = cliPath;
107
- }
108
- else {
109
- dirName = directory;
110
- appPath = resolve(cwd(), dirName);
111
- }
112
- }
113
- const planOption = await plan(dirName, appPath);
114
- if (planOption) {
115
- const { target } = planOption;
116
- const files = mergeFiles(planOption);
117
- if (!files) {
118
- console.error(`Unknown preset: ${planOption.preset}`);
119
- return 1;
120
- }
121
- if (dryRun) {
122
- logFilePlan(target, files);
123
- return 0;
124
- }
125
- console.log(`\nFile checking (${target})...`);
126
- const existingFiles = getExistingFiles(target, files);
127
- const conflictStrategy = await resolveConflictStrategy(Boolean(existingFiles.length), overwrite, skipExisting);
128
- if (!conflictStrategy) {
129
- return 1;
130
- }
131
- writeFiles(target, files, conflictStrategy.overwrite);
132
- return installAndVerify(target, install, verify);
133
- }
134
- return 1;
135
- };
@@ -1,4 +0,0 @@
1
- export * from './plan.js';
2
- export * from '../prompt/index.js';
3
- export * from './question.js';
4
- export type * from './types.js';
@@ -1,3 +0,0 @@
1
- export * from './plan.js';
2
- export * from '../prompt/index.js';
3
- export * from './question.js';
@@ -1,9 +0,0 @@
1
- export declare const plan: (dirName: string, appPath: string) => Promise<{
2
- name: string;
3
- description: string;
4
- target: string;
5
- preset: "ssr" | "base" | "rest" | "api" | "library" | "gql" | "ssg" | "spa" | "mfe";
6
- scope: string | undefined;
7
- ci: import("../preset/types.js").CiProvider | undefined;
8
- deploy: import("../preset/types.js").DeployProvider | undefined;
9
- } | undefined>;
@@ -1,34 +0,0 @@
1
- import { stdin, stdout } from 'node:process';
2
- import { createInterface } from 'node:readline';
3
- import { presets as appPreset } from '../preset/index.js';
4
- import { prompt, provider as promptProvider, preset as promptPreset, scope as promptScope } from '../prompt/index.js';
5
- import { question as createQuestion } from './question.js';
6
- export const plan = async (dirName, appPath) => {
7
- const readline = createInterface({ input: stdin, output: stdout });
8
- const question = createQuestion(readline, stdout);
9
- try {
10
- stdout.write('\nVyriy Project Master\n\n');
11
- const name = await prompt(question, 'Project name', dirName);
12
- const description = await prompt(question, 'Project description', 'Calm cloud-ready application');
13
- const target = await prompt(question, 'Target directory', appPath);
14
- const preset = await promptPreset(question, stdout);
15
- const scope = await promptScope(question, preset, name);
16
- const ci = await promptProvider(question, stdout, 'CI/CD provider', appPreset[preset].preset.ci);
17
- const deploy = await promptProvider(question, stdout, 'Deploy provider', appPreset[preset].preset.deploy);
18
- const confirmation = (await prompt(question, 'Use this project plan?', 'y')).toLowerCase();
19
- return confirmation === 'y'
20
- ? {
21
- name,
22
- description,
23
- target,
24
- preset,
25
- scope,
26
- ci,
27
- deploy,
28
- }
29
- : undefined;
30
- }
31
- finally {
32
- readline.close();
33
- }
34
- };
@@ -1,2 +0,0 @@
1
- import { Question } from './types.js';
2
- export declare const question: Question;