@tego/devkit 1.3.16 → 1.3.18
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/lib/builder/build/buildCjs.mjs +1 -1
- package/lib/builder/build/buildClient.mjs +1 -1
- package/lib/builder/build/buildDeclaration.mjs +1 -1
- package/lib/builder/build/buildEsm.mjs +2 -2
- package/lib/builder/build/constant.mjs +1 -1
- package/lib/builder/build/tarPlugin.mjs +2 -2
- package/lib/builder/build/utils/buildPluginUtils.mjs +3 -3
- package/lib/builder/build/utils/getDepsConfig.mjs +2 -2
- package/lib/builder/build/utils/getPackages.mjs +1 -1
- package/lib/builder/build/utils/utils.mjs +2 -2
- package/lib/builder/buildable-packages/app-web-package.mjs +1 -1
- package/lib/builder/buildable-packages/plugin-package.mjs +2 -2
- package/lib/builder/get-packages.mjs +1 -1
- package/lib/cli.mjs +1 -1
- package/lib/commands/clean.mjs +4 -5
- package/lib/commands/create-nginx-conf.mjs +3 -3
- package/lib/commands/create-plugin.mjs +1 -1
- package/lib/commands/e2e.mjs +4 -4
- package/lib/commands/index.mjs +0 -4
- package/lib/commands/p-test.mjs +2 -2
- package/lib/commands/postinstall.mjs +3 -3
- package/lib/commands/test.mjs +1 -1
- package/lib/constants.mjs +2 -2
- package/lib/notify-updates.mjs +1 -1
- package/lib/open.mjs +2 -2
- package/lib/package-map-generator.mjs +2 -2
- package/lib/plugin-generator.mjs +4 -4
- package/lib/util.mjs +8 -8
- package/package.json +28 -31
- package/lib/commands/pm2.mjs +0 -16
- package/lib/commands/start.mjs +0 -50
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/builder/build/buildEsm.ts
|
|
2
|
-
import { createRequire } from "
|
|
3
|
-
import path from "
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import path from "path";
|
|
4
4
|
import fg from "fast-glob";
|
|
5
5
|
import { build as viteBuild } from "vite";
|
|
6
6
|
var require2 = createRequire(import.meta.url);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/builder/build/tarPlugin.ts
|
|
2
|
-
import { mkdir } from "
|
|
3
|
-
import path, { dirname } from "
|
|
2
|
+
import { mkdir } from "fs/promises";
|
|
3
|
+
import path, { dirname } from "path";
|
|
4
4
|
import Arborist from "@npmcli/arborist";
|
|
5
5
|
import fs from "fs-extra";
|
|
6
6
|
import packlist from "npm-packlist";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/builder/build/utils/buildPluginUtils.ts
|
|
2
|
-
import fs from "
|
|
3
|
-
import { builtinModules } from "
|
|
4
|
-
import path from "
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { builtinModules } from "module";
|
|
4
|
+
import path from "path";
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
var requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
|
|
7
7
|
var importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/builder/build/utils/getDepsConfig.ts
|
|
2
|
-
import { createRequire } from "
|
|
3
|
-
import path from "
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import path from "path";
|
|
4
4
|
import fs from "fs-extra";
|
|
5
5
|
var require2 = createRequire(import.meta.url);
|
|
6
6
|
function winPath(path2) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/builder/build/utils/utils.ts
|
|
2
|
-
import { createRequire } from "
|
|
3
|
-
import path from "
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import path from "path";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import fg from "fast-glob";
|
|
6
6
|
import fs from "fs-extra";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/builder/buildable-packages/app-web-package.ts
|
|
2
|
-
import path from "
|
|
2
|
+
import path from "path";
|
|
3
3
|
import { createRsbuild, loadConfig } from "@rsbuild/core";
|
|
4
4
|
import { ROOT_PATH } from "../build/constant.mjs";
|
|
5
5
|
import { tarPlugin } from "../build/tarPlugin.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/builder/buildable-packages/plugin-package.ts
|
|
2
|
-
import { createRequire } from "
|
|
3
|
-
import path from "
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import path from "path";
|
|
4
4
|
import ncc from "@vercel/ncc";
|
|
5
5
|
import react from "@vitejs/plugin-react";
|
|
6
6
|
import chalk from "chalk";
|
package/lib/cli.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import semver from "semver";
|
|
|
7
7
|
import commands from "./commands/index.mjs";
|
|
8
8
|
import { genTsConfigPaths, initEnv } from "./util.mjs";
|
|
9
9
|
import "./notify-updates.mjs";
|
|
10
|
-
import { createRequire } from "
|
|
10
|
+
import { createRequire } from "module";
|
|
11
11
|
var require2 = createRequire(import.meta.url);
|
|
12
12
|
var cli = new Command();
|
|
13
13
|
cli.version(require2("../package.json").version);
|
package/lib/commands/clean.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// src/commands/clean.ts
|
|
2
|
-
import {
|
|
2
|
+
import { rimrafSync } from "rimraf";
|
|
3
|
+
import { isDev } from "../util.mjs";
|
|
3
4
|
var clean_default = (cli) => {
|
|
4
5
|
cli.command("clean").option("--all").allowUnknownOption().action((opts) => {
|
|
5
6
|
if (!isDev()) {
|
|
6
7
|
return;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
rimrafSync("{apps,packages}/*/{lib,esm,es,dist,node_modules}", { glob: true });
|
|
9
10
|
if (opts.all) {
|
|
10
|
-
|
|
11
|
+
rimrafSync("node_modules", { glob: true });
|
|
11
12
|
}
|
|
12
|
-
run("rimraf", ["-rf", "apps/*/{lib,esm,es,dist,node_modules}"]);
|
|
13
|
-
run("rimraf", ["-rf", "packages/*/{lib,esm,es,dist,node_modules}"]);
|
|
14
13
|
});
|
|
15
14
|
};
|
|
16
15
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/commands/create-nginx-conf.ts
|
|
2
|
-
import { readFileSync, writeFileSync } from "
|
|
3
|
-
import { resolve } from "
|
|
4
|
-
import { URL } from "
|
|
2
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { URL } from "url";
|
|
5
5
|
var __dirname = new URL(".", import.meta.url).pathname;
|
|
6
6
|
var create_nginx_conf_default = (cli) => {
|
|
7
7
|
cli.command("create-nginx-conf").action(async (name, options) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/commands/create-plugin.ts
|
|
2
|
-
import { resolve } from "
|
|
2
|
+
import { resolve } from "path";
|
|
3
3
|
import { PluginGenerator } from "../plugin-generator.mjs";
|
|
4
4
|
var create_plugin_default = (cli) => {
|
|
5
5
|
cli.command("create-plugin").argument("<name>").allowUnknownOption().action(async (name, options) => {
|
package/lib/commands/e2e.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/commands/e2e.ts
|
|
2
|
-
import { execSync } from "
|
|
3
|
-
import { cpus } from "
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { cpus } from "os";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import treeKill from "tree-kill";
|
|
6
6
|
import { isPortReachable, run } from "../util.mjs";
|
|
@@ -61,7 +61,7 @@ async function appReady() {
|
|
|
61
61
|
}
|
|
62
62
|
async function runApp(options = {}) {
|
|
63
63
|
console.log("installing...");
|
|
64
|
-
await run("
|
|
64
|
+
await run("tego", ["install", "-f"]);
|
|
65
65
|
if (await isPortReachable(process.env.APP_PORT)) {
|
|
66
66
|
console.log("app started");
|
|
67
67
|
return;
|
|
@@ -181,7 +181,7 @@ var e2e_default = (cli) => {
|
|
|
181
181
|
runApp();
|
|
182
182
|
});
|
|
183
183
|
e2e.command("reinstall-app").action(async (options) => {
|
|
184
|
-
await run("
|
|
184
|
+
await run("tego", ["install", "-f"], options);
|
|
185
185
|
});
|
|
186
186
|
e2e.command("install-deps").action(async () => {
|
|
187
187
|
await run("npx", ["playwright", "install", "--with-deps"]);
|
package/lib/commands/index.mjs
CHANGED
|
@@ -8,9 +8,7 @@ import dev from "./dev.mjs";
|
|
|
8
8
|
import e2e from "./e2e.mjs";
|
|
9
9
|
import global from "./global.mjs";
|
|
10
10
|
import init from "./init.mjs";
|
|
11
|
-
import pm2 from "./pm2.mjs";
|
|
12
11
|
import postinstall from "./postinstall.mjs";
|
|
13
|
-
import start from "./start.mjs";
|
|
14
12
|
import tar from "./tar.mjs";
|
|
15
13
|
import test from "./test.mjs";
|
|
16
14
|
import upgrade from "./upgrade.mjs";
|
|
@@ -21,10 +19,8 @@ var commands_default = async (cli) => {
|
|
|
21
19
|
build(cli);
|
|
22
20
|
tar(cli);
|
|
23
21
|
dev(cli);
|
|
24
|
-
start(cli);
|
|
25
22
|
e2e(cli);
|
|
26
23
|
clean(cli);
|
|
27
|
-
pm2(cli);
|
|
28
24
|
test(cli);
|
|
29
25
|
upgrade(cli);
|
|
30
26
|
postinstall(cli);
|
package/lib/commands/p-test.mjs
CHANGED
|
@@ -6,8 +6,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/commands/p-test.ts
|
|
9
|
-
import { existsSync, mkdirSync, readFileSync } from "
|
|
10
|
-
import { resolve } from "
|
|
9
|
+
import { existsSync, mkdirSync, readFileSync } from "fs";
|
|
10
|
+
import { resolve } from "path";
|
|
11
11
|
import { parse } from "dotenv";
|
|
12
12
|
import { execa } from "execa";
|
|
13
13
|
import fastGlob from "fast-glob";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/commands/postinstall.ts
|
|
2
|
-
import { existsSync } from "
|
|
3
|
-
import { readFile, writeFile } from "
|
|
4
|
-
import { resolve } from "
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { readFile, writeFile } from "fs/promises";
|
|
4
|
+
import { resolve } from "path";
|
|
5
5
|
import { generatePlaywrightPath, isDev } from "../util.mjs";
|
|
6
6
|
var postinstall_default = (cli) => {
|
|
7
7
|
cli.command("postinstall").allowUnknownOption().action(async () => {
|
package/lib/commands/test.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/commands/test.ts
|
|
2
|
-
import { sep } from "
|
|
2
|
+
import { sep } from "path";
|
|
3
3
|
import { run } from "../util.mjs";
|
|
4
4
|
function addTestCommand(name, cli) {
|
|
5
5
|
return cli.command(name).option("-w, --watch").option("--run").option("--allowOnly").option("--bail").option("-h, --help").option("--single-thread [singleThread]").arguments("[paths...]").allowUnknownOption().action(async (paths, opts) => {
|
package/lib/constants.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/constants.ts
|
|
2
|
-
import { dirname, join } from "
|
|
3
|
-
import { fileURLToPath } from "
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
4
|
var __filename = fileURLToPath(import.meta.url);
|
|
5
5
|
var __dirname = dirname(__filename);
|
|
6
6
|
var STATIC_PATH = join(__dirname, "../assets");
|
package/lib/notify-updates.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/notify-updates.ts
|
|
2
|
-
import { createRequire } from "
|
|
2
|
+
import { createRequire } from "module";
|
|
3
3
|
import updateNotifier from "update-notifier";
|
|
4
4
|
var require2 = createRequire(import.meta.url);
|
|
5
5
|
updateNotifier({ pkg: require2("../package.json") }).notify({ defer: true });
|
package/lib/open.mjs
CHANGED
|
@@ -35,8 +35,8 @@ async function openBrowser(url) {
|
|
|
35
35
|
const browser = process.env.BROWSER;
|
|
36
36
|
const browserArgs = process.env.BROWSER_ARGS;
|
|
37
37
|
if (shouldTryAppleScript(browser, browserArgs)) {
|
|
38
|
-
const { exec } = await import("
|
|
39
|
-
const { promisify } = await import("
|
|
38
|
+
const { exec } = await import("child_process");
|
|
39
|
+
const { promisify } = await import("util");
|
|
40
40
|
const execAsync = promisify(exec);
|
|
41
41
|
const getDefaultBrowserForAppleScript = async () => {
|
|
42
42
|
const { stdout: ps } = await execAsync("ps cax");
|
|
@@ -6,8 +6,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/package-map-generator.ts
|
|
9
|
-
import { existsSync as _existsSync, existsSync, mkdirSync, readFileSync, rmSync, watch, writeFileSync } from "
|
|
10
|
-
import { dirname as _dirname, sep as _sep, join, relative, resolve, sep } from "
|
|
9
|
+
import { existsSync as _existsSync, existsSync, mkdirSync, readFileSync, rmSync, watch, writeFileSync } from "fs";
|
|
10
|
+
import { dirname as _dirname, sep as _sep, join, relative, resolve, sep } from "path";
|
|
11
11
|
import { sync } from "fast-glob";
|
|
12
12
|
import { version } from "../package.json";
|
|
13
13
|
var ProjectRoot = process.cwd();
|
package/lib/plugin-generator.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/plugin-generator.ts
|
|
2
|
-
import { existsSync } from "
|
|
3
|
-
import { readFile } from "
|
|
4
|
-
import { join, resolve } from "
|
|
5
|
-
import { URL } from "
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { readFile } from "fs/promises";
|
|
4
|
+
import { join, resolve } from "path";
|
|
5
|
+
import { URL } from "url";
|
|
6
6
|
import { Generator } from "@umijs/utils";
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import { execa } from "execa";
|
package/lib/util.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/util.ts
|
|
2
|
-
import { createHash } from "
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
3
|
import {
|
|
4
4
|
cpSync as _cpSync,
|
|
5
5
|
existsSync as _existsSync,
|
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
symlinkSync,
|
|
12
12
|
unlinkSync,
|
|
13
13
|
writeFileSync
|
|
14
|
-
} from "
|
|
15
|
-
import { mkdir, readFile, stat, unlink, writeFile } from "
|
|
16
|
-
import { createRequire } from "
|
|
17
|
-
import { Socket } from "
|
|
18
|
-
import { dirname, join, resolve, sep } from "
|
|
19
|
-
import { pipeline } from "
|
|
14
|
+
} from "fs";
|
|
15
|
+
import { mkdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
|
16
|
+
import { createRequire } from "module";
|
|
17
|
+
import { Socket } from "net";
|
|
18
|
+
import { dirname, join, resolve, sep } from "path";
|
|
19
|
+
import { pipeline } from "stream/promises";
|
|
20
20
|
import chalk from "chalk";
|
|
21
21
|
import { config } from "dotenv";
|
|
22
22
|
import { execa } from "execa";
|
|
@@ -332,7 +332,7 @@ var getHostInUrl = async (host) => {
|
|
|
332
332
|
if (host === DEFAULT_DEV_HOST) {
|
|
333
333
|
return "localhost";
|
|
334
334
|
}
|
|
335
|
-
const { isIPv6 } = await import("
|
|
335
|
+
const { isIPv6 } = await import("net");
|
|
336
336
|
if (isIPv6(host)) {
|
|
337
337
|
return host === "::" ? "[::1]" : `[${host}]`;
|
|
338
338
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tego/devkit",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -19,56 +19,53 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@hapi/topo": "^6.0.2",
|
|
22
|
-
"@npmcli/arborist": "9.1.2",
|
|
22
|
+
"@npmcli/arborist": "^9.1.2",
|
|
23
23
|
"@pnpm/workspace.find-packages": "^1.1.12",
|
|
24
|
-
"@rsbuild/core": "1.4.
|
|
25
|
-
"@rsbuild/plugin-less": "1.2.
|
|
26
|
-
"@rsbuild/plugin-react": "1.3.
|
|
27
|
-
"@rslib/core": "0.10.
|
|
24
|
+
"@rsbuild/core": "^1.4.7",
|
|
25
|
+
"@rsbuild/plugin-less": "^1.2.5",
|
|
26
|
+
"@rsbuild/plugin-react": "^1.3.3",
|
|
27
|
+
"@rslib/core": "^0.10.6",
|
|
28
28
|
"@types/fs-extra": "^11.0.4",
|
|
29
|
-
"@umijs/utils": "3.5.43",
|
|
30
|
-
"@vercel/ncc": "0.38.3",
|
|
29
|
+
"@umijs/utils": "^3.5.43",
|
|
30
|
+
"@vercel/ncc": "^0.38.3",
|
|
31
31
|
"@vitejs/plugin-react": "^4.6.0",
|
|
32
32
|
"chalk": "^5.4.1",
|
|
33
33
|
"commander": "^12.1.0",
|
|
34
|
-
"dotenv": "^16.
|
|
34
|
+
"dotenv": "^16.6.1",
|
|
35
35
|
"execa": "^8.0.1",
|
|
36
36
|
"fast-glob": "^3.3.3",
|
|
37
37
|
"fs-extra": "^11.3.0",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
|
-
"npm-packlist": "10.0.0",
|
|
40
|
-
"open": "10.1.2",
|
|
41
|
-
"p-all": "3.0.0",
|
|
42
|
-
"package-json": "10.0.1",
|
|
43
|
-
"pm2": "6.0.8",
|
|
39
|
+
"npm-packlist": "^10.0.0",
|
|
40
|
+
"open": "^10.1.2",
|
|
41
|
+
"p-all": "^3.0.0",
|
|
42
|
+
"package-json": "^10.0.1",
|
|
44
43
|
"portfinder": "^1.0.37",
|
|
45
|
-
"
|
|
44
|
+
"rimraf": "^6.0.1",
|
|
45
|
+
"semver": "^7.7.2",
|
|
46
46
|
"serve": "^14.2.4",
|
|
47
|
-
"tar": "7.4.3",
|
|
47
|
+
"tar": "^7.4.3",
|
|
48
48
|
"tree-kill": "^1.2.2",
|
|
49
49
|
"tsconfig-paths": "^4.2.0",
|
|
50
|
-
"tsup": "8.
|
|
51
|
-
"tsx": "4.20.3",
|
|
52
|
-
"typescript": "5.8.3",
|
|
53
|
-
"update-notifier": "7.3.1",
|
|
54
|
-
"vite": "^
|
|
50
|
+
"tsup": "^8.5.0",
|
|
51
|
+
"tsx": "^4.20.3",
|
|
52
|
+
"typescript": "^5.8.3",
|
|
53
|
+
"update-notifier": "^7.3.1",
|
|
54
|
+
"vite": "^7.0.1",
|
|
55
55
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
56
|
-
"yargs-parser": "13.1.2",
|
|
57
|
-
"yocto-spinner": "1.0.0"
|
|
56
|
+
"yargs-parser": "^13.1.2",
|
|
57
|
+
"yocto-spinner": "^1.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/fs-extra": "^11.0.4",
|
|
61
|
-
"@types/lodash": "^4.17.
|
|
61
|
+
"@types/lodash": "^4.17.20",
|
|
62
62
|
"@types/node": "20.17.10",
|
|
63
|
-
"@types/npm-packlist": "7.0.3",
|
|
64
|
-
"@types/npmcli__arborist": "6.3.1",
|
|
63
|
+
"@types/npm-packlist": "^7.0.3",
|
|
64
|
+
"@types/npmcli__arborist": "^6.3.1",
|
|
65
65
|
"@types/semver": "^7.7.0",
|
|
66
66
|
"@types/tar": "^6.1.13",
|
|
67
|
-
"@types/update-notifier": "6.0.8",
|
|
68
|
-
"
|
|
69
|
-
"esbuild-plugin-file-path-extensions": "2.1.4",
|
|
70
|
-
"rimraf": "6.0.1",
|
|
71
|
-
"vite": "^5.4.19"
|
|
67
|
+
"@types/update-notifier": "^6.0.8",
|
|
68
|
+
"esbuild-plugin-file-path-extensions": "^2.1.4"
|
|
72
69
|
},
|
|
73
70
|
"scripts": {
|
|
74
71
|
"build": "tsup",
|
package/lib/commands/pm2.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/commands/pm2.ts
|
|
2
|
-
import { run } from "../util.mjs";
|
|
3
|
-
var pm2_default = (cli) => {
|
|
4
|
-
cli.command("pm2").allowUnknownOption().action(() => {
|
|
5
|
-
run("pm2", process.argv.slice(3));
|
|
6
|
-
});
|
|
7
|
-
cli.command("pm2-restart").allowUnknownOption().action(() => {
|
|
8
|
-
run("pm2", ["restart", "all"]);
|
|
9
|
-
});
|
|
10
|
-
cli.command("pm2-stop").allowUnknownOption().action(() => {
|
|
11
|
-
run("pm2", ["stop", "all"]);
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
pm2_default as default
|
|
16
|
-
};
|
package/lib/commands/start.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// src/commands/start.ts
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
import { postCheck, promptForTs, run } from "../util.mjs";
|
|
6
|
-
var start_default = (cli) => {
|
|
7
|
-
const { APP_SERVER_ROOT, NODE_ARGS } = process.env;
|
|
8
|
-
cli.command("start").option("-p, --port [port]").option("-d, --daemon").option("-i, --instances [number]").option("--db-sync").option("--quickstart").allowUnknownOption().action(async (opts) => {
|
|
9
|
-
if (opts.port) {
|
|
10
|
-
process.env.APP_PORT = opts.port;
|
|
11
|
-
}
|
|
12
|
-
if (process.argv.includes("-h") || process.argv.includes("--help")) {
|
|
13
|
-
promptForTs();
|
|
14
|
-
run("tsx", [
|
|
15
|
-
"--tsconfig",
|
|
16
|
-
process.env.SERVER_TSCONFIG_PATH ?? "",
|
|
17
|
-
"-r",
|
|
18
|
-
"tsconfig-paths/register",
|
|
19
|
-
`${APP_SERVER_ROOT}/src/index.ts`,
|
|
20
|
-
...process.argv.slice(2)
|
|
21
|
-
]);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (!existsSync(resolve(process.cwd(), `${APP_SERVER_ROOT}/lib/index.js`))) {
|
|
25
|
-
console.log("The code is not compiled, please execute it first");
|
|
26
|
-
console.log(chalk.yellow("$ pnpm build"));
|
|
27
|
-
console.log("If you want to run in development mode, please execute");
|
|
28
|
-
console.log(chalk.yellow("$ pnpm dev"));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
await postCheck(opts);
|
|
32
|
-
if (opts.daemon) {
|
|
33
|
-
run("pm2", ["start", `${APP_SERVER_ROOT}/lib/index.js`, "--", ...process.argv.slice(2)]);
|
|
34
|
-
} else {
|
|
35
|
-
run(
|
|
36
|
-
"pm2-runtime",
|
|
37
|
-
[
|
|
38
|
-
"start",
|
|
39
|
-
`${APP_SERVER_ROOT}/lib/index.js`,
|
|
40
|
-
NODE_ARGS ? `--node-args="${NODE_ARGS}"` : "",
|
|
41
|
-
"--",
|
|
42
|
-
...process.argv.slice(2)
|
|
43
|
-
].filter(Boolean)
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
start_default as default
|
|
50
|
-
};
|