vovk-cli 0.0.1-beta.41 → 0.0.1-beta.43
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.mjs
CHANGED
|
@@ -53,7 +53,7 @@ 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
|
-
return log.error(`Unable to create module
|
|
56
|
+
return log.error(`Unable to create module: ${formatLoggedSegmentName(segmentName)} not found. Run ${chalkHighlightThing(`npx vovk new segment${segmentName ? ` ${segmentName}` : ''}`)} to create it`);
|
|
57
57
|
}
|
|
58
58
|
for (const type of what) {
|
|
59
59
|
const templatePath = templates[type];
|
|
@@ -82,7 +82,7 @@ export default async function newModule({ projectInfo, what, moduleNameWithOptio
|
|
|
82
82
|
const prettiedCode = await prettify(code, absoluteModulePath);
|
|
83
83
|
if (!dryRun) {
|
|
84
84
|
if (!overwrite && (await getFileSystemEntryType(absoluteModulePath))) {
|
|
85
|
-
log.
|
|
85
|
+
return log.error(`File ${chalkHighlightThing(absoluteModulePath)} already exists, skipping this "${chalkHighlightThing(type)}". You can use --overwrite flag to overwrite it.`);
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
await fs.mkdir(absoluteModuleDir, { recursive: true });
|
package/dist/new/newSegment.mjs
CHANGED
|
@@ -8,11 +8,11 @@ import chalk from 'chalk';
|
|
|
8
8
|
export default async function newSegment({ projectInfo, segmentName, isStaticSegment, overwrite, dryRun, }) {
|
|
9
9
|
const { apiDirAbsolutePath, log, config } = projectInfo;
|
|
10
10
|
if (!apiDirAbsolutePath) {
|
|
11
|
-
throw new Error('No API directory found. Please ensure you are in a
|
|
11
|
+
throw new Error('No API directory found. Please ensure you are in a Next.js project.');
|
|
12
12
|
}
|
|
13
13
|
const absoluteSegmentRoutePath = path.join(apiDirAbsolutePath, segmentName, '[[...vovk]]/route.ts');
|
|
14
14
|
if (!overwrite && (await getFileSystemEntryType(absoluteSegmentRoutePath))) {
|
|
15
|
-
|
|
15
|
+
return log.error(`Unable to create new segment. ${formatLoggedSegmentName(segmentName, { upperFirst: true })} already exists. You can use --overwrite flag to overwrite it.`);
|
|
16
16
|
}
|
|
17
17
|
const code = await prettify(`import { initSegment${isStaticSegment ? ', generateStaticAPI' : ''} } from 'vovk';
|
|
18
18
|
|