@gbits-jszx/dg-cli 0.0.5 → 0.0.7
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/bin/dg-cli.js +23 -0
- package/package.json +6 -6
package/bin/dg-cli.js
CHANGED
|
@@ -7,6 +7,29 @@ const { execFileSync } = require("child_process");
|
|
|
7
7
|
|
|
8
8
|
const platform = process.platform; // 'linux' / 'darwin' / 'win32'
|
|
9
9
|
const arch = process.arch; // 'x64' / 'arm64'
|
|
10
|
+
|
|
11
|
+
// WSL 误用检测:node 是 Linux 进程时能直接看到 WSL_DISTRO_NAME;
|
|
12
|
+
// 若 platform=win32 但 env 含 WSL 标记,说明 npx 是 /mnt/c 上的 Windows nodejs
|
|
13
|
+
// 通过 interop 拉起的,再继续会启动 dg-cli.exe → home/路径全错位。
|
|
14
|
+
// node 端能可靠看到这些 env(cmd.exe /c 拉起 .exe 之前),所以在 bootstrap 拦最稳。
|
|
15
|
+
if (
|
|
16
|
+
platform === "win32" &&
|
|
17
|
+
(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP || process.env.WSLENV)
|
|
18
|
+
) {
|
|
19
|
+
console.error(
|
|
20
|
+
"[dg-cli] 检测到当前 npx 是 Windows 版 nodejs(通过 WSL interop 调起),但你正在 WSL 中。"
|
|
21
|
+
);
|
|
22
|
+
console.error(
|
|
23
|
+
" 继续会拉起 dg-cli.exe,导致 HOME / docker mount / yaml 路径全部错位到 C:\\Users\\..."
|
|
24
|
+
);
|
|
25
|
+
console.error("");
|
|
26
|
+
console.error("修复(WSL 里执行):");
|
|
27
|
+
console.error(" curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -");
|
|
28
|
+
console.error(" sudo apt-get install -y nodejs");
|
|
29
|
+
console.error(" hash -r && which npx # 应为 /usr/bin/npx,再重跑 dg-cli");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
10
33
|
const pkg = `@gbits-jszx/dg-cli-${platform}-${arch}`;
|
|
11
34
|
const exe = platform === "win32" ? "dg-cli.exe" : "dg-cli";
|
|
12
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gbits-jszx/dg-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "DataGateway CLI — 部署/运维/配置一站式(Go binary,npx 分发)",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dg-cli": "bin/dg-cli.js"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"node": ">=14"
|
|
14
14
|
},
|
|
15
15
|
"optionalDependencies": {
|
|
16
|
-
"@gbits-jszx/dg-cli-linux-x64": "0.0.
|
|
17
|
-
"@gbits-jszx/dg-cli-linux-arm64": "0.0.
|
|
18
|
-
"@gbits-jszx/dg-cli-darwin-x64": "0.0.
|
|
19
|
-
"@gbits-jszx/dg-cli-darwin-arm64": "0.0.
|
|
20
|
-
"@gbits-jszx/dg-cli-win32-x64": "0.0.
|
|
16
|
+
"@gbits-jszx/dg-cli-linux-x64": "0.0.7",
|
|
17
|
+
"@gbits-jszx/dg-cli-linux-arm64": "0.0.7",
|
|
18
|
+
"@gbits-jszx/dg-cli-darwin-x64": "0.0.7",
|
|
19
|
+
"@gbits-jszx/dg-cli-darwin-arm64": "0.0.7",
|
|
20
|
+
"@gbits-jszx/dg-cli-win32-x64": "0.0.7"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"repository": {
|