vona-cli-set-api 1.1.167 → 1.1.168
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/dist/index.js +2 -143
- package/dist/lib/beans.d.ts +0 -2
- package/dist/lib/commands.d.ts +0 -23
- package/package.json +4 -4
- package/dist/lib/bean/cli.bin.tsc.d.ts +0 -13
- package/dist/lib/command/bin.tsc.d.ts +0 -24
- package/dist/lib/typescriptRunner.d.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -24,9 +24,9 @@ import chalk from 'chalk';
|
|
|
24
24
|
import { spawn } from 'node:child_process';
|
|
25
25
|
import nodemon from 'nodemon';
|
|
26
26
|
import { catchError, combineApiPathControllerAndActionRaw, replaceTemplate } from '@cabloy/utils';
|
|
27
|
-
import fs, { readFileSync } from 'node:fs';
|
|
28
27
|
import { getOnionScenesMeta, getOnionMetasMeta, relativeNameToCapitalize } from '@cabloy/module-info';
|
|
29
28
|
import { toUpperCaseFirstChar, stringToCapitalize, replaceTemplate as replaceTemplate$1 } from '@cabloy/word-utils';
|
|
29
|
+
import fs from 'node:fs';
|
|
30
30
|
import gogocode from 'gogocode';
|
|
31
31
|
|
|
32
32
|
function getEnvMeta(configMeta) {
|
|
@@ -1173,121 +1173,6 @@ class CliBinTest extends BeanCliBase {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
|
-
function resolveTypeScriptCompiler(compiler, projectPath) {
|
|
1177
|
-
const packageName = compiler === 'native' ? '@typescript/native' : 'typescript';
|
|
1178
|
-
const require = createRequire(path.resolve(projectPath, 'package.json'));
|
|
1179
|
-
let manifestPath;
|
|
1180
|
-
try {
|
|
1181
|
-
manifestPath = require.resolve(`${packageName}/package.json`);
|
|
1182
|
-
} catch (cause) {
|
|
1183
|
-
throw new Error(`Cannot resolve ${packageName}. Install the ${compiler === 'native' ? 'native TypeScript alias (npm:typescript@7.0.2)' : 'TypeScript package'} in the project or its repository root.`, {
|
|
1184
|
-
cause
|
|
1185
|
-
});
|
|
1186
|
-
}
|
|
1187
|
-
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
1188
|
-
if (typeof manifest.bin?.tsc !== 'string') {
|
|
1189
|
-
throw new TypeError(`${packageName} does not declare a tsc executable.`);
|
|
1190
|
-
}
|
|
1191
|
-
return path.resolve(path.dirname(manifestPath), manifest.bin.tsc);
|
|
1192
|
-
}
|
|
1193
|
-
async function runTypeScript(compiler, args, {
|
|
1194
|
-
projectPath,
|
|
1195
|
-
cwd = projectPath
|
|
1196
|
-
}) {
|
|
1197
|
-
const executable = resolveTypeScriptCompiler(compiler, projectPath);
|
|
1198
|
-
await new Promise((resolve, reject) => {
|
|
1199
|
-
const child = spawn(process.execPath, [executable, ...args], {
|
|
1200
|
-
cwd,
|
|
1201
|
-
stdio: 'inherit',
|
|
1202
|
-
shell: false
|
|
1203
|
-
});
|
|
1204
|
-
child.once('error', reject);
|
|
1205
|
-
child.once('close', (code, signal) => {
|
|
1206
|
-
if (code === 0) {
|
|
1207
|
-
resolve();
|
|
1208
|
-
} else {
|
|
1209
|
-
reject(Object.assign(new Error(`TypeScript (${compiler}) failed: ${signal ? `signal ${signal}` : `exit code ${code}`}`), {
|
|
1210
|
-
exitCode: code ?? 1,
|
|
1211
|
-
signal
|
|
1212
|
-
}));
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
class CliBinTsc extends BeanCliBase {
|
|
1219
|
-
async execute() {
|
|
1220
|
-
const {
|
|
1221
|
-
argv
|
|
1222
|
-
} = this.context;
|
|
1223
|
-
// super
|
|
1224
|
-
await super.execute();
|
|
1225
|
-
const projectPath = argv.projectPath;
|
|
1226
|
-
const force = argv.force;
|
|
1227
|
-
await this._tsc(projectPath, force, argv.compiler ?? 'typescript', argv.builders);
|
|
1228
|
-
}
|
|
1229
|
-
async _tsc(projectPath, force, compiler = 'typescript', builders) {
|
|
1230
|
-
if (builders !== undefined) {
|
|
1231
|
-
if (!Number.isSafeInteger(builders) || builders < 1) {
|
|
1232
|
-
throw new Error('--builders must be a positive safe integer');
|
|
1233
|
-
}
|
|
1234
|
-
if (compiler !== 'native') {
|
|
1235
|
-
throw new Error('--builders requires --compiler=native');
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
const suiteNames = Object.keys(this.modulesMeta.suites).filter(suiteName => !this.modulesMeta.suites[suiteName].info.node_modules);
|
|
1239
|
-
const modulesArray = this.modulesMeta.modulesArray.filter(item => !item.suite && !item.info.node_modules);
|
|
1240
|
-
// count
|
|
1241
|
-
const count = 1 + suiteNames.length + modulesArray.length;
|
|
1242
|
-
// begin
|
|
1243
|
-
let counter = 0;
|
|
1244
|
-
const timeBegin = Date.now();
|
|
1245
|
-
// eslint-disable-next-line
|
|
1246
|
-
console.log('===> build begin');
|
|
1247
|
-
// args
|
|
1248
|
-
const tscArgs = ['-b'];
|
|
1249
|
-
if (force) {
|
|
1250
|
-
tscArgs.push('--force');
|
|
1251
|
-
}
|
|
1252
|
-
if (builders !== undefined) {
|
|
1253
|
-
tscArgs.push('--builders', String(builders));
|
|
1254
|
-
}
|
|
1255
|
-
const check = async cwd => {
|
|
1256
|
-
if (compiler === 'native') {
|
|
1257
|
-
await runTypeScript(compiler, tscArgs, {
|
|
1258
|
-
projectPath,
|
|
1259
|
-
cwd
|
|
1260
|
-
});
|
|
1261
|
-
} else {
|
|
1262
|
-
await this.helper.processHelper.tsc(tscArgs, {
|
|
1263
|
-
cwd
|
|
1264
|
-
});
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
// tsc: project
|
|
1268
|
-
// eslint-disable-next-line
|
|
1269
|
-
console.log(`===> ${++counter}/${count} project`);
|
|
1270
|
-
await check(projectPath);
|
|
1271
|
-
// suites
|
|
1272
|
-
for (const key of suiteNames) {
|
|
1273
|
-
const suite = this.modulesMeta.suites[key];
|
|
1274
|
-
// eslint-disable-next-line
|
|
1275
|
-
console.log(`===> ${++counter}/${count} suite: ${suite.info.originalName}`);
|
|
1276
|
-
await check(suite.root);
|
|
1277
|
-
}
|
|
1278
|
-
// modules
|
|
1279
|
-
for (const module of modulesArray) {
|
|
1280
|
-
// eslint-disable-next-line
|
|
1281
|
-
console.log(`===> ${++counter}/${count} module: ${module.info.originalName}`);
|
|
1282
|
-
await check(module.root);
|
|
1283
|
-
}
|
|
1284
|
-
// end
|
|
1285
|
-
const timeEnd = Date.now();
|
|
1286
|
-
// eslint-disable-next-line
|
|
1287
|
-
console.log(`===> tsc end: ${(timeEnd - timeBegin) / 1000}s`);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
1176
|
const __ThisSetName__ = 'api';
|
|
1292
1177
|
|
|
1293
1178
|
let __snippetsPathPrefix;
|
|
@@ -3559,7 +3444,6 @@ const beans = {
|
|
|
3559
3444
|
'bin.play': CliBinPlay,
|
|
3560
3445
|
'bin.dev': CliBinDev,
|
|
3561
3446
|
'bin.test': CliBinTest,
|
|
3562
|
-
'bin.tsc': CliBinTsc,
|
|
3563
3447
|
'create.suite': CliCreateSuite,
|
|
3564
3448
|
'create.bean': CliCreateBean,
|
|
3565
3449
|
'create.module': CliCreateModule,
|
|
@@ -3726,30 +3610,6 @@ var binTest = {
|
|
|
3726
3610
|
}
|
|
3727
3611
|
};
|
|
3728
3612
|
|
|
3729
|
-
var binTsc = {
|
|
3730
|
-
bean: 'bin.tsc',
|
|
3731
|
-
info: {
|
|
3732
|
-
version: '5.0.0',
|
|
3733
|
-
title: 'Cli: Bin: Tsc',
|
|
3734
|
-
usage: 'npm run vona :bin:tsc -- [--force] [--compiler=typescript|native] [--builders=]'
|
|
3735
|
-
},
|
|
3736
|
-
options: {
|
|
3737
|
-
compiler: {
|
|
3738
|
-
description: 'TypeScript compiler (native requires @typescript/native in the project or repository root)',
|
|
3739
|
-
type: 'string',
|
|
3740
|
-
choices: ['typescript', 'native']
|
|
3741
|
-
},
|
|
3742
|
-
builders: {
|
|
3743
|
-
description: 'Maximum number of projects to build concurrently (native only)',
|
|
3744
|
-
type: 'number'
|
|
3745
|
-
},
|
|
3746
|
-
force: {
|
|
3747
|
-
description: 'force',
|
|
3748
|
-
type: 'boolean'
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
};
|
|
3752
|
-
|
|
3753
3613
|
var createBean = {
|
|
3754
3614
|
bean: 'create.bean',
|
|
3755
3615
|
info: {
|
|
@@ -4271,8 +4131,7 @@ const commands = {
|
|
|
4271
4131
|
dbReset: binDbReset,
|
|
4272
4132
|
dev: binDev,
|
|
4273
4133
|
play: binPlay,
|
|
4274
|
-
test: binTest
|
|
4275
|
-
tsc: binTsc
|
|
4134
|
+
test: binTest
|
|
4276
4135
|
},
|
|
4277
4136
|
create: {
|
|
4278
4137
|
suite: createSuite,
|
package/dist/lib/beans.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { CliBinDbReset } from './bean/cli.bin.dbReset.ts';
|
|
|
5
5
|
import { CliBinDev } from './bean/cli.bin.dev.ts';
|
|
6
6
|
import { CliBinPlay } from './bean/cli.bin.play.ts';
|
|
7
7
|
import { CliBinTest } from './bean/cli.bin.test.ts';
|
|
8
|
-
import { CliBinTsc } from './bean/cli.bin.tsc.ts';
|
|
9
8
|
import { CliCreateBean } from './bean/cli.create.bean.ts';
|
|
10
9
|
import { CliCreateModule } from './bean/cli.create.module.ts';
|
|
11
10
|
import { CliCreateSuite } from './bean/cli.create.suite.ts';
|
|
@@ -37,7 +36,6 @@ export declare const beans: {
|
|
|
37
36
|
'bin.play': typeof CliBinPlay;
|
|
38
37
|
'bin.dev': typeof CliBinDev;
|
|
39
38
|
'bin.test': typeof CliBinTest;
|
|
40
|
-
'bin.tsc': typeof CliBinTsc;
|
|
41
39
|
'create.suite': typeof CliCreateSuite;
|
|
42
40
|
'create.bean': typeof CliCreateBean;
|
|
43
41
|
'create.module': typeof CliCreateModule;
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -156,29 +156,6 @@ export declare const commands: {
|
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
158
|
};
|
|
159
|
-
tsc: {
|
|
160
|
-
bean: string;
|
|
161
|
-
info: {
|
|
162
|
-
version: string;
|
|
163
|
-
title: string;
|
|
164
|
-
usage: string;
|
|
165
|
-
};
|
|
166
|
-
options: {
|
|
167
|
-
compiler: {
|
|
168
|
-
description: string;
|
|
169
|
-
type: string;
|
|
170
|
-
choices: string[];
|
|
171
|
-
};
|
|
172
|
-
builders: {
|
|
173
|
-
description: string;
|
|
174
|
-
type: string;
|
|
175
|
-
};
|
|
176
|
-
force: {
|
|
177
|
-
description: string;
|
|
178
|
-
type: string;
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
159
|
};
|
|
183
160
|
create: {
|
|
184
161
|
suite: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vona-cli-set-api",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.1.168",
|
|
4
|
+
"gitHead": "ac1ffe7f3effb85c5d4896bb26c2c4e8751aa089",
|
|
5
5
|
"description": "vona cli-set-api",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"framework",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
46
46
|
"@babel/plugin-transform-class-properties": "^7.28.6",
|
|
47
47
|
"@babel/plugin-transform-typescript": "^7.28.6",
|
|
48
|
-
"@cabloy/cli": "^3.1.
|
|
48
|
+
"@cabloy/cli": "^3.1.31",
|
|
49
49
|
"@cabloy/dotenv": "^1.2.9",
|
|
50
50
|
"@cabloy/extend": "^3.2.8",
|
|
51
|
-
"@cabloy/module-glob": "^5.3.
|
|
51
|
+
"@cabloy/module-glob": "^5.3.19",
|
|
52
52
|
"@cabloy/module-info": "^2.0.3",
|
|
53
53
|
"@cabloy/utils": "^2.1.27",
|
|
54
54
|
"@cabloy/word-utils": "^2.1.8",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BeanCliBase } from '@cabloy/cli';
|
|
2
|
-
import type { TypeScriptCompiler } from '../typescriptRunner.ts';
|
|
3
|
-
declare module '@cabloy/cli' {
|
|
4
|
-
interface ICommandArgv {
|
|
5
|
-
force: boolean;
|
|
6
|
-
compiler: TypeScriptCompiler;
|
|
7
|
-
builders: number;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export declare class CliBinTsc extends BeanCliBase {
|
|
11
|
-
execute(): Promise<void>;
|
|
12
|
-
_tsc(projectPath: string, force: boolean, compiler?: TypeScriptCompiler, builders?: number): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
bean: string;
|
|
3
|
-
info: {
|
|
4
|
-
version: string;
|
|
5
|
-
title: string;
|
|
6
|
-
usage: string;
|
|
7
|
-
};
|
|
8
|
-
options: {
|
|
9
|
-
compiler: {
|
|
10
|
-
description: string;
|
|
11
|
-
type: string;
|
|
12
|
-
choices: string[];
|
|
13
|
-
};
|
|
14
|
-
builders: {
|
|
15
|
-
description: string;
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
18
|
-
force: {
|
|
19
|
-
description: string;
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export default _default;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type TypeScriptCompiler = 'native' | 'typescript';
|
|
2
|
-
export declare function resolveTypeScriptCompiler(compiler: TypeScriptCompiler, projectPath: string): string;
|
|
3
|
-
export declare function runTypeScript(compiler: TypeScriptCompiler, args: string[], { projectPath, cwd }: {
|
|
4
|
-
projectPath: string;
|
|
5
|
-
cwd?: string;
|
|
6
|
-
}): Promise<void>;
|