vovk-cli 0.0.1-draft.356 → 0.0.1-draft.358
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/dist/init/index.mjs +28 -26
- package/package.json +4 -2
package/dist/init/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ export class Init {
|
|
|
20
20
|
log;
|
|
21
21
|
async #init({ configPaths, pkgJson, }, { useNpm, useYarn, usePnpm, useBun, skipInstall, updateTsConfig, updateScripts, validationLibrary, lang, dryRun, channel, }) {
|
|
22
22
|
const { log, root } = this;
|
|
23
|
-
const dependencies = ['vovk', 'vovk-client', '
|
|
23
|
+
const dependencies = ['vovk', 'vovk-client', 'vovk-ajv'];
|
|
24
24
|
const devDependencies = ['vovk-cli'];
|
|
25
25
|
if (lang?.includes('py')) {
|
|
26
26
|
devDependencies.push('vovk-python');
|
|
@@ -50,7 +50,7 @@ export class Init {
|
|
|
50
50
|
}
|
|
51
51
|
if (updateScripts) {
|
|
52
52
|
try {
|
|
53
|
-
if (!dryRun)
|
|
53
|
+
if (!dryRun && pkgJson)
|
|
54
54
|
await updateNPMScripts(pkgJson, root, updateScripts);
|
|
55
55
|
log.info('Updated scripts at package.json');
|
|
56
56
|
}
|
|
@@ -79,7 +79,7 @@ export class Init {
|
|
|
79
79
|
log.error(`Failed to update tsconfig.json: ${error.message}`);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
if (!dryRun) {
|
|
82
|
+
if (!dryRun && pkgJson) {
|
|
83
83
|
let depsUpdated = false;
|
|
84
84
|
try {
|
|
85
85
|
await updateDependenciesWithoutInstalling({
|
|
@@ -152,7 +152,7 @@ export class Init {
|
|
|
152
152
|
const cwd = process.cwd();
|
|
153
153
|
const root = path.resolve(cwd, prefix ?? '.');
|
|
154
154
|
const log = getLogger(logLevel ?? 'info');
|
|
155
|
-
const pkgJson = await NPMCliPackageJson.load(root);
|
|
155
|
+
const pkgJson = await NPMCliPackageJson.load(root).catch(() => null);
|
|
156
156
|
this.root = root;
|
|
157
157
|
this.log = log;
|
|
158
158
|
const configPaths = await getConfigPaths({ cwd, relativePath: prefix });
|
|
@@ -215,28 +215,30 @@ export class Init {
|
|
|
215
215
|
{ name: 'None', value: null, description: 'Install validation library later' },
|
|
216
216
|
],
|
|
217
217
|
})));
|
|
218
|
-
updateScripts ??=
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
218
|
+
updateScripts ??= !pkgJson
|
|
219
|
+
? undefined
|
|
220
|
+
: await select({
|
|
221
|
+
message: 'Do you want to update "dev" and add "prebuild" NPM scripts at package.json?',
|
|
222
|
+
default: 'implicit',
|
|
223
|
+
choices: [
|
|
224
|
+
{
|
|
225
|
+
name: 'Yes, use "concurrently" implicitly',
|
|
226
|
+
value: 'implicit',
|
|
227
|
+
description: `The "dev" script will use "concurrently" API to run "next dev" and "vovk dev" commands together and automatically find an available port ${chalk.whiteBright.bold(`"${getDevScript(pkgJson, 'implicit')}"`)} and the "prebuild" script will run "vovk generate"`,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'Yes, use "concurrently" explicitly',
|
|
231
|
+
value: 'explicit',
|
|
232
|
+
description: `The "dev" script will use pre-defined PORT variable and run "next dev" and "vovk dev" as "concurrently" CLI arguments ${chalk.whiteBright.bold(`"${getDevScript(pkgJson, 'explicit')}"`)} and the "prebuild" script will run "vovk generate"`,
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: 'No',
|
|
236
|
+
value: undefined,
|
|
237
|
+
description: 'Add the NPM scripts manually',
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
if (typeof updateTsConfig === 'undefined' && pkgJson) {
|
|
240
242
|
let shouldAsk = false;
|
|
241
243
|
try {
|
|
242
244
|
shouldAsk = !(await checkTSConfigForExperimentalDecorators(root)); // TODO also check for emitDecoratorMetadata when vovk-dto is used
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.358",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://vovk.dev",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"vovk": "^3.0.0-draft.
|
|
38
|
+
"vovk": "^3.0.0-draft.419",
|
|
39
|
+
"vovk-ajv": "^0.0.0-draft.101",
|
|
40
|
+
"vovk-client": "^0.0.4-draft.129"
|
|
39
41
|
},
|
|
40
42
|
"optionalDependencies": {
|
|
41
43
|
"@rolldown/binding-linux-x64-gnu": "1.0.0-beta.36"
|