vona-cli-set-api 1.0.364 → 1.0.366
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/package.original.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/backend/config/config/config.ts +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-index/package.json +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/modules/home-index/src/bean/meta.printTip.ts +1 -1
- package/cli/templates/create/project/basic/boilerplate/src/suite/a-home/package.json +1 -1
- package/dist/lib/bean/cli.bin.dev.js +1 -0
- package/dist/lib/bean/cli.bin.play.d.ts +3 -1
- package/dist/lib/bean/cli.bin.play.js +43 -3
- package/dist/lib/bean/toolsBin/play.js +6 -1
- package/dist/lib/command/bin.play.d.ts +5 -0
- package/dist/lib/command/bin.play.js +6 -1
- package/dist/lib/command/create.bean.d.ts +1 -0
- package/dist/lib/command/create.bean.js +1 -0
- package/dist/lib/commands.d.ts +6 -0
- package/package.json +4 -4
|
@@ -94,7 +94,7 @@ export default function (appInfo: VonaAppInfo, env: VonaConfigEnv) {
|
|
|
94
94
|
this.bean.logger.makeTransportFile(clientInfo, 'http', 'http'),
|
|
95
95
|
this.bean.logger.makeTransportFile(clientInfo, 'combined'),
|
|
96
96
|
this.bean.logger.makeTransportConsole(clientInfo),
|
|
97
|
-
]
|
|
97
|
+
];
|
|
98
98
|
return { transports };
|
|
99
99
|
},
|
|
100
100
|
},
|
|
@@ -36,6 +36,7 @@ export class CliBinDev extends BeanCliBase {
|
|
|
36
36
|
execArgs: [getImportEsm()],
|
|
37
37
|
// execArgs: ['--experimental-transform-types', getImportEsm(), '--trace-deprecation'],
|
|
38
38
|
// signal: 'SIGHUP',
|
|
39
|
+
ignore: ['test/**/*.test.ts', 'src/backend/play'],
|
|
39
40
|
});
|
|
40
41
|
nodemon.on('quit', () => {
|
|
41
42
|
resolve(undefined);
|
|
@@ -5,10 +5,12 @@ declare module '@cabloy/cli' {
|
|
|
5
5
|
mode?: VonaMetaMode;
|
|
6
6
|
flavor?: VonaMetaFlavor;
|
|
7
7
|
retainRuntime?: boolean;
|
|
8
|
+
attach?: boolean;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export declare class CliBinPlay extends BeanCliBase {
|
|
11
12
|
execute(): Promise<void>;
|
|
12
13
|
_play(projectPath: string): Promise<void>;
|
|
13
|
-
|
|
14
|
+
_runAttach(projectPath: string): Promise<void>;
|
|
15
|
+
_runIsolate(projectPath: string): Promise<void>;
|
|
14
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { BeanCliBase } from '@cabloy/cli';
|
|
3
3
|
import fse from 'fs-extra';
|
|
4
|
-
import { getImportEsm } from "../utils.js";
|
|
4
|
+
import { getImportEsm, loadJSONFile } from "../utils.js";
|
|
5
5
|
import { generateVonaMeta } from "./toolsBin/generateVonaMeta.js";
|
|
6
6
|
export class CliBinPlay extends BeanCliBase {
|
|
7
7
|
async execute() {
|
|
@@ -25,9 +25,49 @@ export class CliBinPlay extends BeanCliBase {
|
|
|
25
25
|
};
|
|
26
26
|
await generateVonaMeta(configMeta, configOptions);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
if (argv.attach) {
|
|
29
|
+
await this._runAttach(projectPath);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
await this._runIsolate(projectPath);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async _runAttach(projectPath) {
|
|
36
|
+
const runtimeFile = path.join(projectPath, '.app/runtime/-.json');
|
|
37
|
+
if (!fse.existsSync(runtimeFile))
|
|
38
|
+
throw new Error('dev server not running');
|
|
39
|
+
// args
|
|
40
|
+
let args = [];
|
|
41
|
+
const pos = process.argv.indexOf(':bin:play');
|
|
42
|
+
if (pos > -1) {
|
|
43
|
+
args = args.concat(process.argv.slice(pos + 1));
|
|
44
|
+
}
|
|
45
|
+
const body = { args, projectPath };
|
|
46
|
+
//
|
|
47
|
+
const runtime = await loadJSONFile(runtimeFile);
|
|
48
|
+
const runtimeCore = runtime['a-core'];
|
|
49
|
+
const runtimeUser = runtime['a-user'];
|
|
50
|
+
const result = await fetch(`${runtimeCore.protocol}://${runtimeCore.host}/api/play`, {
|
|
51
|
+
method: 'post',
|
|
52
|
+
headers: {
|
|
53
|
+
'content-type': 'application/json',
|
|
54
|
+
'authorization': `Bearer ${runtimeUser.accessToken}`,
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify(body),
|
|
57
|
+
});
|
|
58
|
+
if (result.status !== 200) {
|
|
59
|
+
const message = `error: ${result.status}, ${result.statusText}`;
|
|
60
|
+
throw new Error(message);
|
|
61
|
+
}
|
|
62
|
+
const res = await result.json();
|
|
63
|
+
if (res.code !== 0)
|
|
64
|
+
throw new Error(res.message);
|
|
65
|
+
if (res.data !== undefined) {
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.log(res.data);
|
|
68
|
+
}
|
|
29
69
|
}
|
|
30
|
-
async
|
|
70
|
+
async _runIsolate(projectPath) {
|
|
31
71
|
// testFile
|
|
32
72
|
let testFile = path.join(import.meta.dirname, './toolsBin/play.ts');
|
|
33
73
|
if (!fse.existsSync(testFile)) {
|
|
@@ -17,6 +17,7 @@ const __template = `import type { IArgv, VonaApplication } from 'vona';
|
|
|
17
17
|
export async function main(app: VonaApplication, _argv: IArgv) {
|
|
18
18
|
console.log(import.meta.filename);
|
|
19
19
|
console.log(app.config.meta);
|
|
20
|
+
return 'Hello VonaJS';
|
|
20
21
|
}
|
|
21
22
|
`;
|
|
22
23
|
const projectPath = process.argv[2];
|
|
@@ -40,7 +41,11 @@ async function playRun(projectPath) {
|
|
|
40
41
|
}
|
|
41
42
|
// run
|
|
42
43
|
const playInstance = await import(__rewriteRelativeImportExtension(pathToHref(playFile)));
|
|
43
|
-
await playInstance.main(app, argv);
|
|
44
|
+
const res = await playInstance.main(app, argv);
|
|
45
|
+
if (res !== undefined) {
|
|
46
|
+
// eslint-disable-next-line no-console
|
|
47
|
+
console.log(res);
|
|
48
|
+
}
|
|
44
49
|
// close
|
|
45
50
|
await app.close();
|
|
46
51
|
// handles
|
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
info: {
|
|
4
4
|
version: '5.0.0',
|
|
5
5
|
title: 'Cli: Bin: Play',
|
|
6
|
-
usage: 'vona :bin:play [index.ts] [--flavor=] [--retainRuntime=]',
|
|
6
|
+
usage: 'vona :bin:play [index.ts] [--flavor=] [--retainRuntime=] [--attach]',
|
|
7
7
|
},
|
|
8
8
|
options: {
|
|
9
9
|
mode: {
|
|
@@ -18,5 +18,10 @@ export default {
|
|
|
18
18
|
description: 'retainRuntime',
|
|
19
19
|
type: 'boolean',
|
|
20
20
|
},
|
|
21
|
+
attach: {
|
|
22
|
+
alias: 'a',
|
|
23
|
+
description: 'attach',
|
|
24
|
+
type: 'boolean',
|
|
25
|
+
},
|
|
21
26
|
},
|
|
22
27
|
};
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -108,6 +108,11 @@ export declare const commands: {
|
|
|
108
108
|
description: string;
|
|
109
109
|
type: string;
|
|
110
110
|
};
|
|
111
|
+
attach: {
|
|
112
|
+
alias: string;
|
|
113
|
+
description: string;
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
111
116
|
};
|
|
112
117
|
};
|
|
113
118
|
test: {
|
|
@@ -272,6 +277,7 @@ export declare const commands: {
|
|
|
272
277
|
};
|
|
273
278
|
options: {
|
|
274
279
|
module: {
|
|
280
|
+
alias: string;
|
|
275
281
|
description: string;
|
|
276
282
|
type: string;
|
|
277
283
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-cli-set-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.366",
|
|
5
5
|
"description": "vona cli-set-api",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
32
32
|
"@babel/plugin-transform-class-properties": "^7.25.9",
|
|
33
33
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
34
|
-
"@cabloy/cli": "^3.0.
|
|
34
|
+
"@cabloy/cli": "^3.0.59",
|
|
35
35
|
"@cabloy/dotenv": "^1.1.10",
|
|
36
36
|
"@cabloy/extend": "^3.1.10",
|
|
37
37
|
"@cabloy/module-glob": "^5.2.32",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"ts-node-maintained": "^10.9.6",
|
|
62
62
|
"urllib": "^4.6.11",
|
|
63
63
|
"uuid": "^11.1.0",
|
|
64
|
-
"vona-core": "^5.0.
|
|
64
|
+
"vona-core": "^5.0.98",
|
|
65
65
|
"why-is-node-running": "^3.2.2",
|
|
66
|
-
"yargs-parser": "^
|
|
66
|
+
"yargs-parser": "^22.0.0"
|
|
67
67
|
},
|
|
68
68
|
"gitHead": "0eab9dc4a5622caffe89e7b1b3f02c08ccbc4c4b",
|
|
69
69
|
"scripts": {
|