devtunnel-cli 3.1.3 → 3.1.4
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/package.json +1 -1
- package/src/core/RUN.js +71 -71
- package/src/core/index.js +384 -380
- package/src/core/start.js +762 -703
- package/src/utils/folder-picker.js +160 -160
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devtunnel-cli",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DevTunnel-CLI — fast, zero-config tool to share local servers for development, testing, demos, and webhook debugging. npm i -g devtunnel-cli.",
|
|
6
6
|
"main": "src/core/start.js",
|
package/src/core/RUN.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Universal Node.js Launcher - Works on ALL platforms!
|
|
4
|
-
import { spawn } from "child_process";
|
|
5
|
-
import { readFileSync, existsSync } from "fs";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
7
|
-
import { dirname, join } from "path";
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = dirname(__filename);
|
|
11
|
-
|
|
12
|
-
// Version flags: devtunnel-cli --version, -v, or --v
|
|
13
|
-
const args = process.argv.slice(2);
|
|
14
|
-
const showVersion = args.some((a) => a === "--version" || a === "-v" || a === "--v");
|
|
15
|
-
if (showVersion) {
|
|
16
|
-
try {
|
|
17
|
-
const pkgPath = join(dirname(dirname(__dirname)), "package.json");
|
|
18
|
-
const version = existsSync(pkgPath)
|
|
19
|
-
? JSON.parse(readFileSync(pkgPath, "utf8")).version
|
|
20
|
-
: "?.?.?";
|
|
21
|
-
console.log(version);
|
|
22
|
-
} catch (err) {
|
|
23
|
-
console.log("?.?.?");
|
|
24
|
-
}
|
|
25
|
-
process.exit(0);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const originalEmitWarning = process.emitWarning;
|
|
29
|
-
process.emitWarning = function(warning, ...args) {
|
|
30
|
-
if (typeof warning === 'string' && warning.includes('util._extend')) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
return originalEmitWarning.call(this, warning, ...args);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
process.stdout.write('\x1B[2J\x1B[0f');
|
|
37
|
-
console.clear();
|
|
38
|
-
|
|
39
|
-
const startPath = join(__dirname, "start.js");
|
|
40
|
-
// Use same Node binary as current process (works when "node" is not in PATH)
|
|
41
|
-
const nodeBin = process.execPath;
|
|
42
|
-
const child = spawn(nodeBin, [startPath], {
|
|
43
|
-
stdio: "inherit",
|
|
44
|
-
shell: false
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
child.on("error", (err) => {
|
|
48
|
-
if (err.code === "ENOENT") {
|
|
49
|
-
console.error("❌ Node.js is required but could not be found.");
|
|
50
|
-
console.error(" Install from: https://nodejs.org");
|
|
51
|
-
} else {
|
|
52
|
-
console.error("❌ Error starting app:", err.message);
|
|
53
|
-
}
|
|
54
|
-
process.exit(1);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
child.on("close", (code) => {
|
|
58
|
-
if (code !== 0) {
|
|
59
|
-
console.log(`\n⚠️ Process exited with code ${code}`);
|
|
60
|
-
}
|
|
61
|
-
process.exit(code || 0);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Handle Ctrl+C
|
|
65
|
-
process.on("SIGINT", () => {
|
|
66
|
-
child.kill("SIGINT");
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
process.on("SIGTERM", () => {
|
|
70
|
-
child.kill("SIGTERM");
|
|
71
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Universal Node.js Launcher - Works on ALL platforms!
|
|
4
|
+
import { spawn } from "child_process";
|
|
5
|
+
import { readFileSync, existsSync } from "fs";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import { dirname, join } from "path";
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
|
|
12
|
+
// Version flags: devtunnel-cli --version, -v, or --v
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const showVersion = args.some((a) => a === "--version" || a === "-v" || a === "--v");
|
|
15
|
+
if (showVersion) {
|
|
16
|
+
try {
|
|
17
|
+
const pkgPath = join(dirname(dirname(__dirname)), "package.json");
|
|
18
|
+
const version = existsSync(pkgPath)
|
|
19
|
+
? JSON.parse(readFileSync(pkgPath, "utf8")).version
|
|
20
|
+
: "?.?.?";
|
|
21
|
+
console.log(version);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.log("?.?.?");
|
|
24
|
+
}
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const originalEmitWarning = process.emitWarning;
|
|
29
|
+
process.emitWarning = function(warning, ...args) {
|
|
30
|
+
if (typeof warning === 'string' && warning.includes('util._extend')) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
return originalEmitWarning.call(this, warning, ...args);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
process.stdout.write('\x1B[2J\x1B[0f');
|
|
37
|
+
console.clear();
|
|
38
|
+
|
|
39
|
+
const startPath = join(__dirname, "start.js");
|
|
40
|
+
// Use same Node binary as current process (works when "node" is not in PATH)
|
|
41
|
+
const nodeBin = process.execPath;
|
|
42
|
+
const child = spawn(nodeBin, [startPath], {
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
shell: false
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
child.on("error", (err) => {
|
|
48
|
+
if (err.code === "ENOENT") {
|
|
49
|
+
console.error("❌ Node.js is required but could not be found.");
|
|
50
|
+
console.error(" Install from: https://nodejs.org");
|
|
51
|
+
} else {
|
|
52
|
+
console.error("❌ Error starting app:", err.message);
|
|
53
|
+
}
|
|
54
|
+
process.exit(1);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
child.on("close", (code) => {
|
|
58
|
+
if (code !== 0) {
|
|
59
|
+
console.log(`\n⚠️ Process exited with code ${code}`);
|
|
60
|
+
}
|
|
61
|
+
process.exit(code || 0);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Handle Ctrl+C
|
|
65
|
+
process.on("SIGINT", () => {
|
|
66
|
+
child.kill("SIGINT");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
process.on("SIGTERM", () => {
|
|
70
|
+
child.kill("SIGTERM");
|
|
71
|
+
});
|