zova-cli-set-front 1.2.72 → 1.2.76

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/README.md CHANGED
@@ -1 +1,51 @@
1
1
  # zova-cli-set-front
2
+
3
+ This package contains the authoritative Zova command catalog for frontend-oriented CLI workflows.
4
+
5
+ ## Source of truth
6
+
7
+ The top-level command-family registry lives in:
8
+
9
+ - `src/lib/commands.ts`
10
+
11
+ Inspect this file first when you need to answer:
12
+
13
+ - which Zova command families exist
14
+ - which command names are registered
15
+ - which command module implements each entry
16
+
17
+ Current families include:
18
+
19
+ - `default`
20
+ - `bin`
21
+ - `create`
22
+ - `init`
23
+ - `refactor`
24
+ - `tools`
25
+ - `openapi`
26
+
27
+ ## Command metadata surface
28
+
29
+ Each command module under `src/lib/command/` provides the main CLI-facing metadata for that command, typically including:
30
+
31
+ - `bean`
32
+ - `info.title`
33
+ - `info.usage`
34
+ - `options`
35
+
36
+ Representative example:
37
+
38
+ - `src/lib/command/tools.metadata.ts`
39
+
40
+ ## Recommended navigation path
41
+
42
+ 1. run `npm run zova`
43
+ 2. inspect `../cli/src/bin/zova.ts` for entry dispatch only
44
+ 3. inspect `src/lib/commands.ts` for the authoritative family map
45
+ 4. inspect the specific command module for usage and options
46
+
47
+ ## Public reference
48
+
49
+ For the compact top-level overview shared across Vona and Zova, see:
50
+
51
+ - `../../../cabloy-docs/reference/cli-reference.md`
@@ -17,7 +17,7 @@
17
17
  "files": ["mock", "dist", "src", "icons", "assets"],
