vona-cli-set-api 1.0.39 → 1.0.40
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/src/suite/a-home/modules/home-index/test/home.test.ts +1 -1
- package/dist/lib/bean/cli.bin.build.js +1 -1
- package/dist/lib/bean/cli.bin.buildModule.d.ts +12 -0
- package/dist/lib/bean/cli.bin.buildModule.js +106 -0
- package/dist/lib/beans.d.ts +2 -0
- package/dist/lib/beans.js +2 -0
- package/dist/lib/command/bin.buildModule.d.ts +19 -0
- package/dist/lib/command/bin.buildModule.js +18 -0
- package/dist/lib/commands.d.ts +18 -0
- package/dist/lib/commands.js +2 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import assert from 'node:assert';
|
|
|
2
2
|
import { describe, it } from 'node:test';
|
|
3
3
|
import { app } from 'vona-mock';
|
|
4
4
|
|
|
5
|
-
describe
|
|
5
|
+
describe('home.test.ts', () => {
|
|
6
6
|
it('action:home', async () => {
|
|
7
7
|
await app.bean.executor.mockCtx(async () => {
|
|
8
8
|
const res = await app.bean.executor.performAction('get', '//');
|
|
@@ -107,7 +107,7 @@ export class CliBinBuild extends BeanCliBase {
|
|
|
107
107
|
onLog: (level, log, defaultHandler) => {
|
|
108
108
|
if (log.code === 'CIRCULAR_DEPENDENCY' && process.env.BUILD_LOG_CIRCULAR_DEPENDENCY === 'false')
|
|
109
109
|
return;
|
|
110
|
-
if (log.code === 'THIS_IS_UNDEFINED' && log.message.includes('ramda/es/partialObject.js'))
|
|
110
|
+
if (log.code === 'THIS_IS_UNDEFINED' && (log.message.includes('ramda/es/partialObject.js') || log.message.includes("The 'this' keyword is equivalent to 'undefined' at the top level of an ES module")))
|
|
111
111
|
return;
|
|
112
112
|
if (log.code === 'EVAL' && log.message.includes('depd/index.js'))
|
|
113
113
|
return;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BeanCliBase } from '@cabloy/cli';
|
|
2
|
+
declare module '@cabloy/cli' {
|
|
3
|
+
interface ICommandArgv {
|
|
4
|
+
minify: boolean;
|
|
5
|
+
sourcemap: boolean;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export declare class CliBinBuildModule extends BeanCliBase {
|
|
9
|
+
execute(): Promise<void>;
|
|
10
|
+
_build(projectPath: string): Promise<void>;
|
|
11
|
+
_rollup(projectPath: string): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { BeanCliBase } from '@cabloy/cli';
|
|
3
|
+
import aliasImport from '@rollup/plugin-alias';
|
|
4
|
+
import babelImport from '@rollup/plugin-babel';
|
|
5
|
+
import commonjsImport from '@rollup/plugin-commonjs';
|
|
6
|
+
import jsonImport from '@rollup/plugin-json';
|
|
7
|
+
import resolveImport from '@rollup/plugin-node-resolve';
|
|
8
|
+
import terserImport from '@rollup/plugin-terser';
|
|
9
|
+
import { rimraf } from 'rimraf';
|
|
10
|
+
import { rollup } from 'rollup';
|
|
11
|
+
const commonjs = commonjsImport;
|
|
12
|
+
const resolve = resolveImport;
|
|
13
|
+
// const swc = swcImport as any as typeof swcImport.default;
|
|
14
|
+
const json = jsonImport;
|
|
15
|
+
const babel = babelImport;
|
|
16
|
+
const terser = terserImport;
|
|
17
|
+
const alias = aliasImport;
|
|
18
|
+
export class CliBinBuildModule extends BeanCliBase {
|
|
19
|
+
async execute() {
|
|
20
|
+
const { argv } = this.context;
|
|
21
|
+
// super
|
|
22
|
+
await super.execute();
|
|
23
|
+
const projectPath = argv.projectPath;
|
|
24
|
+
await this._build(projectPath);
|
|
25
|
+
}
|
|
26
|
+
async _build(projectPath) {
|
|
27
|
+
await rimraf(path.join(projectPath, 'dist'));
|
|
28
|
+
await this._rollup(projectPath);
|
|
29
|
+
}
|
|
30
|
+
async _rollup(projectPath) {
|
|
31
|
+
const { argv } = this.context;
|
|
32
|
+
const aliasEntries = [];
|
|
33
|
+
for (const name of ['better-sqlite3', 'mysql', 'oracledb', 'pg-native', 'pg-query-stream', 'sqlite3', 'tedious', 'cloudflare:sockets']) {
|
|
34
|
+
aliasEntries.push({ find: name, replacement: 'vona-shared' });
|
|
35
|
+
}
|
|
36
|
+
const plugins = [
|
|
37
|
+
alias({
|
|
38
|
+
entries: aliasEntries,
|
|
39
|
+
}),
|
|
40
|
+
resolve({
|
|
41
|
+
preferBuiltins: true,
|
|
42
|
+
}),
|
|
43
|
+
json(),
|
|
44
|
+
commonjs(),
|
|
45
|
+
babel({
|
|
46
|
+
include: '**/*.ts',
|
|
47
|
+
extensions: ['.ts', '.tsx'],
|
|
48
|
+
babelHelpers: 'bundled',
|
|
49
|
+
skipPreflightCheck: true,
|
|
50
|
+
babelrc: false,
|
|
51
|
+
configFile: false,
|
|
52
|
+
plugins: [
|
|
53
|
+
['babel-plugin-zova-bean-module', { brandName: 'vona' }],
|
|
54
|
+
['babel-plugin-transform-typescript-metadata'],
|
|
55
|
+
['@babel/plugin-proposal-decorators', { version: 'legacy' }],
|
|
56
|
+
['@babel/plugin-transform-class-properties', { loose: true }],
|
|
57
|
+
['@babel/plugin-transform-typescript'],
|
|
58
|
+
],
|
|
59
|
+
}),
|
|
60
|
+
];
|
|
61
|
+
if (argv.minify) {
|
|
62
|
+
plugins.push(terser({
|
|
63
|
+
keep_classnames: true,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
const inputOptions = {
|
|
67
|
+
input: path.join(projectPath, 'src/index.ts'),
|
|
68
|
+
plugins,
|
|
69
|
+
onLog: (level, log, defaultHandler) => {
|
|
70
|
+
if (log.code === 'CIRCULAR_DEPENDENCY')
|
|
71
|
+
return;
|
|
72
|
+
if (log.code === 'THIS_IS_UNDEFINED' && (log.message.includes('ramda/es/partialObject.js') || log.message.includes("The 'this' keyword is equivalent to 'undefined' at the top level of an ES module")))
|
|
73
|
+
return;
|
|
74
|
+
if (log.code === 'EVAL' && log.message.includes('depd/index.js'))
|
|
75
|
+
return;
|
|
76
|
+
if (log.code === 'EVAL' && log.message.includes('bluebird/js/release/util.js'))
|
|
77
|
+
return;
|
|
78
|
+
defaultHandler(level, log);
|
|
79
|
+
},
|
|
80
|
+
external(source, _importer, _isResolved) {
|
|
81
|
+
if (source.includes('/src/') || source.startsWith('.'))
|
|
82
|
+
return false;
|
|
83
|
+
return true;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
const outputOption = {
|
|
87
|
+
dir: path.join(projectPath, 'dist'),
|
|
88
|
+
// file: path.join(projectPath, 'dist/index.js'),
|
|
89
|
+
format: 'esm',
|
|
90
|
+
sourcemap: argv.sourcemap,
|
|
91
|
+
// https://github.com/rollup/rollup/issues/4166
|
|
92
|
+
inlineDynamicImports: true,
|
|
93
|
+
};
|
|
94
|
+
let bundle;
|
|
95
|
+
try {
|
|
96
|
+
bundle = await rollup(inputOptions);
|
|
97
|
+
await bundle.write(outputOption);
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
if (bundle) {
|
|
101
|
+
// closes the bundle
|
|
102
|
+
await bundle.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
package/dist/lib/beans.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliBinBuild } from './bean/cli.bin.build.ts';
|
|
2
|
+
import { CliBinBuildModule } from './bean/cli.bin.buildModule.ts';
|
|
2
3
|
import { CliBinDbReset } from './bean/cli.bin.dbReset.ts';
|
|
3
4
|
import { CliBinDemo } from './bean/cli.bin.demo.ts';
|
|
4
5
|
import { CliBinDev } from './bean/cli.bin.dev.ts';
|
|
@@ -23,6 +24,7 @@ import { CliToolsMetadata } from './bean/cli.tools.metadata.ts';
|
|
|
23
24
|
export declare const beans: {
|
|
24
25
|
'default.list': typeof CliDefaultList;
|
|
25
26
|
'bin.build': typeof CliBinBuild;
|
|
27
|
+
'bin.buildModule': typeof CliBinBuildModule;
|
|
26
28
|
'bin.dbReset': typeof CliBinDbReset;
|
|
27
29
|
'bin.demo': typeof CliBinDemo;
|
|
28
30
|
'bin.dev': typeof CliBinDev;
|
package/dist/lib/beans.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliBinBuild } from "./bean/cli.bin.build.js";
|
|
2
|
+
import { CliBinBuildModule } from "./bean/cli.bin.buildModule.js";
|
|
2
3
|
import { CliBinDbReset } from "./bean/cli.bin.dbReset.js";
|
|
3
4
|
import { CliBinDemo } from "./bean/cli.bin.demo.js";
|
|
4
5
|
import { CliBinDev } from "./bean/cli.bin.dev.js";
|
|
@@ -23,6 +24,7 @@ import { CliToolsMetadata } from "./bean/cli.tools.metadata.js";
|
|
|
23
24
|
export const beans = {
|
|
24
25
|
'default.list': CliDefaultList,
|
|
25
26
|
'bin.build': CliBinBuild,
|
|
27
|
+
'bin.buildModule': CliBinBuildModule,
|
|
26
28
|
'bin.dbReset': CliBinDbReset,
|
|
27
29
|
'bin.demo': CliBinDemo,
|
|
28
30
|
'bin.dev': CliBinDev,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
bean: string;
|
|
3
|
+
info: {
|
|
4
|
+
version: string;
|
|
5
|
+
title: string;
|
|
6
|
+
usage: string;
|
|
7
|
+
};
|
|
8
|
+
options: {
|
|
9
|
+
minify: {
|
|
10
|
+
description: string;
|
|
11
|
+
type: string;
|
|
12
|
+
};
|
|
13
|
+
sourcemap: {
|
|
14
|
+
description: string;
|
|
15
|
+
type: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -38,6 +38,24 @@ export declare const commands: {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
+
buildModule: {
|
|
42
|
+
bean: string;
|
|
43
|
+
info: {
|
|
44
|
+
version: string;
|
|
45
|
+
title: string;
|
|
46
|
+
usage: string;
|
|
47
|
+
};
|
|
48
|
+
options: {
|
|
49
|
+
minify: {
|
|
50
|
+
description: string;
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
sourcemap: {
|
|
54
|
+
description: string;
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
41
59
|
dbReset: {
|
|
42
60
|
bean: string;
|
|
43
61
|
info: {
|
package/dist/lib/commands.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import binBuild from "./command/bin.build.js";
|
|
2
|
+
import binBuildModule from "./command/bin.buildModule.js";
|
|
2
3
|
import binDbReset from "./command/bin.dbReset.js";
|
|
3
4
|
import binDemo from "./command/bin.demo.js";
|
|
4
5
|
import binDev from "./command/bin.dev.js";
|
|
@@ -26,6 +27,7 @@ export const commands = {
|
|
|
26
27
|
},
|
|
27
28
|
bin: {
|
|
28
29
|
build: binBuild,
|
|
30
|
+
buildModule: binBuildModule,
|
|
29
31
|
dbReset: binDbReset,
|
|
30
32
|
demo: binDemo,
|
|
31
33
|
dev: binDev,
|