onecrawl 4.0.0-beta.3 → 4.0.0-beta.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 +3 -3
- package/scripts/postinstall.js +23 -3
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onecrawl",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Browser automation engine — CLI, MCP server, and agent skills installer",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Giulio Leone <giulio@onecrawl.dev>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/giulio-leone/onecrawl.git",
|
|
9
|
+
"url": "git+https://github.com/giulio-leone/onecrawl.git",
|
|
10
10
|
"directory": "packages/onecrawl"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/giulio-leone/onecrawl",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "./lib/index.js",
|
|
20
20
|
"bin": {
|
|
21
|
-
"onecrawl": "
|
|
21
|
+
"onecrawl": "bin/cli.js"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"bin/cli.js",
|
package/scripts/postinstall.js
CHANGED
|
@@ -47,13 +47,18 @@ if (existsSync(destPath)) {
|
|
|
47
47
|
console.log(`✅ OneCrawl binary already installed (${ver})`);
|
|
48
48
|
process.exit(0);
|
|
49
49
|
}
|
|
50
|
+
unlinkSync(destPath);
|
|
50
51
|
} catch {
|
|
51
52
|
// binary exists but can't run — re-download
|
|
53
|
+
try {
|
|
54
|
+
unlinkSync(destPath);
|
|
55
|
+
} catch {}
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
const RELEASE_URL = `https://github.com/giulio-leone/onecrawl/releases/download/v${VERSION}/${binaryName}.gz`;
|
|
56
60
|
const FALLBACK_URL = `https://github.com/giulio-leone/onecrawl/releases/latest/download/${binaryName}.gz`;
|
|
61
|
+
const ALLOW_LATEST_FALLBACK = process.env.ONECRAWL_ALLOW_LATEST_BINARY_FALLBACK === "1";
|
|
57
62
|
|
|
58
63
|
async function download(url) {
|
|
59
64
|
return new Promise((resolve, reject) => {
|
|
@@ -78,13 +83,20 @@ async function installBinary() {
|
|
|
78
83
|
mkdirSync(BIN_DIR, { recursive: true });
|
|
79
84
|
|
|
80
85
|
let stream;
|
|
86
|
+
let downloadSource = "tag";
|
|
81
87
|
try {
|
|
82
88
|
console.log(`📥 Downloading OneCrawl v${VERSION} for ${platformKey}...`);
|
|
83
89
|
stream = await download(RELEASE_URL);
|
|
84
90
|
} catch {
|
|
91
|
+
if (!ALLOW_LATEST_FALLBACK) {
|
|
92
|
+
console.log(`⚠️ Exact binary release v${VERSION} is not available yet.`);
|
|
93
|
+
console.log(` Build from source: cargo build --release -p onecrawl-cli-rs`);
|
|
94
|
+
process.exit(0);
|
|
95
|
+
}
|
|
85
96
|
try {
|
|
86
|
-
console.log(`
|
|
97
|
+
console.log(` Exact release unavailable, trying latest release because ONECRAWL_ALLOW_LATEST_BINARY_FALLBACK=1...`);
|
|
87
98
|
stream = await download(FALLBACK_URL);
|
|
99
|
+
downloadSource = "latest";
|
|
88
100
|
} catch (e) {
|
|
89
101
|
console.log(`⚠️ Could not download binary: ${e.message}`);
|
|
90
102
|
console.log(` Build from source: cargo build --release -p onecrawl-cli-rs`);
|
|
@@ -111,9 +123,17 @@ async function installBinary() {
|
|
|
111
123
|
// Verify binary actually runs
|
|
112
124
|
try {
|
|
113
125
|
const ver = execSync(`"${destPath}" --version`, { encoding: "utf8", timeout: 5000 }).trim();
|
|
126
|
+
if (!ver.includes(VERSION.replace(/-/g, "."))) {
|
|
127
|
+
unlinkSync(destPath);
|
|
128
|
+
throw new Error(
|
|
129
|
+
downloadSource === "latest"
|
|
130
|
+
? `downloaded binary version mismatch (${ver}); refusing to install a different version than ${VERSION}`
|
|
131
|
+
: `downloaded binary version mismatch (${ver})`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
114
134
|
console.log(` Verified: ${ver}`);
|
|
115
|
-
} catch {
|
|
116
|
-
console.log(`⚠️ Binary installed but could not verify execution`);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.log(`⚠️ Binary installed but could not verify execution: ${e.message}`);
|
|
117
137
|
}
|
|
118
138
|
} catch (e) {
|
|
119
139
|
try { unlinkSync(tmpPath); } catch {}
|