buildwithnexus 0.4.1 → 0.4.3
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/dist/bin.js +34 -20
- package/dist/nexus-release.tar.gz +0 -0
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -524,8 +524,10 @@ async function launchVm(platform, diskPath, initIsoPath, ram, cpus, ports) {
|
|
|
524
524
|
];
|
|
525
525
|
try {
|
|
526
526
|
await execa(platform.qemuBinary, buildArgs(platform.qemuCpuFlag.split(" ")), { env: scrubEnv() });
|
|
527
|
+
process.stderr.write(" [vm] Hardware acceleration (HVF) active\n");
|
|
527
528
|
} catch {
|
|
528
529
|
const fallbackCpu = platform.os === "mac" ? ["-cpu", "max"] : ["-cpu", "qemu64"];
|
|
530
|
+
process.stderr.write(" [vm] WARNING: HVF unavailable \u2014 using software emulation (VM will be slower)\n");
|
|
529
531
|
await execa(platform.qemuBinary, buildArgs(fallbackCpu), { env: scrubEnv() });
|
|
530
532
|
}
|
|
531
533
|
return ports;
|
|
@@ -671,7 +673,7 @@ function addSshConfig(port) {
|
|
|
671
673
|
fs4.writeFileSync(sshConfigPath, block, { mode: 384 });
|
|
672
674
|
}
|
|
673
675
|
}
|
|
674
|
-
async function waitForSsh(port, timeoutMs =
|
|
676
|
+
async function waitForSsh(port, timeoutMs = 9e5) {
|
|
675
677
|
const start = Date.now();
|
|
676
678
|
while (Date.now() - start < timeoutMs) {
|
|
677
679
|
try {
|
|
@@ -681,13 +683,13 @@ async function waitForSsh(port, timeoutMs = 3e5) {
|
|
|
681
683
|
port,
|
|
682
684
|
username: "nexus",
|
|
683
685
|
privateKeyPath: SSH_KEY,
|
|
684
|
-
readyTimeout:
|
|
686
|
+
readyTimeout: 1e4,
|
|
685
687
|
hostVerifier: getHostVerifier()
|
|
686
688
|
});
|
|
687
689
|
ssh.dispose();
|
|
688
690
|
return true;
|
|
689
691
|
} catch {
|
|
690
|
-
await new Promise((r) => setTimeout(r,
|
|
692
|
+
await new Promise((r) => setTimeout(r, 1e4));
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
return false;
|
|
@@ -1115,14 +1117,12 @@ async function installCloudflared(sshPort, arch) {
|
|
|
1115
1117
|
].join(" && "));
|
|
1116
1118
|
}
|
|
1117
1119
|
async function startTunnel(sshPort) {
|
|
1118
|
-
await sshExec(
|
|
1119
|
-
|
|
1120
|
-
"&& nohup cloudflared tunnel --no-autoupdate --url http://localhost:4200"
|
|
1121
|
-
|
|
1122
|
-
"disown"
|
|
1123
|
-
].join(" "));
|
|
1120
|
+
await sshExec(
|
|
1121
|
+
sshPort,
|
|
1122
|
+
"install -m 600 /dev/null /home/nexus/.nexus/tunnel.log && bash -c 'nohup cloudflared tunnel --no-autoupdate --url http://localhost:4200 > /home/nexus/.nexus/tunnel.log 2>&1 &'"
|
|
1123
|
+
);
|
|
1124
1124
|
const start = Date.now();
|
|
1125
|
-
while (Date.now() - start <
|
|
1125
|
+
while (Date.now() - start < 12e4) {
|
|
1126
1126
|
try {
|
|
1127
1127
|
const { stdout } = await sshExec(sshPort, "grep -oE 'https://[a-z0-9-]+\\.trycloudflare\\.com' /home/nexus/.nexus/tunnel.log 2>/dev/null | head -1");
|
|
1128
1128
|
if (stdout.includes("https://")) {
|
|
@@ -1155,11 +1155,18 @@ import crypto4 from "crypto";
|
|
|
1155
1155
|
import { fileURLToPath } from "url";
|
|
1156
1156
|
function getReleaseTarball() {
|
|
1157
1157
|
const dir = path6.dirname(fileURLToPath(import.meta.url));
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1158
|
+
const possiblePaths = [
|
|
1159
|
+
// Current directory (dev)
|
|
1160
|
+
path6.join(dir, "nexus-release.tar.gz"),
|
|
1161
|
+
// dist folder (when built)
|
|
1162
|
+
path6.resolve(dir, "..", "dist", "nexus-release.tar.gz"),
|
|
1163
|
+
// node_modules location (when installed from npm)
|
|
1164
|
+
path6.resolve(dir, "..", "nexus-release.tar.gz")
|
|
1165
|
+
];
|
|
1166
|
+
for (const tarballPath of possiblePaths) {
|
|
1167
|
+
if (fs6.existsSync(tarballPath)) return tarballPath;
|
|
1168
|
+
}
|
|
1169
|
+
throw new Error("nexus-release.tar.gz not found. Run: npm install buildwithnexus@latest");
|
|
1163
1170
|
}
|
|
1164
1171
|
function getCloudInitTemplate() {
|
|
1165
1172
|
const dir = path6.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1691,11 +1698,18 @@ init_qemu();
|
|
|
1691
1698
|
init_ssh();
|
|
1692
1699
|
function getReleaseTarball2() {
|
|
1693
1700
|
const dir = path9.dirname(fileURLToPath2(import.meta.url));
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1701
|
+
const possiblePaths = [
|
|
1702
|
+
// Current directory (dev)
|
|
1703
|
+
path9.join(dir, "nexus-release.tar.gz"),
|
|
1704
|
+
// dist folder (when built)
|
|
1705
|
+
path9.resolve(dir, "..", "dist", "nexus-release.tar.gz"),
|
|
1706
|
+
// node_modules location (when installed from npm)
|
|
1707
|
+
path9.resolve(dir, "..", "nexus-release.tar.gz")
|
|
1708
|
+
];
|
|
1709
|
+
for (const tarballPath of possiblePaths) {
|
|
1710
|
+
if (fs8.existsSync(tarballPath)) return tarballPath;
|
|
1711
|
+
}
|
|
1712
|
+
throw new Error("nexus-release.tar.gz not found. Run: npm install buildwithnexus@latest");
|
|
1699
1713
|
}
|
|
1700
1714
|
var updateCommand = new Command7("update").description("Update NEXUS to the latest bundled release and restart").action(async () => {
|
|
1701
1715
|
const config = loadConfig();
|
|
Binary file
|