vovk-cli 0.0.1-beta.43 → 0.0.1-beta.45
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/new/newModule.d.mts
CHANGED
package/dist/new/newModule.mjs
CHANGED
|
@@ -53,7 +53,8 @@ export default async function newModule({ projectInfo, what, moduleNameWithOptio
|
|
|
53
53
|
}
|
|
54
54
|
const segment = segments.find((s) => s.segmentName === segmentName);
|
|
55
55
|
if (!segment) {
|
|
56
|
-
|
|
56
|
+
log.error(`Unable to create module: ${formatLoggedSegmentName(segmentName)} not found. Run ${chalkHighlightThing(`npx vovk new segment${segmentName ? ` ${segmentName}` : ''}`)} to create it`);
|
|
57
|
+
return process.exit(1);
|
|
57
58
|
}
|
|
58
59
|
for (const type of what) {
|
|
59
60
|
const templatePath = templates[type];
|
|
@@ -82,7 +83,8 @@ export default async function newModule({ projectInfo, what, moduleNameWithOptio
|
|
|
82
83
|
const prettiedCode = await prettify(code, absoluteModulePath);
|
|
83
84
|
if (!dryRun) {
|
|
84
85
|
if (!overwrite && (await getFileSystemEntryType(absoluteModulePath))) {
|
|
85
|
-
|
|
86
|
+
log.error(`File ${chalkHighlightThing(absoluteModulePath)} already exists, skipping this "${chalkHighlightThing(type)}". You can use --overwrite flag to overwrite it.`);
|
|
87
|
+
return process.exit(1);
|
|
86
88
|
}
|
|
87
89
|
else {
|
|
88
90
|
await fs.mkdir(absoluteModuleDir, { recursive: true });
|
package/dist/new/newSegment.mjs
CHANGED
|
@@ -12,7 +12,8 @@ export default async function newSegment({ projectInfo, segmentName, isStaticSeg
|
|
|
12
12
|
}
|
|
13
13
|
const absoluteSegmentRoutePath = path.join(apiDirAbsolutePath, segmentName, '[[...vovk]]/route.ts');
|
|
14
14
|
if (!overwrite && (await getFileSystemEntryType(absoluteSegmentRoutePath))) {
|
|
15
|
-
|
|
15
|
+
log.error(`Unable to create new segment. ${formatLoggedSegmentName(segmentName, { upperFirst: true })} already exists. You can use --overwrite flag to overwrite it.`);
|
|
16
|
+
return process.exit(1);
|
|
16
17
|
}
|
|
17
18
|
const code = await prettify(`import { initSegment${isStaticSegment ? ', generateStaticAPI' : ''} } from 'vovk';
|
|
18
19
|
|
|
@@ -37,5 +38,5 @@ ${segmentName ? ` segmentName: '${segmentName}',\n` : ''} emitSchema: true,
|
|
|
37
38
|
}
|
|
38
39
|
log.info(`${chalk.green('Created')} ${formatLoggedSegmentName(segmentName, { isStatic: isStaticSegment })} at ${absoluteSegmentRoutePath}.`);
|
|
39
40
|
const dir = chalk.cyanBright([segmentName, 'thing'].filter(Boolean).join('/'));
|
|
40
|
-
log.info(`Run ${chalkHighlightThing(`npx vovk new service controller ${dir}`)} to create a new controller with a service at
|
|
41
|
+
log.info(`Run ${chalkHighlightThing(`npx vovk new service controller ${dir}`)} to create a new controller with a service at ./${path.join(config.modulesDir, dir)} folder for this segment`);
|
|
41
42
|
}
|