vona-cli-set-api 1.0.67 → 1.0.69

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.
@@ -2,6 +2,7 @@ import EslintConfig from '@cabloy/lint/api/eslint.js';
2
2
 
3
3
  export default EslintConfig({
4
4
  ignores: [
5
+ '**/*.md',
5
6
  '**/*.d.ts',
6
7
  '**/node_modules/**',
7
8
  '**/dist/**',
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.36"
49
+ "vona": "^5.0.37"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -3,6 +3,7 @@ import { BeanCliBase } from '@cabloy/cli';
3
3
  declare module '@cabloy/cli' {
4
4
  interface ICommandArgv {
5
5
  flavor?: VonaMetaFlavor;
6
+ retainRuntime?: boolean;
6
7
  }
7
8
  }
8
9
  export declare class CliBinDemo extends BeanCliBase {
@@ -16,7 +16,7 @@ export class CliBinDemo extends BeanCliBase {
16
16
  const mode = 'local';
17
17
  const flavor = argv.flavor || 'normal';
18
18
  const configMeta = { flavor, mode };
19
- if (!fse.existsSync(path.join(projectPath, '.vona'))) {
19
+ if (!argv.retainRuntime || !fse.existsSync(path.join(projectPath, '.vona'))) {
20
20
  const configOptions = {
21
21
  appDir: projectPath,
22
22
  runtimeDir: '.vona',
@@ -11,5 +11,6 @@ export declare class CliBinTest extends BeanCliBase {
11
11
  execute(): Promise<void>;
12
12
  _test(projectPath: string): Promise<void>;
13
13
  _run(projectPath: string, modulesMeta: Awaited<ReturnType<typeof glob>>): Promise<void>;
14
+ _outputCoverageReportViewer(projectPath: string): Promise<void>;
14
15
  _combineTestPatterns(projectPath: string, modulesMeta: Awaited<ReturnType<typeof glob>>): string[];
15
16
  }
@@ -2,6 +2,7 @@ import path from 'node:path';
2
2
  import { BeanCliBase } from '@cabloy/cli';
3
3
  import fse from 'fs-extra';
4
4
  import { rimraf } from 'rimraf';
5
+ import { getAbsolutePathOfModule } from "../utils.js";
5
6
  import { generateVonaMeta } from "./toolsBin/generateVonaMeta.js";
6
7
  export class CliBinTest extends BeanCliBase {
7
8
  async execute() {
@@ -24,6 +25,9 @@ export class CliBinTest extends BeanCliBase {
24
25
  };
25
26
  const { modulesMeta } = await generateVonaMeta(configMeta, configOptions);
26
27
  await this._run(projectPath, modulesMeta);
28
+ if (argv.coverage) {
29
+ await this._outputCoverageReportViewer(projectPath);
30
+ }
27
31
  await rimraf(path.join(projectPath, '.vona'));
28
32
  }
29
33
  async _run(projectPath, modulesMeta) {
@@ -52,6 +56,19 @@ export class CliBinTest extends BeanCliBase {
52
56
  },
53
57
  });
54
58
  }
59
+ async _outputCoverageReportViewer(projectPath) {
60
+ // lcovCliFile
61
+ const lcovCliFile = getAbsolutePathOfModule('@lcov-viewer/cli/lib/index.js', '');
62
+ // run
63
+ const args = [lcovCliFile, 'lcov', '-o', './coverage/report', './coverage/lcov.info'];
64
+ await this.helper.spawnExe({
65
+ cmd: 'node',
66
+ args,
67
+ options: {
68
+ cwd: projectPath,
69
+ },
70
+ });
71
+ }
55
72
  _combineTestPatterns(projectPath, modulesMeta) {
56
73
  const patterns = [];
57
74
  for (const moduleName in modulesMeta.modules) {
@@ -2,7 +2,7 @@ import { createWriteStream } from 'node:fs';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { run } from 'node:test';
5
- import { lcov, tap } from 'node:test/reporters';
5
+ import { lcov, spec } from 'node:test/reporters';
6
6
  import { sleep } from '@cabloy/utils';
7
7
  import TableClass from 'cli-table3';
8
8
  import fse from 'fs-extra';
@@ -96,12 +96,12 @@ async function testRun(projectPath, coverage, patterns) {
96
96
  if (coverage) {
97
97
  const reporterDir = path.join(projectPath, 'coverage');
98
98
  fse.ensureDirSync(reporterDir);
99
- const reporter = createWriteStream(path.join(reporterDir, 'lcov.info'));
99
+ const reporterLcov = createWriteStream(path.join(reporterDir, 'lcov.info'));
100
100
  testStream.compose(lcov)
101
- .pipe(reporter);
101
+ .pipe(reporterLcov);
102
102
  }
103
103
  else {
104
- testStream.compose(tap)
104
+ testStream.compose(spec)
105
105
  .pipe(process.stdout);
106
106
  }
107
107
  });
@@ -10,6 +10,10 @@ declare const _default: {
10
10
  description: string;
11
11
  type: string;
12
12
  };
13
+ retainRuntime: {
14
+ description: string;
15
+ type: string;
16
+ };
13
17
  };
14
18
  };
15
19
  export default _default;
@@ -3,12 +3,16 @@ export default {
3
3
  info: {
4
4
  version: '5.0.0',
5
5
  title: 'Cli: Bin: Demo',
6
- usage: 'vona :bin:demo [index.ts] [--flavor=]',
6
+ usage: 'vona :bin:demo [index.ts] [--flavor=] [--retainRuntime=]',
7
7
  },
8
8
  options: {
9
9
  flavor: {
10
10
  description: 'flavor',
11
11
  type: 'string',
12
12
  },
13
+ retainRuntime: {
14
+ description: 'retainRuntime',
15
+ type: 'boolean',
16
+ },
13
17
  },
14
18
  };
@@ -82,6 +82,10 @@ export declare const commands: {
82
82
  description: string;
83
83
  type: string;
84
84
  };
85
+ retainRuntime: {
86
+ description: string;
87
+ type: string;
88
+ };
85
89
  };
86
90
  };
87
91
  dev: {
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.67",
4
+ "version": "1.0.69",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -37,6 +37,7 @@
37
37
  "@cabloy/module-glob": "^5.2.12",
38
38
  "@cabloy/module-info": "^1.3.19",
39
39
  "@cabloy/word-utils": "^2.0.1",
40
+ "@lcov-viewer/cli": "^1.3.0",
40
41
  "@rollup/plugin-alias": "^5.1.1",
41
42
  "@rollup/plugin-babel": "^6.0.4",
42
43
  "@rollup/plugin-commonjs": "^28.0.2",
@@ -60,7 +61,7 @@
60
61
  "ts-node": "^10.9.2",
61
62
  "urllib": "^4.6.11",
62
63
  "uuid": "^11.1.0",
63
- "vona-core": "^5.0.21",
64
+ "vona-core": "^5.0.22",
64
65
  "why-is-node-running": "^3.2.2",
65
66
  "yargs-parser": "^21.1.1"
66
67
  },