18
18
  "scripts": {
19
19
  "clean": "rimraf dist tsconfig.build.tsbuildinfo",
20
- "tsc:publish": "npm run clean && zova :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
20
+ "tsc:publish": "npm run clean && node <%=argv.suite?'../../../../../':'../../../'%>packages-cli/cli/src/bin/zova.ts :bin:buildModule --sourcemap && tsc -p tsconfig.build.json",
21
21
  "prepublishOnly": "npm run tsc:publish",
22
22
  "prepack": "clean-package",
23
23
  "postpack": "clean-package restore && npm run clean"
package/dist/index.js CHANGED
@@ -395,27 +395,48 @@ async function _extractDepsVersion(projectPath, deps) {
395
395
  const parsedLockfile = yaml.parse(lockfileContent);
396
396
  const depsVersion = {};
397
397
  for (const dep of deps) {
398
- let version = getPackageVersionFromLock(parsedLockfile, dep);
399
- if (!version) {
400
- version = await getPackageVersionFromNodeModules(projectPath, dep);
398
+ let dependencyRange = getPackageDependencyRangeFromLock(parsedLockfile, dep);
399
+ if (!dependencyRange) {
400
+ const version = await getPackageVersionFromNodeModules(projectPath, dep);
401
+ dependencyRange = version ? `^${version}` : null;
401
402
  }
402
- if (!version) {
403
+ if (!dependencyRange) {
403
404
  console.warn('dep version not found: ', dep);
404
405
  continue;
405
406
  }
406
- depsVersion[dep] = `^${version}`;
407
+ depsVersion[dep] = dependencyRange;
407
408
  }
408
409
  return depsVersion;
409
410
  }
410
- function getPackageVersionFromLock(parsedLockfile, packageName) {
411
- const packages = parsedLockfile.packages || {};
412
- for (const key in packages) {
413
- if (key.startsWith(`${packageName}@`)) {
414
- return key.substring(`${packageName}@`.length);
415
- }
411
+ function getPackageDependencyRangeFromLock(parsedLockfile, packageName) {
412
+ const importer = parsedLockfile.importers?.['.'];
413
+ const sections = ['dependencies', 'devDependencies', 'optionalDependencies'];
414
+ for (const section of sections) {
415
+ const dependencyRange = getImporterDependencyRange(importer?.[section]?.[packageName]);
416
+ if (dependencyRange) return dependencyRange;
416
417
  }
417
418
  return null;
418
419
  }
420
+ function getImporterDependencyRange(importerDependency) {
421
+ if (!importerDependency) return null;
422
+ const specifier = importerDependency.specifier;
423
+ if (specifier?.startsWith('npm:')) return specifier;
424
+ const version = normalizeLockfileVersion(importerDependency.version);
425
+ if (!version) return null;
426
+ return `^${version}`;
427
+ }
428
+ function normalizeLockfileVersion(version) {
429
+ if (!version) return null;
430
+ if (version.startsWith('link:') || version.startsWith('file:')) return null;
431
+ const versionWithoutPeers = version.split('(')[0];
432
+ if (!versionWithoutPeers) return null;
433
+ if (/^\d/.test(versionWithoutPeers)) return versionWithoutPeers;
434
+ const aliasSeparator = versionWithoutPeers.lastIndexOf('@');
435
+ if (aliasSeparator === -1) return null;
436
+ const aliasedVersion = versionWithoutPeers.slice(aliasSeparator + 1);
437
+ if (!aliasedVersion || !/^\d/.test(aliasedVersion)) return null;
438
+ return aliasedVersion;
439
+ }
419
440
  async function getPackageVersionFromNodeModules(projectPath, packageName) {
420
441
  const pkgFile = path.join(projectPath, 'node_modules', packageName, 'package.json');
421
442
  if (!fse.existsSync(pkgFile)) return null;
@@ -2147,50 +2168,6 @@ class CliRefactorAnotherStyle extends BeanCliBase {
2147
2168
  }
2148
2169
  }
2149
2170
 
2150
- class CliRefactorComponentEmits extends BeanCliBase {
2151
- async execute() {
2152
- const {
2153
- argv
2154
- } = this.context;
2155
- // super
2156
- await super.execute();
2157
- // module name/info
2158
- const moduleName = argv.module;
2159
- argv.moduleInfo = this.helper.parseModuleInfo(moduleName);
2160
- // check if exists
2161
- const _module = this.helper.findModule(moduleName);
2162
- if (!_module) {
2163
- throw new Error(`module does not exist: ${moduleName}`);
2164
- }
2165
- // target dir
2166
- const targetDir = await this.helper.ensureDir(_module.root);
2167
- // componentName
2168
- const componentName = argv.componentName;
2169
- // nameMeta
2170
- argv.nameMeta = this.helper.parseNameMeta(componentName, ['component']);
2171
- argv.controllerClassName = `Controller${argv.nameMeta.shortCapitalize}`;
2172
- argv.controllerFileName = getControllerFileName(_module, 'component', argv.nameMeta.short);
2173
- // directory
2174
- const componentDir = path.join(targetDir, 'src/component', argv.nameMeta.short);
2175
- if (!fs.existsSync(componentDir)) {
2176
- throw new Error(`component not exists: ${componentDir}`);
2177
- }
2178
- // render boilerplate
2179
- await this.template.renderBoilerplateAndSnippets({
2180
- targetDir: componentDir,
2181
- setName: __ThisSetName__,
2182
- snippetsPath: 'refactor/componentEmits/snippets',
2183
- boilerplatePath: null
2184
- });
2185
- // tools.metadata
2186
- if (!argv.nometadata) {
2187
- await this.helper.invokeCli([':tools:metadata', moduleName], {
2188
- cwd: argv.projectPath
2189
- });
2190
- }
2191
- }
2192
- }
2193
-
2194
2171
  class CliRefactorComponentGeneric extends BeanCliBase {
2195
2172
  async execute() {
2196
2173
  const {
@@ -2331,50 +2308,6 @@ class CliRefactorComponentProps extends BeanCliBase {
2331
2308
  }
2332
2309
  }
2333
2310
 
2334
- class CliRefactorComponentSlots extends BeanCliBase {
2335
- async execute() {
2336
- const {
2337
- argv
2338
- } = this.context;
2339
- // super
2340
- await super.execute();
2341
- // module name/info
2342
- const moduleName = argv.module;
2343
- argv.moduleInfo = this.helper.parseModuleInfo(moduleName);
2344
- // check if exists
2345
- const _module = this.helper.findModule(moduleName);
2346
- if (!_module) {
2347
- throw new Error(`module does not exist: ${moduleName}`);
2348
- }
2349
- // target dir
2350
- const targetDir = await this.helper.ensureDir(_module.root);
2351
- // componentName
2352
- const componentName = argv.componentName;
2353
- // nameMeta
2354
- argv.nameMeta = this.helper.parseNameMeta(componentName, ['component']);
2355
- argv.controllerClassName = `Controller${argv.nameMeta.shortCapitalize}`;
2356
- argv.controllerFileName = getControllerFileName(_module, 'component', argv.nameMeta.short);
2357
- // directory
2358
- const componentDir = path.join(targetDir, 'src/component', argv.nameMeta.short);
2359
- if (!fs.existsSync(componentDir)) {
2360
- throw new Error(`component not exists: ${componentDir}`);
2361
- }
2362
- // render boilerplate
2363
- await this.template.renderBoilerplateAndSnippets({
2364
- targetDir: componentDir,
2365
- setName: __ThisSetName__,
2366
- snippetsPath: 'refactor/componentSlots/snippets',
2367
- boilerplatePath: null
2368
- });
2369
- // tools.metadata
2370
- if (!argv.nometadata) {
2371
- await this.helper.invokeCli([':tools:metadata', moduleName], {
2372
- cwd: argv.projectPath
2373
- });
2374
- }
2375
- }
2376
- }
2377
-
2378
2311
  class CliRefactorFirstRender extends BeanCliBase {
2379
2312
  async execute() {
2380
2313
  const {
@@ -2780,7 +2713,7 @@ import { constants } from '../config/constants.js';
2780
2713
  `;
2781
2714
  return content;
2782
2715
  }
2783
- async function generateLocale1(modulePath, moduleName) {
2716
+ async function generateLocale1(modulePath) {
2784
2717
  const files = await globby('src/config/locale/*.ts', {
2785
2718
  cwd: modulePath
2786
2719
  });
@@ -2795,21 +2728,11 @@ async function generateLocale1(modulePath, moduleName) {
2795
2728
  contentLocales.push(` '${localeName}': ${className},`);
2796
2729
  }
2797
2730
  // combine
2798
- const content = `import type { TypeLocaleBase } from 'zova';
2799
- import { useApp, useComputed } from 'zova';
2800
- ${contentImports.join('\n')}
2731
+ const content = `${contentImports.join('\n')}
2801
2732
 
2802
2733
  export const locales = {
2803
2734
  ${contentLocales.join('\n')}
2804
2735
  };
2805
-
2806
- export function $useLocale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K, ...args: any[]) {
2807
- const app = useApp();
2808
- const str = \`${moduleName}::\${key}\`;
2809
- return useComputed(() => {
2810
- return app.meta.text(str, ...args);
2811
- });
2812
- }
2813
2736
  `;
2814
2737
  return content;
2815
2738
  }
@@ -3473,7 +3396,7 @@ class CliToolsMetadata extends BeanCliBase {
3473
3396
  const contentConstants = await generateConstant(modulePath);
3474
3397
  content += contentConstants;
3475
3398
  // locale
3476
- const contentLocales1 = await generateLocale1(modulePath, moduleName);
3399
+ const contentLocales1 = await generateLocale1(modulePath);
3477
3400
  const contentLocales2 = await generateLocale2(contentLocales1);
3478
3401
  content += contentLocales2;
3479
3402
  // error
@@ -3639,8 +3562,6 @@ const beans = {
3639
3562
  'refactor.anotherRender': CliRefactorAnotherRender,
3640
3563
  'refactor.anotherStyle': CliRefactorAnotherStyle,
3641
3564
  'refactor.componentProps': CliRefactorComponentProps,
3642
- 'refactor.componentEmits': CliRefactorComponentEmits,
3643
- 'refactor.componentSlots': CliRefactorComponentSlots,
3644
3565
  'refactor.componentModel': CliRefactorComponentModel,
3645
3566
  'refactor.renameComponent': CliRefactorRenameComponent,
3646
3567
  'tools.metadata': CliToolsMetadata,
@@ -3653,7 +3574,7 @@ var binBuildModule = {
3653
3574
  bean: 'bin.buildModule',
3654
3575
  info: {
3655
3576
  version: '5.0.0',
3656
- title: 'Cli: Tools: Bin',
3577
+ title: 'Cli: Bin: Build Module',
3657
3578
  usage: 'npm run zova :bin:buildModule -- [--minify] [--sourcemap] [--dts]'
3658
3579
  },
3659
3580
  options: {
@@ -3676,7 +3597,7 @@ var binBuildRest = {
3676
3597
  bean: 'bin.buildRest',
3677
3598
  info: {
3678
3599
  version: '5.0.0',
3679
- title: 'Cli: Tools: Bin',
3600
+ title: 'Cli: Bin: Build Rest',
3680
3601
  usage: 'npm run zova :bin:buildRest -- [--flavor=]'
3681
3602
  },
3682
3603
  options: {
@@ -1,5 +1,5 @@
1
1
  export declare function generateConfig(modulePath: string): Promise<"" | "/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n">;
2
2
  export declare function generateConstant(modulePath: string): Promise<"" | "/** constant: begin */\nexport * from '../config/constants.js';\nimport { constants } from '../config/constants.js';\n/** constant: end */\n">;
3
- export declare function generateLocale1(modulePath: string, moduleName: string): Promise<string>;
3
+ export declare function generateLocale1(modulePath: string): Promise<string>;
4
4
  export declare function generateLocale2(contentLocales: string): Promise<"" | "/** locale: begin */\nimport { locales } from './locales.js';\n/** locale: end */\n">;
5
5
  export declare function generateError(modulePath: string): Promise<"" | "/** error: begin */\nexport * from '../config/errors.js';\nimport { errors } from '../config/errors.js';\n/** error: end */\n">;
@@ -25,11 +25,9 @@ import { CliOpenapiConfig } from './bean/cli.openapi.config.ts';
25
25
  import { CliOpenapiGenerate } from './bean/cli.openapi.generate.ts';
26
26
  import { CliRefactorAnotherRender } from './bean/cli.refactor.anotherRender.ts';
27
27
  import { CliRefactorAnotherStyle } from './bean/cli.refactor.anotherStyle.ts';
28
- import { CliRefactorComponentEmits } from './bean/cli.refactor.componentEmits.ts';
29
28
  import { CliRefactorComponentGeneric } from './bean/cli.refactor.componentGeneric.ts';
30
29
  import { CliRefactorComponentModel } from './bean/cli.refactor.componentModel.ts';
31
30
  import { CliRefactorComponentProps } from './bean/cli.refactor.componentProps.ts';
32
- import { CliRefactorComponentSlots } from './bean/cli.refactor.componentSlots.ts';
33
31
  import { CliRefactorFirstRender } from './bean/cli.refactor.firstRender.ts';
34
32
  import { CliRefactorFirstStyle } from './bean/cli.refactor.firstStyle.ts';
35
33
  import { CliRefactorPageParams } from './bean/cli.refactor.pageParams.ts';
@@ -69,8 +67,6 @@ export declare const beans: {
69
67
  'refactor.anotherRender': typeof CliRefactorAnotherRender;
70
68
  'refactor.anotherStyle': typeof CliRefactorAnotherStyle;
71
69
  'refactor.componentProps': typeof CliRefactorComponentProps;
72
- 'refactor.componentEmits': typeof CliRefactorComponentEmits;
73
- 'refactor.componentSlots': typeof CliRefactorComponentSlots;
74
70
  'refactor.componentModel': typeof CliRefactorComponentModel;
75
71
  'refactor.renameComponent': typeof CliRefactorRenameComponent;
76
72
  'tools.metadata': typeof CliToolsMetadata;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-cli-set-front",
3
- "version": "1.2.72",
4
- "gitHead": "7332ce2a4b44504a88c64da981b60336ebef7e9b",
3
+ "version": "1.2.76",
4
+ "gitHead": "3380f8c5d3989242b60dc2a34cbb330f74335cbe",
5
5
  "description": "zova cli-set-front",
6
6
  "keywords": [
7
7
  "framework",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "clean": "rimraf dist dist-cli tsconfig.build.tsbuildinfo tsconfig.cli.tsbuildinfo",
30
- "tsc:publish": "npm run clean && vona :bin:buildGeneral && tsc -p tsconfig.build.json && tsc -p tsconfig.cli.json",
30
+ "tsc:publish": "npm run clean && node ../../../vona/packages-cli/cli/src/bin/vona.ts :bin:buildGeneral && tsc -p tsconfig.build.json && tsc -p tsconfig.cli.json",
31
31
  "prepublishOnly": "npm run tsc:publish",
32
32
  "prepack": "clean-package",
33
33
  "postpack": "clean-package restore && npm run clean"
@@ -36,11 +36,11 @@
36
36
  "@babel/plugin-proposal-decorators": "^7.29.0",
37
37
  "@babel/plugin-transform-class-properties": "^7.28.6",
38
38
  "@babel/plugin-transform-typescript": "^7.28.6",
39
- "@cabloy/cli": "^3.1.14",
40
- "@cabloy/extend": "^3.1.0",
39
+ "@cabloy/cli": "^3.1.17",
40
+ "@cabloy/extend": "^3.2.8",
41
41
  "@cabloy/module-info": "^2.0.0",
42
42
  "@cabloy/openapi-typescript": "^7.9.2",
43
- "@cabloy/utils": "^2.1.19",
43
+ "@cabloy/utils": "^2.1.22",
44
44
  "@cabloy/vite-plugin-babel": "^1.3.3",
45
45
  "@cabloy/vue-babel-plugin-jsx": "^2.0.1",
46
46
  "@cabloy/word-utils": "^2.1.14",
@@ -64,7 +64,7 @@
64
64
  "urllib": "^4.6.11",
65
65
  "vite": "^8.0.14",
66
66
  "yaml": "^2.8.3",
67
- "zova-openapi": "^1.1.14",
68
- "zova-vite": "^1.1.34"
67
+ "zova-openapi": "^1.1.17",
68
+ "zova-vite": "^1.1.38"
69
69
  }
70
70
  }
@@ -1,9 +0,0 @@
1
- declare const _default: {
2
- bean: string;
3
- info: {
4
- version: string;
5
- title: string;
6
- usage: string;
7
- };
8
- };
9
- export default _default;
@@ -1,34 +0,0 @@
1
- declare const _default: {
2
- bean: string;
3
- info: {
4
- version: string;
5
- title: string;
6
- usage: string;
7
- };
8
- options: {
9
- module: {
10
- description: string;
11
- type: string;
12
- };
13
- };
14
- groups: {
15
- default: {
16
- questions: {
17
- componentName: {
18
- type: string;
19
- message: string;
20
- initial: {
21
- expression: string;
22
- };
23
- required: boolean;
24
- };
25
- module: {
26
- type: string;
27
- message: string;
28
- required: boolean;
29
- };
30
- };
31
- };
32
- };
33
- };
34
- export default _default;
@@ -1,34 +0,0 @@
1
- declare const _default: {
2
- bean: string;
3
- info: {
4
- version: string;
5
- title: string;
6
- usage: string;
7
- };
8
- options: {
9
- module: {
10
- description: string;
11
- type: string;
12
- };
13
- };
14
- groups: {
15
- default: {
16
- questions: {
17
- componentName: {
18
- type: string;
19
- message: string;
20
- initial: {
21
- expression: string;
22
- };
23
- required: boolean;
24
- };
25
- module: {
26
- type: string;
27
- message: string;
28
- required: boolean;
29
- };
30
- };
31
- };
32
- };
33
- };
34
- export default _default;