vovk-cli 0.0.1-draft.370 → 0.0.1-draft.371

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.
@@ -144,7 +144,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
144
144
  : { data: { imports: [] }, content: templateContent };
145
145
  const { package: packageJson, readme, origin, samples, reExports, } = resolveGeneratorConfigValues({
146
146
  schema: fullSchema,
147
- configs: [templateDef.generatorConfig ?? {}],
147
+ configs: [{ origin: cliGenerateOptions?.origin }, templateDef.generatorConfig ?? {}],
148
148
  projectPackageJson,
149
149
  isBundle,
150
150
  segmentName: null,
@@ -182,7 +182,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
182
182
  isVovkProject,
183
183
  vovkCliPackage,
184
184
  isBundle,
185
- origin: cliGenerateOptions?.origin ?? origin,
185
+ origin,
186
186
  configKey: 'composedClient',
187
187
  cliSchemaPath: cliGenerateOptions?.schemaPath ?? null,
188
188
  projectConfig: config,
@@ -229,7 +229,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
229
229
  const results = await Promise.all(segmentNames.map(async (segmentName) => {
230
230
  const { package: packageJson, readme, origin, samples, reExports, } = resolveGeneratorConfigValues({
231
231
  schema: fullSchema,
232
- configs: [templateDef.generatorConfig ?? {}],
232
+ configs: [{ origin: cliGenerateOptions?.origin }, templateDef.generatorConfig ?? {}],
233
233
  projectPackageJson,
234
234
  segmentName,
235
235
  isBundle,
@@ -267,7 +267,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
267
267
  isVovkProject,
268
268
  vovkCliPackage,
269
269
  isBundle,
270
- origin: cliGenerateOptions?.origin ?? origin,
270
+ origin,
271
271
  configKey: 'segmentedClient',
272
272
  cliSchemaPath: cliGenerateOptions?.schemaPath ?? null,
273
273
  projectConfig: config,
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import fs from 'node:fs/promises';
3
+ import chalk from 'chalk';
3
4
  import { getTsconfig } from 'get-tsconfig';
4
5
  import render from './render.mjs';
5
6
  import addClassToSegmentCode from './addClassToSegmentCode.mjs';
@@ -80,12 +81,12 @@ export default async function newModule({ projectInfo, what, moduleNameWithOptio
80
81
  const prettiedCode = await prettify(code, absoluteModulePath);
81
82
  if (!dryRun) {
82
83
  if (!overwrite && (await getFileSystemEntryType(absoluteModulePath))) {
83
- log.warn(`File ${chalkHighlightThing(absoluteModulePath)} already exists, skipping this "${type}"`);
84
+ log.warn(`File ${chalkHighlightThing(absoluteModulePath)} already exists, skipping this "${chalkHighlightThing(type)}". You can use --overwrite flag to overwrite it.`);
84
85
  }
85
86
  else {
86
87
  await fs.mkdir(absoluteModuleDir, { recursive: true });
87
88
  await fs.writeFile(absoluteModulePath, prettiedCode);
88
- log.info(`Created${empty ? ' empty' : ''} ${chalkHighlightThing(absoluteModulePath)} using ${chalkHighlightThing(`"${type}"`)} template for ${formatLoggedSegmentName(segmentName)}`);
89
+ log.info(`${chalk.green('Created')}${empty ? ' empty' : ''} ${chalkHighlightThing(absoluteModulePath)} using ${chalkHighlightThing(`"${type}"`)} template for ${formatLoggedSegmentName(segmentName)}`);
89
90
  }
90
91
  }
91
92
  if (type === 'controller') {
@@ -109,7 +110,7 @@ export default async function newModule({ projectInfo, what, moduleNameWithOptio
109
110
  await fs.writeFile(routeFilePath, newSegmentCode);
110
111
  }
111
112
  }
112
- log.info(`Added ${chalkHighlightThing(sourceName)} ${type} as ${chalkHighlightThing(compiledName)} to ${formatLoggedSegmentName(segmentName)}`);
113
+ log.info(`${chalk.green('Added')} ${chalkHighlightThing(sourceName)} ${type} as ${chalkHighlightThing(compiledName)} to ${formatLoggedSegmentName(segmentName)}`);
113
114
  }
114
115
  }
115
116
  }
@@ -12,7 +12,7 @@ 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
- throw new Error(`Unable to create new segment. ${formatLoggedSegmentName(segmentName, { upperFirst: true })} already exists.`);
15
+ throw new 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
 
@@ -35,7 +35,7 @@ ${segmentName ? ` segmentName: '${segmentName}',\n` : ''} emitSchema: true,
35
35
  await fs.mkdir(path.dirname(absoluteSegmentRoutePath), { recursive: true });
36
36
  await fs.writeFile(absoluteSegmentRoutePath, code);
37
37
  }
38
- log.info(`${formatLoggedSegmentName(segmentName, { upperFirst: true, isStatic: isStaticSegment })} created at ${absoluteSegmentRoutePath}.`);
38
+ log.info(`${chalk.green('Created')} ${formatLoggedSegmentName(segmentName, { isStatic: isStaticSegment })} at ${absoluteSegmentRoutePath}.`);
39
39
  const dir = chalk.cyanBright([segmentName, 'thing'].filter(Boolean).join('/'));
40
40
  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
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.370",
3
+ "version": "0.0.1-draft.371",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "homepage": "https://vovk.dev",
37
37
  "peerDependencies": {
38
- "vovk": "^3.0.0-draft.433",
39
- "vovk-ajv": "^0.0.0-draft.103",
40
- "vovk-client": "^0.0.4-draft.131",
41
- "vovk-python": "^0.0.1-draft.73",
42
- "vovk-rust": "^0.0.1-draft.59"
38
+ "vovk": "^3.0.0-draft.441",
39
+ "vovk-ajv": "^0.0.0-draft.104",
40
+ "vovk-client": "^0.0.4-draft.132",
41
+ "vovk-python": "^0.0.1-draft.74",
42
+ "vovk-rust": "^0.0.1-draft.60"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.36"