vona-cli-set-api 1.0.401 → 1.0.405
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/cli/templates/create/project/basic/boilerplate/env/.env +1 -1
- package/cli/templates/create/project/basic/boilerplate/env/.env.prod +1 -1
- package/cli/templates/create/project/basic/boilerplate/env/.env.prod.ci +0 -3
- package/cli/templates/create/project/basic/boilerplate/env/.env.prod.docker +0 -3
- package/cli/templates/create/project/basic/boilerplate/package.original.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/backend/config/config/config.ts +1 -0
- package/cli/templates/tools/crud/snippets/2-meta.index.ts +10 -5
- package/cli/templates/tools/crud/snippets/2-meta.version.ts +11 -9
- package/cli/templates/tools/crud/snippets/3-en-us.ts +1 -1
- package/cli/templates/tools/crud/snippets/4-zh-cn.ts +1 -1
- package/cli/templates/tools/crud/utils.ts +15 -15
- package/dist/index.js +3313 -3
- package/dist/lib/bean/cli.bin.buildGeneral.d.ts +12 -0
- package/dist/lib/beans.d.ts +2 -0
- package/dist/lib/command/bin.buildGeneral.d.ts +19 -0
- package/dist/lib/commands.d.ts +18 -0
- package/package.json +9 -9
- package/dist/lib/bean/cli.bin.build.js +0 -185
- package/dist/lib/bean/cli.bin.buildModule.js +0 -106
- package/dist/lib/bean/cli.bin.dbReset.js +0 -48
- package/dist/lib/bean/cli.bin.dev.js +0 -66
- package/dist/lib/bean/cli.bin.play.js +0 -92
- package/dist/lib/bean/cli.bin.test.js +0 -93
- package/dist/lib/bean/cli.bin.tsc.js +0 -48
- package/dist/lib/bean/cli.create.bean.js +0 -81
- package/dist/lib/bean/cli.create.module.js +0 -73
- package/dist/lib/bean/cli.create.project.js +0 -119
- package/dist/lib/bean/cli.create.suite.js +0 -35
- package/dist/lib/bean/cli.create.test.js +0 -39
- package/dist/lib/bean/cli.default.list.js +0 -93
- package/dist/lib/bean/cli.init.appMonkey.js +0 -24
- package/dist/lib/bean/cli.init.asset.js +0 -28
- package/dist/lib/bean/cli.init.config.js +0 -38
- package/dist/lib/bean/cli.init.constant.js +0 -38
- package/dist/lib/bean/cli.init.error.js +0 -49
- package/dist/lib/bean/cli.init.lib.js +0 -38
- package/dist/lib/bean/cli.init.locale.js +0 -38
- package/dist/lib/bean/cli.init.main.js +0 -38
- package/dist/lib/bean/cli.init.monkey.js +0 -64
- package/dist/lib/bean/cli.init.static.js +0 -38
- package/dist/lib/bean/cli.init.types.js +0 -38
- package/dist/lib/bean/cli.tools.crud.js +0 -46
- package/dist/lib/bean/cli.tools.deps.js +0 -42
- package/dist/lib/bean/cli.tools.metadata.js +0 -234
- package/dist/lib/bean/toolsBin/configUtils.js +0 -56
- package/dist/lib/bean/toolsBin/dbReset.js +0 -8
- package/dist/lib/bean/toolsBin/generateEntryFiles.js +0 -90
- package/dist/lib/bean/toolsBin/generateVonaMeta.js +0 -17
- package/dist/lib/bean/toolsBin/generateZod.js +0 -48
- package/dist/lib/bean/toolsBin/play.js +0 -59
- package/dist/lib/bean/toolsBin/test.js +0 -137
- package/dist/lib/bean/toolsBin/types.js +0 -1
- package/dist/lib/bean/toolsMetadata/generateBeanGenerals.js +0 -33
- package/dist/lib/bean/toolsMetadata/generateConfig.js +0 -62
- package/dist/lib/bean/toolsMetadata/generateMetadataCustom.js +0 -23
- package/dist/lib/bean/toolsMetadata/generateMonkey.js +0 -24
- package/dist/lib/bean/toolsMetadata/generateOnions.js +0 -112
- package/dist/lib/bean/toolsMetadata/generateScope.js +0 -83
- package/dist/lib/bean/toolsMetadata/generateScopeResources.js +0 -33
- package/dist/lib/bean/toolsMetadata/generateScopeResourcesMeta.js +0 -13
- package/dist/lib/bean/toolsMetadata/utils.js +0 -84
- package/dist/lib/beans.js +0 -56
- package/dist/lib/command/bin.build.js +0 -18
- package/dist/lib/command/bin.buildModule.js +0 -18
- package/dist/lib/command/bin.dbReset.js +0 -14
- package/dist/lib/command/bin.dev.js +0 -18
- package/dist/lib/command/bin.play.js +0 -27
- package/dist/lib/command/bin.test.js +0 -18
- package/dist/lib/command/bin.tsc.js +0 -14
- package/dist/lib/command/create.bean.js +0 -46
- package/dist/lib/command/create.module.js +0 -36
- package/dist/lib/command/create.project.js +0 -43
- package/dist/lib/command/create.suite.js +0 -23
- package/dist/lib/command/create.test.js +0 -33
- package/dist/lib/command/default.list.js +0 -18
- package/dist/lib/command/init.appMonkey.js +0 -10
- package/dist/lib/command/init.asset.js +0 -33
- package/dist/lib/command/init.config.js +0 -10
- package/dist/lib/command/init.constant.js +0 -10
- package/dist/lib/command/init.error.js +0 -10
- package/dist/lib/command/init.lib.js +0 -10
- package/dist/lib/command/init.locale.js +0 -10
- package/dist/lib/command/init.main.js +0 -10
- package/dist/lib/command/init.monkey.js +0 -10
- package/dist/lib/command/init.static.js +0 -10
- package/dist/lib/command/init.types.js +0 -10
- package/dist/lib/command/tools.crud.js +0 -33
- package/dist/lib/command/tools.deps.js +0 -9
- package/dist/lib/command/tools.metadata.js +0 -14
- package/dist/lib/commands.js +0 -67
- package/dist/lib/this.js +0 -1
- package/dist/lib/utils.js +0 -80
- package/dist/typings.js +0 -1
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { replaceTemplate } from '@cabloy/utils';
|
|
2
|
-
import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
3
|
-
import { beanFullNameFromOnionName } from 'vona-core';
|
|
4
|
-
import { extractBeanInfo, getScopeModuleName, globBeanFiles } from "./utils.js";
|
|
5
|
-
export async function generateOnions(sceneName, sceneMeta, moduleName, modulePath) {
|
|
6
|
-
const scopeModuleName = getScopeModuleName(moduleName);
|
|
7
|
-
const sceneNameCapitalize = toUpperCaseFirstChar(sceneName);
|
|
8
|
-
const globFiles = await globBeanFiles(sceneName, sceneMeta, moduleName, modulePath);
|
|
9
|
-
if (globFiles.length === 0)
|
|
10
|
-
return '';
|
|
11
|
-
//
|
|
12
|
-
const contentExports = [];
|
|
13
|
-
const contentScopes = [];
|
|
14
|
-
const contentImports = [];
|
|
15
|
-
const contentRecordsGlobal = [];
|
|
16
|
-
const contentRecordsLocal = [];
|
|
17
|
-
let needImportOptionsGlobalInterface;
|
|
18
|
-
for (const globFile of globFiles) {
|
|
19
|
-
const { fileContent, fileNameJSRelative, sceneName, className, beanNameFull, isIgnore, isVirtual } = globFile;
|
|
20
|
-
const isBeanGlobal = fileNameJSRelative.includes('../bean/bean.');
|
|
21
|
-
contentExports.push(`export * from '${fileNameJSRelative}';`);
|
|
22
|
-
if (isIgnore)
|
|
23
|
-
continue; // get scope() also can be ignored
|
|
24
|
-
// options
|
|
25
|
-
let onionOptions;
|
|
26
|
-
if (!sceneMeta.optionsNone) {
|
|
27
|
-
// fileInfo
|
|
28
|
-
const fileInfo = extractBeanInfo(sceneName, fileContent, sceneMeta);
|
|
29
|
-
// import options
|
|
30
|
-
if (fileInfo.optionsCustomInterface) {
|
|
31
|
-
contentImports.push(`import type { ${fileInfo.optionsCustomInterface} } from '${fileInfo.optionsCustomInterfaceFrom || fileNameJSRelative}';`);
|
|
32
|
-
}
|
|
33
|
-
// valueOptionsCustomInterface
|
|
34
|
-
let valueOptionsCustomInterface = fileInfo.optionsCustomInterface;
|
|
35
|
-
if (valueOptionsCustomInterface && sceneMeta.optionsCustomInterfaceTemplate) {
|
|
36
|
-
valueOptionsCustomInterface = replaceTemplate(sceneMeta.optionsCustomInterfaceTemplate, { optionsCustomInterface: valueOptionsCustomInterface });
|
|
37
|
-
}
|
|
38
|
-
// record
|
|
39
|
-
if (fileInfo.isGlobal) {
|
|
40
|
-
if (valueOptionsCustomInterface) {
|
|
41
|
-
onionOptions = valueOptionsCustomInterface;
|
|
42
|
-
contentRecordsGlobal.push(`'${beanNameFull}': ${valueOptionsCustomInterface};`);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (sceneMeta.optionsGlobalInterfaceName) {
|
|
46
|
-
onionOptions = sceneMeta.optionsGlobalInterfaceName;
|
|
47
|
-
contentRecordsGlobal.push(`'${beanNameFull}': ${sceneMeta.optionsGlobalInterfaceName};`);
|
|
48
|
-
needImportOptionsGlobalInterface = true;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
contentRecordsGlobal.push(`'${beanNameFull}': never;`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
if (valueOptionsCustomInterface) {
|
|
57
|
-
onionOptions = valueOptionsCustomInterface;
|
|
58
|
-
contentRecordsLocal.push(`'${beanNameFull}': ${valueOptionsCustomInterface};`);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
contentRecordsLocal.push(`'${beanNameFull}': never;`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// get scope() also can be ignored
|
|
66
|
-
if (!['entity', 'dto'].includes(sceneName) && !isVirtual) {
|
|
67
|
-
contentScopes.push(`
|
|
68
|
-
export interface ${className} {
|
|
69
|
-
/** @internal */
|
|
70
|
-
get scope(): ${scopeModuleName};
|
|
71
|
-
}`);
|
|
72
|
-
if (!isBeanGlobal) {
|
|
73
|
-
const contentOnionOptions = onionOptions ? `get $onionOptions(): ${onionOptions};` : '';
|
|
74
|
-
contentScopes.push(`
|
|
75
|
-
export interface ${className} {
|
|
76
|
-
get $beanFullName(): '${beanFullNameFromOnionName(beanNameFull, sceneName)}';
|
|
77
|
-
get $onionName(): '${beanNameFull}';
|
|
78
|
-
${contentOnionOptions}
|
|
79
|
-
}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// middlewareGlobal
|
|
84
|
-
const exportRecordsMiddlewareGlobal = `
|
|
85
|
-
export interface I${sceneNameCapitalize}Record${sceneMeta.hasLocal ? 'Global' : ''} {
|
|
86
|
-
${contentRecordsGlobal.join('\n')}
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
// middlewareLocal
|
|
90
|
-
const exportRecordsMiddlewareLocal = `
|
|
91
|
-
export interface I${sceneNameCapitalize}RecordLocal {
|
|
92
|
-
${contentRecordsLocal.join('\n')}
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
// combine
|
|
96
|
-
const content = `/** ${sceneName}: begin */
|
|
97
|
-
${contentExports.join('\n')}
|
|
98
|
-
${contentImports.join('\n')}
|
|
99
|
-
${needImportOptionsGlobalInterface
|
|
100
|
-
? `import { type ${sceneMeta.optionsGlobalInterfaceName} } from '${sceneMeta.optionsGlobalInterfaceFrom || 'vona'}';`
|
|
101
|
-
: `import '${sceneMeta.optionsGlobalInterfaceFrom || 'vona'}';`}
|
|
102
|
-
declare module '${sceneMeta.optionsGlobalInterfaceFrom || 'vona'}' {
|
|
103
|
-
${contentRecordsGlobal.length > 0 ? exportRecordsMiddlewareGlobal : ''}
|
|
104
|
-
${contentRecordsLocal.length > 0 ? exportRecordsMiddlewareLocal : ''}
|
|
105
|
-
}
|
|
106
|
-
declare module 'vona-module-${moduleName}' {
|
|
107
|
-
${contentScopes.join('\n')}
|
|
108
|
-
}
|
|
109
|
-
/** ${sceneName}: end */
|
|
110
|
-
`;
|
|
111
|
-
return content;
|
|
112
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { relativeNameToCapitalize } from '@cabloy/module-info';
|
|
2
|
-
export async function generateScope(moduleName, relativeNameCapitalize, scopeResources, options) {
|
|
3
|
-
// scopeVariable
|
|
4
|
-
const parts = moduleName.split('-');
|
|
5
|
-
const scopeVariable = parts[0] === 'a' ? parts[1] : relativeNameToCapitalize(moduleName, false);
|
|
6
|
-
const contentImports = [];
|
|
7
|
-
const contentRecords = [];
|
|
8
|
-
// basic
|
|
9
|
-
contentImports.push('BeanScopeBase');
|
|
10
|
-
// util
|
|
11
|
-
contentImports.push('type BeanScopeUtil');
|
|
12
|
-
contentRecords.push('util: BeanScopeUtil;');
|
|
13
|
-
//
|
|
14
|
-
if (options.config) {
|
|
15
|
-
contentImports.push('type TypeModuleConfig');
|
|
16
|
-
contentRecords.push('config: TypeModuleConfig<typeof config>;');
|
|
17
|
-
}
|
|
18
|
-
if (options.errors) {
|
|
19
|
-
contentImports.push('type TypeModuleErrors');
|
|
20
|
-
contentRecords.push('error: TypeModuleErrors<typeof errors>;');
|
|
21
|
-
}
|
|
22
|
-
if (options.locales) {
|
|
23
|
-
contentImports.push('type TypeModuleLocales');
|
|
24
|
-
contentImports.push('type TypeLocaleBase');
|
|
25
|
-
contentRecords.push('locale: TypeModuleLocales<(typeof locales)[TypeLocaleBase]>;');
|
|
26
|
-
}
|
|
27
|
-
if (options.constants) {
|
|
28
|
-
contentImports.push('type TypeModuleConstants');
|
|
29
|
-
contentRecords.push('constant: TypeModuleConstants<typeof constants>;');
|
|
30
|
-
}
|
|
31
|
-
// loop
|
|
32
|
-
for (const sceneName in scopeResources) {
|
|
33
|
-
contentRecords.push(`${sceneName}: ${scopeResources[sceneName]};`);
|
|
34
|
-
}
|
|
35
|
-
// combine
|
|
36
|
-
const content = `/** scope: begin */
|
|
37
|
-
import { ${contentImports.join(', ')} } from 'vona';
|
|
38
|
-
import { Scope } from '${moduleName === 'a-bean' ? '../lib/scope.ts' : 'vona-module-a-bean'}';
|
|
39
|
-
|
|
40
|
-
@Scope()
|
|
41
|
-
export class ScopeModule${relativeNameCapitalize} extends BeanScopeBase {}
|
|
42
|
-
|
|
43
|
-
export interface ScopeModule${relativeNameCapitalize} {
|
|
44
|
-
${contentRecords.join('\n')}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
import 'vona';
|
|
48
|
-
declare module 'vona' {
|
|
49
|
-
export interface IBeanScopeRecord {
|
|
50
|
-
'${moduleName}': ScopeModule${relativeNameCapitalize};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface IBeanScopeContainer {
|
|
54
|
-
${scopeVariable}: ScopeModule${relativeNameCapitalize};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
${options.config
|
|
58
|
-
? `export interface IBeanScopeConfig {
|
|
59
|
-
'${moduleName}': ReturnType<typeof config>;
|
|
60
|
-
}`
|
|
61
|
-
: ''}
|
|
62
|
-
|
|
63
|
-
${options.locales
|
|
64
|
-
? `export interface IBeanScopeLocale {
|
|
65
|
-
'${moduleName}': (typeof locales)[TypeLocaleBase];
|
|
66
|
-
}`
|
|
67
|
-
: ''}
|
|
68
|
-
|
|
69
|
-
${options.errors
|
|
70
|
-
? `export interface IBeanScopeErrors {
|
|
71
|
-
'${moduleName}': typeof errors;
|
|
72
|
-
}`
|
|
73
|
-
: ''}
|
|
74
|
-
}
|
|
75
|
-
${options.locales
|
|
76
|
-
? `\nexport function $locale<K extends keyof (typeof locales)[TypeLocaleBase]>(key: K): \`${moduleName}::\${K}\` {
|
|
77
|
-
return \`${moduleName}::\${key}\`;
|
|
78
|
-
}`
|
|
79
|
-
: ''}
|
|
80
|
-
/** scope: end */
|
|
81
|
-
`;
|
|
82
|
-
return content;
|
|
83
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { replaceTemplate, toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
2
|
-
import { globBeanFiles } from "./utils.js";
|
|
3
|
-
export async function generateScopeResources(sceneName, sceneMeta, moduleName, modulePath) {
|
|
4
|
-
const sceneNameCapitalize = toUpperCaseFirstChar(sceneName);
|
|
5
|
-
const globFiles = await globBeanFiles(sceneName, sceneMeta, moduleName, modulePath);
|
|
6
|
-
if (globFiles.length === 0)
|
|
7
|
-
return '';
|
|
8
|
-
//
|
|
9
|
-
const contentImports = [];
|
|
10
|
-
const contentRecords = [];
|
|
11
|
-
for (const globFile of globFiles) {
|
|
12
|
-
const { fileNameJSRelative, className, beanName, isIgnore } = globFile;
|
|
13
|
-
if (isIgnore)
|
|
14
|
-
continue;
|
|
15
|
-
contentImports.push(`import type { ${className} } from '${fileNameJSRelative}';`);
|
|
16
|
-
let typeClassName = className;
|
|
17
|
-
if (sceneMeta.scopeResourceTypeTemplate) {
|
|
18
|
-
typeClassName = replaceTemplate(sceneMeta.scopeResourceTypeTemplate, { className });
|
|
19
|
-
}
|
|
20
|
-
contentRecords.push(`'${beanName}': ${typeClassName};`);
|
|
21
|
-
}
|
|
22
|
-
if (contentImports.length === 0)
|
|
23
|
-
return '';
|
|
24
|
-
// combine
|
|
25
|
-
const content = `/** ${sceneName}: begin */
|
|
26
|
-
${contentImports.join('\n')}
|
|
27
|
-
export interface IModule${sceneNameCapitalize} {
|
|
28
|
-
${contentRecords.join('\n')}
|
|
29
|
-
}
|
|
30
|
-
/** ${sceneName}: end */
|
|
31
|
-
`;
|
|
32
|
-
return content;
|
|
33
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
2
|
-
import { globby } from 'globby';
|
|
3
|
-
export async function generateScopeResourcesMeta(metaName, _metaMeta, _sceneName, _sceneMeta, _moduleName, modulePath) {
|
|
4
|
-
const files = await globby(`src/bean/meta.${metaName}.ts`, { cwd: modulePath });
|
|
5
|
-
if (files.length === 0)
|
|
6
|
-
return '';
|
|
7
|
-
// combine
|
|
8
|
-
const content = `/** meta ${metaName}: begin */
|
|
9
|
-
import type { Meta${toUpperCaseFirstChar(metaName)} } from '../bean/meta.${metaName}.ts';
|
|
10
|
-
/** meta ${metaName}: end */
|
|
11
|
-
`;
|
|
12
|
-
return content;
|
|
13
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { stringToCapitalize, toUpperCaseFirstChar } from '@cabloy/word-utils';
|
|
3
|
-
import fse from 'fs-extra';
|
|
4
|
-
import { globby } from 'globby';
|
|
5
|
-
export function checkIgnoreOfParts(parts) {
|
|
6
|
-
const indexLast = parts.length - 1;
|
|
7
|
-
if (parts[indexLast].endsWith('_')) {
|
|
8
|
-
parts[indexLast] = parts[indexLast].substring(0, parts[indexLast].length - 1);
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
export function getScopeModuleName(moduleName) {
|
|
14
|
-
return `ScopeModule${stringToCapitalize(moduleName, '-')}`;
|
|
15
|
-
}
|
|
16
|
-
export async function globBeanFiles(sceneName, sceneMeta, moduleName, modulePath) {
|
|
17
|
-
const result = [];
|
|
18
|
-
const sceneNameCapitalize = toUpperCaseFirstChar(sceneName);
|
|
19
|
-
const pattern = sceneMeta.sceneIsolate
|
|
20
|
-
? `src/${sceneName}/*.ts`
|
|
21
|
-
: `src/bean/${sceneName}.*.ts`;
|
|
22
|
-
const files = await globby(pattern, { cwd: modulePath });
|
|
23
|
-
if (files.length === 0)
|
|
24
|
-
return result;
|
|
25
|
-
files.sort();
|
|
26
|
-
for (const file of files) {
|
|
27
|
-
const filePath = path.join(modulePath, file);
|
|
28
|
-
const fileName = path.basename(file);
|
|
29
|
-
if (fileName.startsWith('_'))
|
|
30
|
-
continue;
|
|
31
|
-
const parts = fileName.split('.').slice(0, -1);
|
|
32
|
-
if (sceneMeta.sceneIsolate && parts.length !== 1)
|
|
33
|
-
continue;
|
|
34
|
-
if (!sceneMeta.sceneIsolate && parts.length < 2)
|
|
35
|
-
continue;
|
|
36
|
-
const isIgnore = checkIgnoreOfParts(parts);
|
|
37
|
-
const fileNameJS = fileName; // fileName.replace('.ts', '.js');
|
|
38
|
-
const fileNameJSRelative = sceneMeta.sceneIsolate ? `../${sceneName}/${fileNameJS}` : `../bean/${fileNameJS}`;
|
|
39
|
-
const className = (sceneMeta.sceneIsolate ? sceneNameCapitalize : '') + parts.map(item => toUpperCaseFirstChar(item)).join('');
|
|
40
|
-
const beanName = parts[parts.length - 1];
|
|
41
|
-
const beanNameFull = `${moduleName}:${beanName}`;
|
|
42
|
-
const beanNameCapitalize = toUpperCaseFirstChar(beanName);
|
|
43
|
-
const fileContent = isIgnore ? '' : fse.readFileSync(filePath).toString();
|
|
44
|
-
const isVirtual = fileContent.includes('@Virtual()');
|
|
45
|
-
result.push({
|
|
46
|
-
sceneName,
|
|
47
|
-
sceneNameCapitalize,
|
|
48
|
-
file: filePath,
|
|
49
|
-
fileContent,
|
|
50
|
-
fileName,
|
|
51
|
-
fileNameJS,
|
|
52
|
-
fileNameJSRelative,
|
|
53
|
-
className,
|
|
54
|
-
beanName,
|
|
55
|
-
beanNameFull,
|
|
56
|
-
beanNameCapitalize,
|
|
57
|
-
isIgnore,
|
|
58
|
-
isVirtual,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
export function extractBeanInfo(sceneName, fileContent, sceneMeta) {
|
|
64
|
-
const sceneNameCapitalize = toUpperCaseFirstChar(sceneName);
|
|
65
|
-
// optionsCustomInterface
|
|
66
|
-
let optionsCustomInterface;
|
|
67
|
-
let optionsCustomInterfaceFrom;
|
|
68
|
-
let reg = new RegExp(`@${sceneNameCapitalize}<(I${sceneNameCapitalize}Options[^>]*)>`);
|
|
69
|
-
let matches = fileContent.match(reg);
|
|
70
|
-
if (matches) {
|
|
71
|
-
optionsCustomInterface = matches[1];
|
|
72
|
-
// optionsCustomInterfaceFrom
|
|
73
|
-
reg = new RegExp(`import type {[\\s\\S]*?${optionsCustomInterface}[, ][\\s\\S]*?} from '([^']*)'`);
|
|
74
|
-
matches = fileContent.match(reg);
|
|
75
|
-
if (matches) {
|
|
76
|
-
optionsCustomInterfaceFrom = matches[1];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// isGlobal
|
|
80
|
-
const isGlobal = sceneMeta.hasLocal
|
|
81
|
-
? fileContent.match(/@.*?\(\{([\s\S]*?)global: true([\s\S]*?)\}([\s\S]*?)\)\s*export class/)
|
|
82
|
-
: true;
|
|
83
|
-
return { optionsCustomInterface, optionsCustomInterfaceFrom, isGlobal };
|
|
84
|
-
}
|
package/dist/lib/beans.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { CliBinBuild } from "./bean/cli.bin.build.js";
|
|
2
|
-
import { CliBinBuildModule } from "./bean/cli.bin.buildModule.js";
|
|
3
|
-
import { CliBinDbReset } from "./bean/cli.bin.dbReset.js";
|
|
4
|
-
import { CliBinDev } from "./bean/cli.bin.dev.js";
|
|
5
|
-
import { CliBinPlay } from "./bean/cli.bin.play.js";
|
|
6
|
-
import { CliBinTest } from "./bean/cli.bin.test.js";
|
|
7
|
-
import { CliBinTsc } from "./bean/cli.bin.tsc.js";
|
|
8
|
-
import { CliCreateBean } from "./bean/cli.create.bean.js";
|
|
9
|
-
import { CliCreateModule } from "./bean/cli.create.module.js";
|
|
10
|
-
import { CliCreateProject } from "./bean/cli.create.project.js";
|
|
11
|
-
import { CliCreateSuite } from "./bean/cli.create.suite.js";
|
|
12
|
-
import { CliCreateTest } from "./bean/cli.create.test.js";
|
|
13
|
-
import { CliDefaultList } from "./bean/cli.default.list.js";
|
|
14
|
-
import { CliInitAppMonkey } from "./bean/cli.init.appMonkey.js";
|
|
15
|
-
import { CliInitAsset } from "./bean/cli.init.asset.js";
|
|
16
|
-
import { CliInitConfig } from "./bean/cli.init.config.js";
|
|
17
|
-
import { CliInitConstant } from "./bean/cli.init.constant.js";
|
|
18
|
-
import { CliInitError } from "./bean/cli.init.error.js";
|
|
19
|
-
import { CliInitLib } from "./bean/cli.init.lib.js";
|
|
20
|
-
import { CliInitLocale } from "./bean/cli.init.locale.js";
|
|
21
|
-
import { CliInitMain } from "./bean/cli.init.main.js";
|
|
22
|
-
import { CliInitMonkey } from "./bean/cli.init.monkey.js";
|
|
23
|
-
import { CliInitStatic } from "./bean/cli.init.static.js";
|
|
24
|
-
import { CliInitTypes } from "./bean/cli.init.types.js";
|
|
25
|
-
import { CliToolsCrud } from "./bean/cli.tools.crud.js";
|
|
26
|
-
import { CliToolsDeps } from "./bean/cli.tools.deps.js";
|
|
27
|
-
import { CliToolsMetadata } from "./bean/cli.tools.metadata.js";
|
|
28
|
-
export const beans = {
|
|
29
|
-
'default.list': CliDefaultList,
|
|
30
|
-
'bin.build': CliBinBuild,
|
|
31
|
-
'bin.buildModule': CliBinBuildModule,
|
|
32
|
-
'bin.dbReset': CliBinDbReset,
|
|
33
|
-
'bin.play': CliBinPlay,
|
|
34
|
-
'bin.dev': CliBinDev,
|
|
35
|
-
'bin.test': CliBinTest,
|
|
36
|
-
'bin.tsc': CliBinTsc,
|
|
37
|
-
'create.suite': CliCreateSuite,
|
|
38
|
-
'create.bean': CliCreateBean,
|
|
39
|
-
'create.module': CliCreateModule,
|
|
40
|
-
'create.project': CliCreateProject,
|
|
41
|
-
'create.test': CliCreateTest,
|
|
42
|
-
'init.config': CliInitConfig,
|
|
43
|
-
'init.constant': CliInitConstant,
|
|
44
|
-
'init.error': CliInitError,
|
|
45
|
-
'init.locale': CliInitLocale,
|
|
46
|
-
'init.monkey': CliInitMonkey,
|
|
47
|
-
'init.main': CliInitMain,
|
|
48
|
-
'init.static': CliInitStatic,
|
|
49
|
-
'init.asset': CliInitAsset,
|
|
50
|
-
'init.lib': CliInitLib,
|
|
51
|
-
'init.types': CliInitTypes,
|
|
52
|
-
'init.appMonkey': CliInitAppMonkey,
|
|
53
|
-
'tools.deps': CliToolsDeps,
|
|
54
|
-
'tools.metadata': CliToolsMetadata,
|
|
55
|
-
'tools.crud': CliToolsCrud,
|
|
56
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'bin.build',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Tools: Bin',
|
|
6
|
-
usage: 'vona :bin:build [--workers=] [--flavor=] [--sourcemap=]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
workers: {
|
|
10
|
-
description: 'workers',
|
|
11
|
-
type: 'number',
|
|
12
|
-
},
|
|
13
|
-
flavor: {
|
|
14
|
-
description: 'flavor',
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'bin.buildModule',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Tools: Bin',
|
|
6
|
-
usage: 'vona :bin:buildModule [--minify] [--sourcemap]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
minify: {
|
|
10
|
-
description: 'minify',
|
|
11
|
-
type: 'boolean',
|
|
12
|
-
},
|
|
13
|
-
sourcemap: {
|
|
14
|
-
description: 'sourcemap',
|
|
15
|
-
type: 'boolean',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'bin.dev',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Bin: Dev',
|
|
6
|
-
usage: 'vona :bin:dev [--workers=] [--flavor=]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
workers: {
|
|
10
|
-
description: 'workers',
|
|
11
|
-
type: 'number',
|
|
12
|
-
},
|
|
13
|
-
flavor: {
|
|
14
|
-
description: 'flavor',
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'bin.play',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Bin: Play',
|
|
6
|
-
usage: 'vona :bin:play [index.ts] [--flavor=] [--retainRuntime=] [--attach]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
mode: {
|
|
10
|
-
description: 'mode',
|
|
11
|
-
type: 'string',
|
|
12
|
-
},
|
|
13
|
-
flavor: {
|
|
14
|
-
description: 'flavor',
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
retainRuntime: {
|
|
18
|
-
description: 'retainRuntime',
|
|
19
|
-
type: 'boolean',
|
|
20
|
-
},
|
|
21
|
-
attach: {
|
|
22
|
-
alias: 'a',
|
|
23
|
-
description: 'attach',
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'bin.test',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Bin: Test',
|
|
6
|
-
usage: 'vona :bin:test [--coverage=] [--flavor=]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
coverage: {
|
|
10
|
-
description: 'coverage',
|
|
11
|
-
type: 'boolean',
|
|
12
|
-
},
|
|
13
|
-
flavor: {
|
|
14
|
-
description: 'flavor',
|
|
15
|
-
type: 'string',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'create.bean',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Create Bean',
|
|
6
|
-
usage: 'vona :create:bean sceneName beanName [--module=] [--boilerplate=]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
module: {
|
|
10
|
-
alias: 'm',
|
|
11
|
-
description: 'module name',
|
|
12
|
-
type: 'string',
|
|
13
|
-
},
|
|
14
|
-
boilerplate: {
|
|
15
|
-
description: 'boilerplate',
|
|
16
|
-
type: 'string',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
groups: {
|
|
20
|
-
default: {
|
|
21
|
-
questions: {
|
|
22
|
-
sceneName: {
|
|
23
|
-
type: 'input',
|
|
24
|
-
message: 'sceneName',
|
|
25
|
-
initial: {
|
|
26
|
-
expression: 'context.argv._[0]',
|
|
27
|
-
},
|
|
28
|
-
required: true,
|
|
29
|
-
},
|
|
30
|
-
beanName: {
|
|
31
|
-
type: 'input',
|
|
32
|
-
message: 'beanName',
|
|
33
|
-
initial: {
|
|
34
|
-
expression: 'context.argv._[1]',
|
|
35
|
-
},
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
module: {
|
|
39
|
-
type: 'input',
|
|
40
|
-
message: 'module name',
|
|
41
|
-
required: true,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'create.module',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Create Module',
|
|
6
|
-
usage: 'vona :create:module moduleName [--suite=] [--force]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
suite: {
|
|
10
|
-
description: 'suite name',
|
|
11
|
-
type: 'string',
|
|
12
|
-
},
|
|
13
|
-
force: {
|
|
14
|
-
description: 'force',
|
|
15
|
-
type: 'boolean',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
groups: {
|
|
19
|
-
default: {
|
|
20
|
-
questions: {
|
|
21
|
-
name: {
|
|
22
|
-
type: 'input',
|
|
23
|
-
message: 'module name',
|
|
24
|
-
initial: {
|
|
25
|
-
expression: 'context.argv._[0]',
|
|
26
|
-
},
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
|
-
suite: {
|
|
30
|
-
type: 'input',
|
|
31
|
-
message: 'suite name',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'create.project',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Create Project',
|
|
6
|
-
usage: 'vona :create:project projectName [--template=] [--force]',
|
|
7
|
-
},
|
|
8
|
-
options: {
|
|
9
|
-
template: {
|
|
10
|
-
description: 'template',
|
|
11
|
-
type: 'string',
|
|
12
|
-
},
|
|
13
|
-
force: {
|
|
14
|
-
description: 'force',
|
|
15
|
-
type: 'boolean',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
groups: {
|
|
19
|
-
default: {
|
|
20
|
-
questions: {
|
|
21
|
-
template: {
|
|
22
|
-
type: 'select',
|
|
23
|
-
message: 'Specify the project template',
|
|
24
|
-
choices: [
|
|
25
|
-
{ name: 'basic', message: 'basic' },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
moduleInfo: {
|
|
31
|
-
questions: {
|
|
32
|
-
name: {
|
|
33
|
-
type: 'input',
|
|
34
|
-
message: 'project name',
|
|
35
|
-
initial: {
|
|
36
|
-
expression: 'context.argv._[0]',
|
|
37
|
-
},
|
|
38
|
-
required: true,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
bean: 'create.suite',
|
|
3
|
-
info: {
|
|
4
|
-
version: '5.0.0',
|
|
5
|
-
title: 'Cli: Create Suite',
|
|
6
|
-
usage: 'vona :create:suite suiteName',
|
|
7
|
-
},
|
|
8
|
-
options: {},
|
|
9
|
-
groups: {
|
|
10
|
-
suiteInfo: {
|
|
11
|
-
questions: {
|
|
12
|
-
name: {
|
|
13
|
-
type: 'input',
|
|
14
|
-
message: 'suite name',
|
|
15
|
-
initial: {
|
|
16
|
-
expression: 'context.argv._[0]',
|
|
17
|
-
},
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|