zova-cli-set-front 1.2.60 → 1.2.62
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type z from 'zod';
|
|
2
2
|
|
|
3
3
|
import { TypeFormSchemaScene } from 'zova-module-a-openapi';
|
|
4
|
-
import {
|
|
4
|
+
import { IResourceFormFieldLayoutOptions } from 'zova-module-a-openapi';
|
|
5
5
|
import { TypeSchemaScene } from 'zova-module-a-openapi';
|
|
6
6
|
import { TypeSchemaOrderLevel } from 'zova-module-a-openapi';
|
|
7
7
|
|
|
8
8
|
import { _generalSchemaRest, _order } from './inner.ts';
|
|
9
9
|
|
|
10
10
|
export function schemaRenderLayout<T extends z.ZodType>(
|
|
11
|
-
layoutOptions:
|
|
11
|
+
layoutOptions: IResourceFormFieldLayoutOptions,
|
|
12
12
|
scene?: TypeFormSchemaScene,
|
|
13
13
|
) {
|
|
14
14
|
return function (schema: T): T {
|
package/dist/index.js
CHANGED
|
@@ -352,14 +352,15 @@ class CliBinBuildRest extends BeanCliBase {
|
|
|
352
352
|
const outReleasesDir = path.join(projectPath, 'dist-releases', `rest-${flavor}-${process.env.APP_VERSION}`);
|
|
353
353
|
await fse.copy(outDir, outReleasesDir);
|
|
354
354
|
// copy
|
|
355
|
-
_copyToTarget(outDir, process.env.BUILD_REST_COPY_DIST, bundleNameCopy);
|
|
355
|
+
_copyToTarget(outDir, process.env.BUILD_REST_COPY_DIST, bundleNameCopy, projectPath);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
function _copyToTarget(outDir, target, bundleNameCopy) {
|
|
358
|
+
function _copyToTarget(outDir, target, bundleNameCopy, projectPath) {
|
|
359
359
|
if (!target) return;
|
|
360
360
|
const dirs = target.split(',');
|
|
361
361
|
for (const dir of dirs) {
|
|
362
|
-
const
|
|
362
|
+
const dir2 = path.isAbsolute(dir) ? dir : path.join(projectPath, dir);
|
|
363
|
+
const outReleasesDirCopy = path.join(dir2, bundleNameCopy);
|
|
363
364
|
fse.removeSync(outReleasesDirCopy);
|
|
364
365
|
fse.copySync(outDir, outReleasesDirCopy, {
|
|
365
366
|
preserveTimestamps: true
|
|
@@ -2867,7 +2868,7 @@ declare module 'zova' {
|
|
|
2867
2868
|
|
|
2868
2869
|
async function generateConfig(modulePath) {
|
|
2869
2870
|
const configFile = path.join(modulePath, 'src/config/config.ts');
|
|
2870
|
-
if (!fse.
|
|
2871
|
+
if (!(await fse.pathExists(configFile))) return '';
|
|
2871
2872
|
// combine
|
|
2872
2873
|
const content = `/** config: begin */
|
|
2873
2874
|
export * from '../config/config.js';
|
|
@@ -2878,7 +2879,7 @@ import { config } from '../config/config.js';
|
|
|
2878
2879
|
}
|
|
2879
2880
|
async function generateConstant(modulePath) {
|
|
2880
2881
|
const constantFile = path.join(modulePath, 'src/config/constants.ts');
|
|
2881
|
-
if (!fse.
|
|
2882
|
+
if (!(await fse.pathExists(constantFile))) return '';
|
|
2882
2883
|
// combine
|
|
2883
2884
|
const content = `/** constant: begin */
|
|
2884
2885
|
export * from '../config/constants.js';
|
|
@@ -2931,7 +2932,7 @@ import { locales } from './locales.js';
|
|
|
2931
2932
|
}
|
|
2932
2933
|
async function generateError(modulePath) {
|
|
2933
2934
|
const errorFile = path.join(modulePath, 'src/config/errors.ts');
|
|
2934
|
-
if (!fse.
|
|
2935
|
+
if (!(await fse.pathExists(errorFile))) return '';
|
|
2935
2936
|
// combine
|
|
2936
2937
|
const content = `/** error: begin */
|
|
2937
2938
|
export * from '../config/errors.js';
|
|
@@ -3065,7 +3066,7 @@ async function generateMetadataCustom(cli, globFiles, sceneName, sceneMeta, modu
|
|
|
3065
3066
|
if (globFiles.length === 0) return '';
|
|
3066
3067
|
// custom
|
|
3067
3068
|
let jsFile = path.join(sceneMeta.module.root, 'dist-cli', sceneMeta.metadataCustom.replace('.ts', '.js'));
|
|
3068
|
-
if (!fse.
|
|
3069
|
+
if (!(await fse.pathExists(jsFile))) {
|
|
3069
3070
|
jsFile = path.join(sceneMeta.module.root, 'cli', sceneMeta.metadataCustom);
|
|
3070
3071
|
}
|
|
3071
3072
|
return await cli.helper.importDynamic(jsFile, async instance => {
|
|
@@ -3096,7 +3097,7 @@ async function generateMainSys(modulePath) {
|
|
|
3096
3097
|
}
|
|
3097
3098
|
async function generateMonkey_common(modulePath, commandName) {
|
|
3098
3099
|
const monkeyFile = path.join(modulePath, `src/${commandName}.ts`);
|
|
3099
|
-
if (!fse.
|
|
3100
|
+
if (!(await fse.pathExists(monkeyFile))) return '';
|
|
3100
3101
|
// combine
|
|
3101
3102
|
const content = `/** ${commandName}: begin */
|
|
3102
3103
|
export * from '../${commandName}.js';
|
|
@@ -3106,7 +3107,7 @@ export * from '../${commandName}.js';
|
|
|
3106
3107
|
}
|
|
3107
3108
|
async function generateMain_common(modulePath, commandName) {
|
|
3108
3109
|
const monkeyFile = path.join(modulePath, `src/${commandName}.ts`);
|
|
3109
|
-
if (!fse.
|
|
3110
|
+
if (!(await fse.pathExists(monkeyFile))) return '';
|
|
3110
3111
|
// combine
|
|
3111
3112
|
const content = `/** ${commandName}: begin */
|
|
3112
3113
|
export * from '../${commandName}.js';
|
|
@@ -3115,6 +3116,9 @@ export * from '../${commandName}.js';
|
|
|
3115
3116
|
return content;
|
|
3116
3117
|
}
|
|
3117
3118
|
|
|
3119
|
+
function escapeRegExp(str) {
|
|
3120
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
3121
|
+
}
|
|
3118
3122
|
function checkIgnoreOfParts(parts) {
|
|
3119
3123
|
const indexLast = parts.length - 1;
|
|
3120
3124
|
if (parts[indexLast].endsWith('_')) {
|
|
@@ -3182,12 +3186,12 @@ function extractBeanInfo(sceneName, fileContent, sceneMeta) {
|
|
|
3182
3186
|
// optionsCustomInterface
|
|
3183
3187
|
let optionsCustomInterface;
|
|
3184
3188
|
let optionsCustomInterfaceFrom;
|
|
3185
|
-
let reg = new RegExp(`@${sceneNameCapitalize}<(I${sceneNameCapitalize}Options[^>]*)>`);
|
|
3189
|
+
let reg = new RegExp(`@${escapeRegExp(sceneNameCapitalize)}<(I${escapeRegExp(sceneNameCapitalize)}Options[^>]*)>`);
|
|
3186
3190
|
let matches = fileContent.match(reg);
|
|
3187
3191
|
if (matches) {
|
|
3188
3192
|
optionsCustomInterface = matches[1];
|
|
3189
3193
|
// optionsCustomInterfaceFrom
|
|
3190
|
-
reg = new RegExp(`import {[\\s\\S]*?${optionsCustomInterface}[, ][\\s\\S]*?} from '([^']*)'`);
|
|
3194
|
+
reg = new RegExp(`import {[\\s\\S]*?${escapeRegExp(optionsCustomInterface)}[, ][\\s\\S]*?} from '([^']*)'`);
|
|
3191
3195
|
matches = fileContent.match(reg);
|
|
3192
3196
|
if (matches) {
|
|
3193
3197
|
optionsCustomInterfaceFrom = matches[1];
|
|
@@ -3338,7 +3342,7 @@ async function generateOptionsPackage(cli, globFiles, onionScenesMeta, _moduleNa
|
|
|
3338
3342
|
if (!sceneMeta) throw new Error(`sceneMeta not exists: ${sceneName}`);
|
|
3339
3343
|
if (!sceneMeta.optionsPackage) continue;
|
|
3340
3344
|
changed = true;
|
|
3341
|
-
const matches = fileContent.match(new RegExp(`@${sceneNameCapitalize}[\\S]*?\\(([\\s\\S]*?)\\)\\s*?export class`));
|
|
3345
|
+
const matches = fileContent.match(new RegExp(`@${escapeRegExp(sceneNameCapitalize)}[\\S]*?\\(([\\s\\S]*?)\\)\\s*?export class`));
|
|
3342
3346
|
if (!matches) throw new Error(`${sceneName} options parser error: ${beanNameFull}`);
|
|
3343
3347
|
const onionOptionsStr = matches[1];
|
|
3344
3348
|
const onionOptions = onionOptionsStr ? evaluateSimple(matches[1]) : {};
|
|
@@ -3513,13 +3517,14 @@ class CliToolsMetadata extends BeanCliBase {
|
|
|
3513
3517
|
const modulePath = module.root;
|
|
3514
3518
|
const metaDir = path.join(modulePath, 'src/.metadata');
|
|
3515
3519
|
const metaIndexFile = path.join(metaDir, 'index.ts');
|
|
3516
|
-
if (fse.
|
|
3520
|
+
if ((await fse.pathExists(metaIndexFile)) && !force) {
|
|
3517
3521
|
// do nothing
|
|
3518
3522
|
return;
|
|
3519
3523
|
}
|
|
3520
|
-
// rest
|
|
3521
|
-
await rimraf(path.join(modulePath, 'rest'));
|
|
3522
3524
|
// metaDir
|
|
3525
|
+
await fse.remove(path.join(metaDir, 'component'));
|
|
3526
|
+
await fse.remove(path.join(metaDir, 'page'));
|
|
3527
|
+
await fse.remove(path.join(metaDir, 'icons'));
|
|
3523
3528
|
await this.helper.ensureDir(metaDir);
|
|
3524
3529
|
// relativeNameCapitalize
|
|
3525
3530
|
const relativeNameCapitalize = this.helper.stringToCapitalize(moduleName, '-');
|
|
@@ -3605,7 +3610,6 @@ class CliToolsMetadata extends BeanCliBase {
|
|
|
3605
3610
|
}
|
|
3606
3611
|
// save
|
|
3607
3612
|
await fse.writeFile(metaIndexFile, content);
|
|
3608
|
-
// await this.helper.formatFile({ fileName: metaIndexFile, logPrefix: 'format: ' });
|
|
3609
3613
|
// locales
|
|
3610
3614
|
await this._generateLocales(modulePath, contentLocales1);
|
|
3611
3615
|
// generate this
|
|
@@ -3627,43 +3631,30 @@ class CliToolsMetadata extends BeanCliBase {
|
|
|
3627
3631
|
}
|
|
3628
3632
|
async _generateThis(moduleName, relativeNameCapitalize, modulePath) {
|
|
3629
3633
|
const thisDest = path.join(modulePath, 'src/.metadata/this.ts');
|
|
3630
|
-
if (fse.
|
|
3634
|
+
if (await fse.pathExists(thisDest)) return;
|
|
3631
3635
|
const content = `export const __ThisModule__ = '${moduleName}';
|
|
3632
3636
|
export { ScopeModule${relativeNameCapitalize} as ScopeModule } from './index.js';
|
|
3633
3637
|
`;
|
|
3634
3638
|
// save
|
|
3635
3639
|
await fse.writeFile(thisDest, content);
|
|
3636
3640
|
}
|
|
3641
|
+
async _prependExportIfNeeded(jsContent, exportLine, sourceFile, modulePath) {
|
|
3642
|
+
const sourcePath = path.join(modulePath, sourceFile);
|
|
3643
|
+
if ((await fse.pathExists(sourcePath)) && !jsContent.includes(exportLine)) {
|
|
3644
|
+
return `${exportLine}\n${jsContent}`;
|
|
3645
|
+
}
|
|
3646
|
+
return jsContent;
|
|
3647
|
+
}
|
|
3637
3648
|
async _generateIndex(modulePath) {
|
|
3638
3649
|
let jsContent = '';
|
|
3639
3650
|
const jsFile = path.join(modulePath, 'src/index.ts');
|
|
3640
|
-
if (fse.
|
|
3651
|
+
if (await fse.pathExists(jsFile)) {
|
|
3641
3652
|
jsContent = (await fse.readFile(jsFile)).toString();
|
|
3642
3653
|
}
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
jsContent = `${jsTypes}\n${jsContent}`;
|
|
3648
|
-
}
|
|
3649
|
-
// jsLib
|
|
3650
|
-
const jsLib = "export * from './lib/index.js';";
|
|
3651
|
-
const jsLibFile = path.join(modulePath, 'src/lib/index.ts');
|
|
3652
|
-
if (fse.existsSync(jsLibFile) && !jsContent.includes(jsLib)) {
|
|
3653
|
-
jsContent = `${jsLib}\n${jsContent}`;
|
|
3654
|
-
}
|
|
3655
|
-
// jsLocales
|
|
3656
|
-
const jsLocales = "export * from './.metadata/locales.js';";
|
|
3657
|
-
const jsLocalesFile = path.join(modulePath, 'src/.metadata/locales.ts');
|
|
3658
|
-
if (fse.existsSync(jsLocalesFile) && !jsContent.includes(jsLocales)) {
|
|
3659
|
-
jsContent = `${jsLocales}\n${jsContent}`;
|
|
3660
|
-
}
|
|
3661
|
-
// jsMetadata
|
|
3662
|
-
const jsMetadata = "export * from './.metadata/index.js';";
|
|
3663
|
-
const jsMetadataFile = path.join(modulePath, 'src/.metadata/index.ts');
|
|
3664
|
-
if (fse.existsSync(jsMetadataFile) && !jsContent.includes(jsMetadata)) {
|
|
3665
|
-
jsContent = `${jsMetadata}\n${jsContent}`;
|
|
3666
|
-
}
|
|
3654
|
+
jsContent = await this._prependExportIfNeeded(jsContent, "export * from './types/index.js';", 'src/types/index.ts', modulePath);
|
|
3655
|
+
jsContent = await this._prependExportIfNeeded(jsContent, "export * from './lib/index.js';", 'src/lib/index.ts', modulePath);
|
|
3656
|
+
jsContent = await this._prependExportIfNeeded(jsContent, "export * from './.metadata/locales.js';", 'src/.metadata/locales.ts', modulePath);
|
|
3657
|
+
jsContent = await this._prependExportIfNeeded(jsContent, "export * from './.metadata/index.js';", 'src/.metadata/index.ts', modulePath);
|
|
3667
3658
|
// trim empty
|
|
3668
3659
|
jsContent = jsContent.replace('export {};\n', '');
|
|
3669
3660
|
// write
|
|
@@ -3693,11 +3684,12 @@ export { ScopeModule${relativeNameCapitalize} as ScopeModule } from './index.js'
|
|
|
3693
3684
|
pkg.zovaModule.beansPreload = beansPreload;
|
|
3694
3685
|
}
|
|
3695
3686
|
}
|
|
3696
|
-
// cli
|
|
3697
|
-
for (const name of ['cli', 'icons'
|
|
3687
|
+
// cli
|
|
3688
|
+
for (const name of ['cli', 'icons']) {
|
|
3698
3689
|
const cli = path.join(modulePath, name);
|
|
3699
|
-
if (fse.
|
|
3690
|
+
if (await fse.pathExists(cli)) {
|
|
3700
3691
|
pkg = await _loadPkg();
|
|
3692
|
+
pkg.files ??= [];
|
|
3701
3693
|
const index = pkg.files.indexOf(name);
|
|
3702
3694
|
if (index === -1) {
|
|
3703
3695
|
changed = true;
|
|
@@ -9,6 +9,7 @@ export declare class CliToolsMetadata extends BeanCliBase {
|
|
|
9
9
|
_generateMetadata(moduleName: string, force: boolean): Promise<void>;
|
|
10
10
|
_generateLocales(modulePath: string, contentLocales: any): Promise<void>;
|
|
11
11
|
_generateThis(moduleName: string, relativeNameCapitalize: string, modulePath: string): Promise<void>;
|
|
12
|
+
_prependExportIfNeeded(jsContent: string, exportLine: string, sourceFile: string, modulePath: string): Promise<string>;
|
|
12
13
|
_generateIndex(modulePath: string): Promise<void>;
|
|
13
14
|
_generatePackage(modulePath: string, beansPreload: string[]): Promise<void>;
|
|
14
15
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IGlobBeanFile, OnionSceneMeta } from '@cabloy/module-info';
|
|
2
|
+
export declare function escapeRegExp(str: string): string;
|
|
2
3
|
export declare function checkIgnoreOfParts(parts: string[]): boolean;
|
|
3
4
|
export declare function getScopeModuleName(moduleName: string): string;
|
|
4
5
|
export declare function globAllTsFiles(moduleName: string, modulePath: string): Promise<IGlobBeanFile[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-cli-set-front",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.62",
|
|
4
4
|
"gitHead": "6f675a8cc46d596142c591c28a40cc4d82fcc6cc",
|
|
5
5
|
"description": "zova cli-set-front",
|
|
6
6
|
"keywords": [
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"@cabloy/utils": "^2.1.19",
|
|
37
37
|
"@cabloy/vite-plugin-babel": "^1.3.3",
|
|
38
38
|
"@cabloy/vue-babel-plugin-jsx": "^2.0.1",
|
|
39
|
-
"@cabloy/word-utils": "^2.1.
|
|
39
|
+
"@cabloy/word-utils": "^2.1.12",
|
|
40
40
|
"@typescript/native-preview": "^7.0.0-dev.20260320.1",
|
|
41
41
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
42
42
|
"babel-plugin-transform-typescript-metadata": "^0.4.0",
|
|
43
|
-
"babel-plugin-zova-bean-module": "^1.2.
|
|
44
|
-
"babel-plugin-zova-bean-use": "^1.1.
|
|
45
|
-
"babel-plugin-zova-behavior": "^1.1.
|
|
46
|
-
"babel-plugin-zova-component": "^1.1.
|
|
43
|
+
"babel-plugin-zova-bean-module": "^1.2.12",
|
|
44
|
+
"babel-plugin-zova-bean-use": "^1.1.12",
|
|
45
|
+
"babel-plugin-zova-behavior": "^1.1.12",
|
|
46
|
+
"babel-plugin-zova-component": "^1.1.12",
|
|
47
47
|
"compressing": "^1.10.0",
|
|
48
48
|
"fs-extra": "^11.3.5",
|
|
49
49
|
"globby": "^14.1.0",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"urllib": "^4.6.11",
|
|
58
58
|
"vite": "^8.0.2",
|
|
59
59
|
"yaml": "^2.8.3",
|
|
60
|
-
"zova-openapi": "^1.1.
|
|
61
|
-
"zova-vite": "^1.1.
|
|
60
|
+
"zova-openapi": "^1.1.12",
|
|
61
|
+
"zova-vite": "^1.1.30"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"clean": "rimraf dist dist-cli tsconfig.build.tsbuildinfo tsconfig.cli.tsbuildinfo",
|