@eggjs/bin 8.0.0-beta.32 → 8.0.0-beta.33

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.
@@ -6,10 +6,9 @@ import { Command, Flags, Interfaces } from "@oclif/core";
6
6
  import { importResolve } from "@eggjs/utils";
7
7
  import { pathToFileURL } from "node:url";
8
8
  import { fork } from "node:child_process";
9
- import { runScript } from "runscript";
10
9
 
11
10
  //#region src/baseCommand.ts
12
- const debug = debuglog("egg-bin/baseCommand");
11
+ const debug = debuglog("egg/bin/baseCommand");
13
12
  const children = /* @__PURE__ */ new Set();
14
13
  let hadHook = false;
15
14
  function graceful(proc) {
@@ -91,7 +90,7 @@ var BaseCommand = class extends Command {
91
90
  }),
92
91
  declarations: Flags.boolean({
93
92
  helpGroup: "GLOBAL",
94
- description: "whether create typings, will add `--require egg-ts-helper/register`",
93
+ description: "deprecated, no effect, will be removed in the future",
95
94
  aliases: ["dts"]
96
95
  }),
97
96
  inspect: Flags.boolean({
@@ -181,17 +180,6 @@ var BaseCommand = class extends Command {
181
180
  this.addNodeOptions("--no-warnings");
182
181
  this.addNodeOptions(`--loader ${esmLoader}`);
183
182
  }
184
- if (flags.declarations === void 0) {
185
- if (typeof this.pkgEgg.declarations === "boolean") {
186
- flags.declarations = this.pkgEgg.declarations;
187
- debug("detect declarations from pkg.egg.declarations=%o", this.pkgEgg.declarations);
188
- }
189
- }
190
- if (flags.declarations) {
191
- const etsBin = importResolve("egg-ts-helper/dist/bin", { paths: findPaths });
192
- debug("run ets first: %o", etsBin);
193
- await runScript(`node "${etsBin}"`);
194
- }
195
183
  if (this.pkgEgg.revert) {
196
184
  const reverts = Array.isArray(this.pkgEgg.revert) ? this.pkgEgg.revert : [this.pkgEgg.revert];
197
185
  for (const revert of reverts) this.globalExecArgv.push(`--security-revert=${revert}`);
@@ -1,23 +1,23 @@
1
1
  import { ForkNodeOptions } from "../baseCommand.js";
2
2
  import { Test } from "./test.js";
3
- import * as _oclif_core_interfaces6 from "@oclif/core/interfaces";
3
+ import * as _oclif_core_interfaces11 from "@oclif/core/interfaces";
4
4
 
5
5
  //#region src/commands/cov.d.ts
6
6
  declare class Cov<T extends typeof Cov> extends Test<T> {
7
7
  static description: string;
8
8
  static examples: string[];
9
9
  static flags: {
10
- prerequire: _oclif_core_interfaces6.BooleanFlag<boolean>;
11
- exclude: _oclif_core_interfaces6.OptionFlag<string[] | undefined, _oclif_core_interfaces6.CustomOptions>;
12
- c8: _oclif_core_interfaces6.OptionFlag<string, _oclif_core_interfaces6.CustomOptions>;
13
- bail: _oclif_core_interfaces6.BooleanFlag<boolean>;
14
- timeout: _oclif_core_interfaces6.OptionFlag<number, _oclif_core_interfaces6.CustomOptions>;
15
- 'no-timeout': _oclif_core_interfaces6.BooleanFlag<boolean>;
16
- grep: _oclif_core_interfaces6.OptionFlag<string | undefined, _oclif_core_interfaces6.CustomOptions>;
17
- changed: _oclif_core_interfaces6.BooleanFlag<boolean>;
18
- parallel: _oclif_core_interfaces6.BooleanFlag<boolean>;
19
- jobs: _oclif_core_interfaces6.OptionFlag<number, _oclif_core_interfaces6.CustomOptions>;
20
- 'auto-agent': _oclif_core_interfaces6.BooleanFlag<boolean>;
10
+ prerequire: _oclif_core_interfaces11.BooleanFlag<boolean>;
11
+ exclude: _oclif_core_interfaces11.OptionFlag<string[] | undefined, _oclif_core_interfaces11.CustomOptions>;
12
+ c8: _oclif_core_interfaces11.OptionFlag<string, _oclif_core_interfaces11.CustomOptions>;
13
+ bail: _oclif_core_interfaces11.BooleanFlag<boolean>;
14
+ timeout: _oclif_core_interfaces11.OptionFlag<number, _oclif_core_interfaces11.CustomOptions>;
15
+ 'no-timeout': _oclif_core_interfaces11.BooleanFlag<boolean>;
16
+ grep: _oclif_core_interfaces11.OptionFlag<string | undefined, _oclif_core_interfaces11.CustomOptions>;
17
+ changed: _oclif_core_interfaces11.BooleanFlag<boolean>;
18
+ parallel: _oclif_core_interfaces11.BooleanFlag<boolean>;
19
+ jobs: _oclif_core_interfaces11.OptionFlag<number, _oclif_core_interfaces11.CustomOptions>;
20
+ 'auto-agent': _oclif_core_interfaces11.BooleanFlag<boolean>;
21
21
  };
22
22
  protected get defaultExcludes(): string[];
23
23
  protected forkNode(modulePath: string, forkArgs: string[], options?: ForkNodeOptions): Promise<void>;
@@ -1,15 +1,15 @@
1
1
  import { BaseCommand } from "../baseCommand.js";
2
- import * as _oclif_core_interfaces0 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces27 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/dev.d.ts
5
5
  declare class Dev<T extends typeof Dev> extends BaseCommand<T> {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
- port: _oclif_core_interfaces0.OptionFlag<number | undefined, _oclif_core_interfaces0.CustomOptions>;
10
- workers: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
11
- framework: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
12
- sticky: _oclif_core_interfaces0.BooleanFlag<boolean>;
9
+ port: _oclif_core_interfaces27.OptionFlag<number | undefined, _oclif_core_interfaces27.CustomOptions>;
10
+ workers: _oclif_core_interfaces27.OptionFlag<number, _oclif_core_interfaces27.CustomOptions>;
11
+ framework: _oclif_core_interfaces27.OptionFlag<string | undefined, _oclif_core_interfaces27.CustomOptions>;
12
+ sticky: _oclif_core_interfaces27.BooleanFlag<boolean>;
13
13
  };
14
14
  run(): Promise<void>;
15
15
  protected formatEggStartOptions(): Promise<{
@@ -6,7 +6,7 @@ import { getFrameworkPath } from "@eggjs/utils";
6
6
  import { detect } from "detect-port";
7
7
 
8
8
  //#region src/commands/dev.ts
9
- const debug = debuglog("egg-bin/commands/dev");
9
+ const debug = debuglog("egg/bin/commands/dev");
10
10
  var Dev = class extends BaseCommand {
11
11
  static description = "Start server at local dev mode";
12
12
  static examples = ["<%= config.bin %> <%= command.id %>"];
@@ -1,22 +1,22 @@
1
1
  import { BaseCommand } from "../baseCommand.js";
2
- import * as _oclif_core_interfaces22 from "@oclif/core/interfaces";
2
+ import * as _oclif_core_interfaces0 from "@oclif/core/interfaces";
3
3
 
4
4
  //#region src/commands/test.d.ts
5
5
  declare class Test<T extends typeof Test> extends BaseCommand<T> {
6
6
  static args: {
7
- file: _oclif_core_interfaces22.Arg<string | undefined, Record<string, unknown>>;
7
+ file: _oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
8
8
  };
9
9
  static description: string;
10
10
  static examples: string[];
11
11
  static flags: {
12
- bail: _oclif_core_interfaces22.BooleanFlag<boolean>;
13
- timeout: _oclif_core_interfaces22.OptionFlag<number, _oclif_core_interfaces22.CustomOptions>;
14
- 'no-timeout': _oclif_core_interfaces22.BooleanFlag<boolean>;
15
- grep: _oclif_core_interfaces22.OptionFlag<string | undefined, _oclif_core_interfaces22.CustomOptions>;
16
- changed: _oclif_core_interfaces22.BooleanFlag<boolean>;
17
- parallel: _oclif_core_interfaces22.BooleanFlag<boolean>;
18
- jobs: _oclif_core_interfaces22.OptionFlag<number, _oclif_core_interfaces22.CustomOptions>;
19
- 'auto-agent': _oclif_core_interfaces22.BooleanFlag<boolean>;
12
+ bail: _oclif_core_interfaces0.BooleanFlag<boolean>;
13
+ timeout: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
14
+ 'no-timeout': _oclif_core_interfaces0.BooleanFlag<boolean>;
15
+ grep: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
16
+ changed: _oclif_core_interfaces0.BooleanFlag<boolean>;
17
+ parallel: _oclif_core_interfaces0.BooleanFlag<boolean>;
18
+ jobs: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
19
+ 'auto-agent': _oclif_core_interfaces0.BooleanFlag<boolean>;
20
20
  };
21
21
  run(): Promise<void>;
22
22
  protected runMocha(mochaFile: string, mochaArgs: string[]): Promise<void>;
@@ -10,7 +10,7 @@ import { getChangedFilesForRoots } from "jest-changed-files";
10
10
  import ciParallelVars from "ci-parallel-vars";
11
11
 
12
12
  //#region src/commands/test.ts
13
- const debug = debuglog("egg-bin/commands/test");
13
+ const debug = debuglog("egg/bin/commands/test");
14
14
  var Test = class extends BaseCommand {
15
15
  static args = { file: Args.string({ description: "file(s) to test" }) };
16
16
  static description = "Run the test";
@@ -1,9 +1,8 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
1
  const { debuglog } = require('node:util');
3
2
 
4
3
  const { importModule } = require('@eggjs/utils');
5
4
 
6
- const debug = debuglog('egg-bin/scripts/start-cluster');
5
+ const debug = debuglog('egg/bin/scripts/start-cluster');
7
6
 
8
7
  async function main() {
9
8
  debug('argv: %o', process.argv);
@@ -2,7 +2,7 @@ import { debuglog } from 'node:util';
2
2
 
3
3
  import { importModule } from '@eggjs/utils';
4
4
 
5
- const debug = debuglog('egg-bin/scripts/start-cluster');
5
+ const debug = debuglog('egg/bin/scripts/start-cluster');
6
6
 
7
7
  async function main() {
8
8
  debug('argv: %o', process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/bin",
3
- "version": "8.0.0-beta.32",
3
+ "version": "8.0.0-beta.33",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,18 +23,16 @@
23
23
  "c8": "^10.1.3",
24
24
  "ci-parallel-vars": "^1.0.1",
25
25
  "detect-port": "^2.1.0",
26
- "egg-ts-helper": "^3.0.0",
27
26
  "globby": "^11.0.2",
28
27
  "jest-changed-files": "^30.0.0",
29
28
  "mocha": "^11.7.4",
30
- "runscript": "^2.0.1",
31
29
  "ts-node": "^10.9.2",
32
30
  "tsconfig-paths": "^4.2.0",
33
31
  "utility": "^2.5.0",
34
- "@eggjs/utils": "5.0.0-beta.32"
32
+ "@eggjs/utils": "5.0.0-beta.33"
35
33
  },
36
34
  "peerDependencies": {
37
- "@eggjs/mock": "7.0.0-beta.32"
35
+ "@eggjs/mock": "7.0.0-beta.33"
38
36
  },
39
37
  "peerDependenciesMeta": {
40
38
  "@eggjs/mock": {
@@ -42,10 +40,10 @@
42
40
  }
43
41
  },
44
42
  "devDependencies": {
45
- "@types/node": "^24.9.1",
46
- "@types/mocha": "^10.0.10",
47
43
  "@swc-node/register": "^1.11.1",
48
44
  "@swc/core": "1.13.5",
45
+ "@types/mocha": "^10.0.10",
46
+ "@types/node": "^24.9.1",
49
47
  "assert-file": "1",
50
48
  "coffee": "5",
51
49
  "cpy": "^12.0.0",
@@ -53,12 +51,13 @@
53
51
  "esbuild-register": "^3.6.0",
54
52
  "npminstall": "^7.12.0",
55
53
  "rimraf": "^6.0.1",
54
+ "runscript": "^2.0.1",
55
+ "tsdown": "0.15.11",
56
56
  "typescript": "^5.9.3",
57
- "tsdown": "0.15.10",
58
- "@eggjs/supertest": "9.0.0-beta.32",
59
- "@eggjs/mock": "7.0.0-beta.32",
60
- "@eggjs/tsconfig": "3.1.0-beta.32",
61
- "egg": "4.1.0-beta.32"
57
+ "@eggjs/mock": "7.0.0-beta.33",
58
+ "@eggjs/supertest": "9.0.0-beta.33",
59
+ "@eggjs/tsconfig": "3.1.0-beta.33",
60
+ "egg": "4.1.0-beta.33"
62
61
  },
63
62
  "type": "module",
64
63
  "files": [
@@ -86,12 +85,11 @@
86
85
  "./package.json": "./package.json"
87
86
  },
88
87
  "scripts": {
89
- "postinstall": "node scripts/postinstall.mjs",
90
88
  "lint": "oxlint --type-aware",
91
89
  "typecheck": "tsc --noEmit",
92
90
  "pretest": "npm run clean && npm run lint -- --fix && npm run prepublishOnly",
93
91
  "test": "node bin/run.js test",
94
- "cov": "c8 --temp-directory node_modules/.c8_output -r text-summary -r json-summary -r json -r lcov -r cobertura node bin/run.js test",
92
+ "cov": "c8 node bin/run.js test",
95
93
  "preci": "npm run clean && npm run lint && npm run prepublishOnly",
96
94
  "ci": "npm run cov",
97
95
  "clean": "rimraf dist",
@@ -1,9 +1,8 @@
1
- /* eslint-disable @typescript-eslint/no-var-requires */
2
1
  const { debuglog } = require('node:util');
3
2
 
4
3
  const { importModule } = require('@eggjs/utils');
5
4
 
6
- const debug = debuglog('egg-bin/scripts/start-cluster');
5
+ const debug = debuglog('egg/bin/scripts/start-cluster');
7
6
 
8
7
  async function main() {
9
8
  debug('argv: %o', process.argv);
@@ -2,7 +2,7 @@ import { debuglog } from 'node:util';
2
2
 
3
3
  import { importModule } from '@eggjs/utils';
4
4
 
5
- const debug = debuglog('egg-bin/scripts/start-cluster');
5
+ const debug = debuglog('egg/bin/scripts/start-cluster');
6
6
 
7
7
  async function main() {
8
8
  debug('argv: %o', process.argv);
@@ -1,63 +0,0 @@
1
- import { debuglog } from 'node:util';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
-
5
- import { runScript } from 'runscript';
6
- import { readJSON, exists } from 'utility';
7
- import { importResolve } from '@eggjs/utils';
8
-
9
- const debug = debuglog('egg/bin/scripts/postinstall');
10
-
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = path.dirname(__filename);
13
- const rootDir = path.dirname(__dirname);
14
-
15
- async function main() {
16
- // node postintall.js </path/to/egg-ts-helper/dist/bin> <framework-package-name>
17
- const etsBinFile =
18
- process.argv[2] ||
19
- importResolve('egg-ts-helper/dist/bin.js', {
20
- paths: [rootDir],
21
- });
22
- const frameworkPackageName = process.argv[3] || 'egg';
23
-
24
- // try to use INIT_CWD env https://docs.npmjs.com/cli/v9/commands/npm-run-script
25
- // npm_rootpath is npminstall
26
- const npmRunRoot = process.env.INIT_CWD || process.env.npm_rootpath;
27
-
28
- debug('process.argv: %o', process.argv);
29
- debug('process.env.INIT_CWD: %o', process.env.INIT_CWD);
30
- debug('process.env.npm_rootpath: %o', process.env.npm_rootpath);
31
- debug('etsBinFile: %o', etsBinFile);
32
- debug('frameworkPackageName: %o', frameworkPackageName);
33
- debug('npmRunRoot: %o', npmRunRoot);
34
-
35
- if (npmRunRoot) {
36
- const pkgFile = path.join(npmRunRoot, 'package.json');
37
- const pkgFileExists = await exists(pkgFile);
38
- debug('pkgFile: %s exists: %s', pkgFile, !!pkgFileExists);
39
- if (pkgFileExists) {
40
- const pkg = await readJSON(pkgFile);
41
- // should set pkg.egg.declarations = true or pkg.egg.typescript = true
42
- if (!pkg.egg?.typescript && !pkg.egg?.declarations) return;
43
- // ignore eggModule and framework
44
- // framework package.json:
45
- // "egg": {
46
- // "isFramework": true,
47
- // "typescript": true
48
- // }
49
- if (pkg.eggModule) return;
50
- if (pkg.egg.isFramework) return;
51
- // ignore when the current app don't has a framework dependencies
52
- if (!pkg.dependencies || !pkg.dependencies[frameworkPackageName]) return;
53
- // set ETS_CWD
54
- process.env.ETS_CWD = npmRunRoot;
55
- // https://github.com/eggjs/egg-ts-helper/pull/104
56
- process.env.ETS_SCRIPT_FRAMEWORK = frameworkPackageName;
57
- console.log('[@eggjs/bin/postinstall] run %s on %s', etsBinFile, npmRunRoot);
58
- await runScript(`node "${etsBinFile}"`);
59
- }
60
- }
61
- }
62
-
63
- void main();
@@ -1,63 +0,0 @@
1
- import { debuglog } from 'node:util';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
-
5
- import { runScript } from 'runscript';
6
- import { readJSON, exists } from 'utility';
7
- import { importResolve } from '@eggjs/utils';
8
-
9
- const debug = debuglog('egg/bin/scripts/postinstall');
10
-
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = path.dirname(__filename);
13
- const rootDir = path.dirname(__dirname);
14
-
15
- async function main() {
16
- // node postintall.js </path/to/egg-ts-helper/dist/bin> <framework-package-name>
17
- const etsBinFile =
18
- process.argv[2] ||
19
- importResolve('egg-ts-helper/dist/bin.js', {
20
- paths: [rootDir],
21
- });
22
- const frameworkPackageName = process.argv[3] || 'egg';
23
-
24
- // try to use INIT_CWD env https://docs.npmjs.com/cli/v9/commands/npm-run-script
25
- // npm_rootpath is npminstall
26
- const npmRunRoot = process.env.INIT_CWD || process.env.npm_rootpath;
27
-
28
- debug('process.argv: %o', process.argv);
29
- debug('process.env.INIT_CWD: %o', process.env.INIT_CWD);
30
- debug('process.env.npm_rootpath: %o', process.env.npm_rootpath);
31
- debug('etsBinFile: %o', etsBinFile);
32
- debug('frameworkPackageName: %o', frameworkPackageName);
33
- debug('npmRunRoot: %o', npmRunRoot);
34
-
35
- if (npmRunRoot) {
36
- const pkgFile = path.join(npmRunRoot, 'package.json');
37
- const pkgFileExists = await exists(pkgFile);
38
- debug('pkgFile: %s exists: %s', pkgFile, !!pkgFileExists);
39
- if (pkgFileExists) {
40
- const pkg = await readJSON(pkgFile);
41
- // should set pkg.egg.declarations = true or pkg.egg.typescript = true
42
- if (!pkg.egg?.typescript && !pkg.egg?.declarations) return;
43
- // ignore eggModule and framework
44
- // framework package.json:
45
- // "egg": {
46
- // "isFramework": true,
47
- // "typescript": true
48
- // }
49
- if (pkg.eggModule) return;
50
- if (pkg.egg.isFramework) return;
51
- // ignore when the current app don't has a framework dependencies
52
- if (!pkg.dependencies || !pkg.dependencies[frameworkPackageName]) return;
53
- // set ETS_CWD
54
- process.env.ETS_CWD = npmRunRoot;
55
- // https://github.com/eggjs/egg-ts-helper/pull/104
56
- process.env.ETS_SCRIPT_FRAMEWORK = frameworkPackageName;
57
- console.log('[@eggjs/bin/postinstall] run %s on %s', etsBinFile, npmRunRoot);
58
- await runScript(`node "${etsBinFile}"`);
59
- }
60
- }
61
- }
62
-
63
- void main();