vona-cli-set-api 1.0.402 → 1.0.406
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/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 +3314 -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/dist/lib/utils.d.ts +0 -1
- package/dist/utils.d.ts +1 -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
- /package/dist/lib/bean/{toolsBin → toolsIsolate}/dbReset.d.ts +0 -0
- /package/dist/lib/bean/{toolsBin → toolsIsolate}/play.d.ts +0 -0
- /package/dist/lib/bean/{toolsBin → toolsIsolate}/test.d.ts +0 -0
|
@@ -53,7 +53,7 @@ TEST_PATTERNS_IGNORE = '**/test-vona/test/cache/cacheMem.test.ts,**/test-vona/te
|
|
|
53
53
|
DATABASE_DEFAULT_CLIENT = 'sqlite3' # sqlite3/pg/mysql
|
|
54
54
|
|
|
55
55
|
DATABASE_CLIENT_SQLITE3_FILENAME =
|
|
56
|
-
DATABASE_CLIENT_SQLITE3_NATIVEBINDING =
|
|
56
|
+
DATABASE_CLIENT_SQLITE3_NATIVEBINDING = false
|
|
57
57
|
|
|
58
58
|
DATABASE_CLIENT_PG_HOST = 127.0.0.1
|
|
59
59
|
DATABASE_CLIENT_PG_PORT = 5432
|
|
@@ -7,7 +7,7 @@ SERVER_KEYS = <%=argv.SERVER_KEYS_PROD%>
|
|
|
7
7
|
DATABASE_DEFAULT_CLIENT = 'sqlite3' # sqlite3/pg/mysql
|
|
8
8
|
|
|
9
9
|
DATABASE_CLIENT_SQLITE3_FILENAME =
|
|
10
|
-
DATABASE_CLIENT_SQLITE3_NATIVEBINDING =
|
|
10
|
+
DATABASE_CLIENT_SQLITE3_NATIVEBINDING = true
|
|
11
11
|
|
|
12
12
|
DATABASE_CLIENT_PG_HOST = 127.0.0.1
|
|
13
13
|
DATABASE_CLIENT_PG_PORT = 5432
|
|
@@ -8,13 +8,14 @@ declare module '@cabloy/cli' {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-orm\'
|
|
12
|
-
const __snippet_import2 = 'import { Entity<%=argv.resourceNameCapitalize%> } from \'../entity/<%=argv.resourceName%>.ts\'
|
|
11
|
+
const __snippet_import1 = 'import { $tableColumns } from \'vona-module-a-orm\';';
|
|
12
|
+
const __snippet_import2 = 'import { Entity<%=argv.resourceNameCapitalize%> } from \'../entity/<%=argv.resourceName%>.ts\';';
|
|
13
13
|
const __snippet_update = '...$tableColumns(() => Entity<%=argv.resourceNameCapitalize%>, \'name\'),';
|
|
14
14
|
|
|
15
15
|
export default metadataCustomSnippet({
|
|
16
16
|
file: 'src/bean/meta.index.ts',
|
|
17
17
|
language: 'plain',
|
|
18
|
+
format: true,
|
|
18
19
|
init: async ({ cli, argv, targetFile }) => {
|
|
19
20
|
await catchError(() => {
|
|
20
21
|
return cli.helper.invokeCli([
|
|
@@ -32,14 +33,18 @@ export default metadataCustomSnippet({
|
|
|
32
33
|
// import1
|
|
33
34
|
if (!ast.includes(__snippet_import1)) {
|
|
34
35
|
const code = await cli.template.renderContent({ content: __snippet_import1 });
|
|
35
|
-
ast =
|
|
36
|
+
ast = ast.replace('import { Meta } from \'vona-module-a-meta\';', `import { Meta } from 'vona-module-a-meta';\n${code}`);
|
|
36
37
|
}
|
|
37
38
|
// import2
|
|
38
39
|
let code = await cli.template.renderContent({ content: __snippet_import2 });
|
|
39
|
-
ast =
|
|
40
|
+
ast = ast.replace('import { $tableColumns } from \'vona-module-a-orm\';', `import { $tableColumns } from 'vona-module-a-orm';\n${code}`);
|
|
40
41
|
// update
|
|
41
42
|
code = await cli.template.renderContent({ content: __snippet_update });
|
|
42
|
-
|
|
43
|
+
if (ast.includes('indexes: {}')) {
|
|
44
|
+
ast = ast.replace('indexes: {', `indexes: {\n ${code}\n `);
|
|
45
|
+
} else {
|
|
46
|
+
ast = ast.replace('indexes: {', `indexes: {\n ${code}`);
|
|
47
|
+
}
|
|
43
48
|
// ok
|
|
44
49
|
return ast;
|
|
45
50
|
},
|
|
@@ -9,18 +9,20 @@ declare module '@cabloy/cli' {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const __snippet_update = `if (options.version === <%=argv.fileVersion%>) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
12
|
+
const entity<%=argv.resourceNameCapitalize%> = this.scope.entity.<%=argv.resourceName%>;
|
|
13
|
+
await this.bean.model.createTable(entity<%=argv.resourceNameCapitalize%>.$table, table => {
|
|
14
|
+
table.comment(entity<%=argv.resourceNameCapitalize%>.$comment.$table);
|
|
15
|
+
table.basicFields();
|
|
16
|
+
table.string(entity<%=argv.resourceNameCapitalize%>.name, 50).defaultTo(entity<%=argv.resourceNameCapitalize%>.$default.name).comment(entity<%=argv.resourceNameCapitalize%>.$comment.name);
|
|
17
|
+
table.string(entity<%=argv.resourceNameCapitalize%>.description, 255).comment(entity<%=argv.resourceNameCapitalize%>.$comment.description);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
20
21
|
|
|
21
22
|
export default metadataCustomSnippet({
|
|
22
23
|
file: 'src/bean/meta.version.ts',
|
|
23
24
|
language: 'gogo',
|
|
25
|
+
format: true,
|
|
24
26
|
init: async ({ cli, argv, targetFile }) => {
|
|
25
27
|
await catchError(() => {
|
|
26
28
|
return cli.helper.invokeCli([
|
|
@@ -38,7 +40,7 @@ export default metadataCustomSnippet({
|
|
|
38
40
|
// update
|
|
39
41
|
ast.replace('async update(_options: IMetaVersionUpdateOptions) {$$$1}', 'async update(options: IMetaVersionUpdateOptions) {$$$1}');
|
|
40
42
|
const code = await cli.template.renderContent({ content: __snippet_update });
|
|
41
|
-
ast.replace('async update($$$0) {$$$1}', `async update($$$0) {$$$1
|
|
43
|
+
ast.replace('async update($$$0) {$$$1}', `async update($$$0) {\n $$$1\n ${code}}`);
|
|
42
44
|
// ok
|
|
43
45
|
return ast;
|
|
44
46
|
},
|
|
@@ -14,7 +14,7 @@ declare module '@cabloy/cli' {
|
|
|
14
14
|
|
|
15
15
|
export default metadataCustomSnippet({
|
|
16
16
|
file: 'src/config/locale/en-us.ts',
|
|
17
|
-
language: '
|
|
17
|
+
language: 'plain',
|
|
18
18
|
init: async ({ cli, argv, targetFile }) => {
|
|
19
19
|
await catchError(() => {
|
|
20
20
|
return cli.helper.invokeCli([
|
|
@@ -5,7 +5,7 @@ const __resources = { Name: '名称', Description: '描述' };
|
|
|
5
5
|
|
|
6
6
|
export default metadataCustomSnippet({
|
|
7
7
|
file: 'src/config/locale/zh-cn.ts',
|
|
8
|
-
language: '
|
|
8
|
+
language: 'plain',
|
|
9
9
|
async transform({ ast, argv }) {
|
|
10
10
|
return locale_transform({ ast, argv, resources: __resources });
|
|
11
11
|
},
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
1
|
+
import { evaluateSimple } from '@cabloy/utils';
|
|
2
|
+
|
|
3
|
+
export async function locale_transform({ ast, argv, resources }: { ast: string; argv: any; resources: any }) {
|
|
4
|
+
const values = evaluateSimple(ast.replace('export default', '').replace(';', ''));
|
|
5
|
+
resources = Object.assign(
|
|
6
|
+
{},
|
|
7
|
+
resources,
|
|
8
|
+
{ [argv.resourceNameCapitalize]: argv.resourceNameCapitalize },
|
|
9
|
+
values,
|
|
10
|
+
);
|
|
11
|
+
const keys = Object.keys(resources).sort();
|
|
12
|
+
let content = '';
|
|
13
|
+
for (const key of keys) {
|
|
14
|
+
content += ` ${key}: '${resources[key].replaceAll('\'', '\\\'')}',\n`;
|
|
16
15
|
}
|
|
16
|
+
ast = `export default {\n${content}};\n`;
|
|
17
17
|
// ok
|
|
18
18
|
return ast;
|
|
19
19
|
}
|