verus-pm 0.2.5 → 0.2.6
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/verus-darwin-amd64 +0 -0
- package/bin/verus-darwin-arm64 +0 -0
- package/bin/verus-linux-amd64 +0 -0
- package/bin/verus-linux-arm64 +0 -0
- package/bin/verus-windows-amd64.exe +0 -0
- package/bin/verus.js +12 -2
- package/package.json +2 -6
- package/scripts/postinstall.js +0 -135
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/verus.js
CHANGED
|
@@ -4,11 +4,21 @@ const { existsSync } = require("node:fs");
|
|
|
4
4
|
const { spawnSync } = require("node:child_process");
|
|
5
5
|
const { join } = require("node:path");
|
|
6
6
|
|
|
7
|
+
const PLATFORM_NAMES = { darwin: "darwin", linux: "linux", win32: "windows" };
|
|
8
|
+
const ARCH_NAMES = { x64: "amd64", arm64: "arm64" };
|
|
7
9
|
const ext = process.platform === "win32" ? ".exe" : "";
|
|
8
|
-
const
|
|
10
|
+
const platform = PLATFORM_NAMES[process.platform];
|
|
11
|
+
const arch = ARCH_NAMES[process.arch];
|
|
12
|
+
const candidates = [];
|
|
13
|
+
|
|
14
|
+
if (platform && arch) {
|
|
15
|
+
candidates.push(join(__dirname, `verus-${platform}-${arch}${ext}`));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
candidates.push(
|
|
9
19
|
join(__dirname, `verus-native${ext}`),
|
|
10
20
|
join(__dirname, `verus${ext}`),
|
|
11
|
-
|
|
21
|
+
);
|
|
12
22
|
const binaryPath = candidates.find((candidate) => existsSync(candidate));
|
|
13
23
|
|
|
14
24
|
if (!binaryPath) {
|
package/package.json
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "verus-pm",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "AI-powered project management — CLI + Web Dashboard in one command",
|
|
5
5
|
"bin": {
|
|
6
6
|
"verus": "./bin/verus.js",
|
|
7
7
|
"vr": "./bin/verus.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"bin
|
|
11
|
-
"scripts",
|
|
10
|
+
"bin",
|
|
12
11
|
"README.md",
|
|
13
12
|
"LICENSE"
|
|
14
13
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"postinstall": "node scripts/postinstall.js"
|
|
17
|
-
},
|
|
18
14
|
"keywords": [
|
|
19
15
|
"cli",
|
|
20
16
|
"task-management",
|
package/scripts/postinstall.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verus postinstall — downloads the self-contained Go binary for current platform.
|
|
3
|
-
* The binary includes the embedded WebUI, so no separate UI files needed.
|
|
4
|
-
*
|
|
5
|
-
* Strategy:
|
|
6
|
-
* 1. Check if binary already exists (dev build via `make npm-local`)
|
|
7
|
-
* 2. Download pre-built binary from GitHub Releases
|
|
8
|
-
* 3. Try building from source (if in source repo + Go installed)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const { existsSync, mkdirSync, chmodSync, createWriteStream, unlinkSync } = require("node:fs");
|
|
12
|
-
const { join } = require("node:path");
|
|
13
|
-
const { execSync } = require("node:child_process");
|
|
14
|
-
const https = require("node:https");
|
|
15
|
-
|
|
16
|
-
const binDir = join(__dirname, "..", "bin");
|
|
17
|
-
const REPO = "thanhduy1812/verus";
|
|
18
|
-
const NATIVE_BINARY_BASENAME = "verus-native";
|
|
19
|
-
|
|
20
|
-
function info(msg) { console.log(` ℹ ${msg}`); }
|
|
21
|
-
function ok(msg) { console.log(` ✅ ${msg}`); }
|
|
22
|
-
function warn(msg) { console.log(` ⚠️ ${msg}`); }
|
|
23
|
-
|
|
24
|
-
const PLATFORMS = { darwin: "darwin", linux: "linux", win32: "windows" };
|
|
25
|
-
const ARCHS = { x64: "amd64", arm64: "arm64", arm: "arm" };
|
|
26
|
-
|
|
27
|
-
async function main() {
|
|
28
|
-
console.log("\n ⚡ Verus — installing binary...\n");
|
|
29
|
-
|
|
30
|
-
const platform = PLATFORMS[process.platform];
|
|
31
|
-
const arch = ARCHS[process.arch];
|
|
32
|
-
const ext = process.platform === "win32" ? ".exe" : "";
|
|
33
|
-
const binaryName = `${NATIVE_BINARY_BASENAME}${ext}`;
|
|
34
|
-
const binaryPath = join(binDir, binaryName);
|
|
35
|
-
const legacyBinaryPath = join(binDir, `verus${ext}`);
|
|
36
|
-
|
|
37
|
-
if (!platform || !arch) {
|
|
38
|
-
warn(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
39
|
-
warn(`Download manually from: https://github.com/${REPO}/releases`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Already exists? (dev build via make npm-local)
|
|
44
|
-
if (existsSync(binaryPath) || existsSync(legacyBinaryPath)) {
|
|
45
|
-
ok(`Binary exists: ${existsSync(binaryPath) ? binaryPath : legacyBinaryPath}`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
mkdirSync(binDir, { recursive: true });
|
|
50
|
-
info(`Platform: ${platform}-${arch}`);
|
|
51
|
-
|
|
52
|
-
// 1. Try GitHub Releases first (fastest for end users)
|
|
53
|
-
try {
|
|
54
|
-
const release = await fetchJSON(`https://api.github.com/repos/${REPO}/releases/latest`);
|
|
55
|
-
if (release && release.tag_name) {
|
|
56
|
-
const tag = release.tag_name;
|
|
57
|
-
const assetName = `verus-${platform}-${arch}${ext}`;
|
|
58
|
-
const url = `https://github.com/${REPO}/releases/download/${tag}/${assetName}`;
|
|
59
|
-
info(`Downloading ${tag} (${assetName})...`);
|
|
60
|
-
await downloadFile(url, binaryPath);
|
|
61
|
-
chmodSync(binaryPath, 0o755);
|
|
62
|
-
ok(`Installed verus ${tag}`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
} catch (e) { /* Release not available yet */ }
|
|
66
|
-
|
|
67
|
-
// 2. Try building from source (if in source repo + Go installed)
|
|
68
|
-
try {
|
|
69
|
-
execSync("go version", { stdio: "pipe" });
|
|
70
|
-
const goModPath = join(__dirname, "..", "..", "go.mod");
|
|
71
|
-
if (existsSync(goModPath)) {
|
|
72
|
-
const sourceRoot = join(__dirname, "..", "..");
|
|
73
|
-
info("Building from source (Go found + source repo detected)...");
|
|
74
|
-
|
|
75
|
-
// Build UI first if possible
|
|
76
|
-
const uiDir = join(sourceRoot, "ui");
|
|
77
|
-
const uiDistDir = join(sourceRoot, "internal", "server", "ui_dist");
|
|
78
|
-
if (existsSync(join(uiDir, "package.json"))) {
|
|
79
|
-
try {
|
|
80
|
-
info("Building UI...");
|
|
81
|
-
execSync("npm install --silent && npm run build", { cwd: uiDir, stdio: "pipe" });
|
|
82
|
-
mkdirSync(uiDistDir, { recursive: true });
|
|
83
|
-
execSync(`cp -R ${join(uiDir, "dist")}/* "${uiDistDir}/"`, { stdio: "pipe" });
|
|
84
|
-
} catch (e) {
|
|
85
|
-
info("UI build skipped (non-critical)");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
execSync(`CGO_ENABLED=0 go build -ldflags "-s -w" -o "${binaryPath}" .`, {
|
|
90
|
-
cwd: sourceRoot,
|
|
91
|
-
stdio: "inherit",
|
|
92
|
-
});
|
|
93
|
-
chmodSync(binaryPath, 0o755);
|
|
94
|
-
ok("Built from source");
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
} catch (e) { /* Go not available */ }
|
|
98
|
-
|
|
99
|
-
warn("Could not install binary automatically.");
|
|
100
|
-
warn(`Download from: https://github.com/${REPO}/releases`);
|
|
101
|
-
warn(`Place binary at: ${binaryPath}`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function fetchJSON(url) {
|
|
105
|
-
return new Promise((resolve, reject) => {
|
|
106
|
-
https.get(url, { headers: { "User-Agent": "verus-npm" } }, (res) => {
|
|
107
|
-
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
108
|
-
return fetchJSON(res.headers.location).then(resolve).catch(reject);
|
|
109
|
-
}
|
|
110
|
-
let data = "";
|
|
111
|
-
res.on("data", (c) => (data += c));
|
|
112
|
-
res.on("end", () => { try { resolve(JSON.parse(data)); } catch { resolve(null); } });
|
|
113
|
-
}).on("error", reject);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function downloadFile(url, dest) {
|
|
118
|
-
return new Promise((resolve, reject) => {
|
|
119
|
-
https.get(url, { headers: { "User-Agent": "verus-npm" } }, (res) => {
|
|
120
|
-
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
121
|
-
return downloadFile(res.headers.location, dest).then(resolve).catch(reject);
|
|
122
|
-
}
|
|
123
|
-
if (res.statusCode !== 200) { reject(new Error(`HTTP ${res.statusCode}`)); return; }
|
|
124
|
-
const file = createWriteStream(dest);
|
|
125
|
-
res.pipe(file);
|
|
126
|
-
file.on("finish", () => { file.close(); resolve(); });
|
|
127
|
-
file.on("error", (e) => { unlinkSync(dest); reject(e); });
|
|
128
|
-
}).on("error", reject);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
main().catch((err) => {
|
|
133
|
-
console.error(" ❌ Install error:", err.message);
|
|
134
|
-
process.exit(0); // Don't break npm install
|
|
135
|
-
});
|