@usedada/cli 0.0.0
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/dada +3 -0
- package/install.js +41 -0
- package/package.json +14 -0
package/bin/dada
ADDED
package/install.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const os = require("os");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const PLATFORMS = {
|
|
6
|
+
"darwin-arm64": "@usedada/cli-darwin-arm64",
|
|
7
|
+
"darwin-x64": "@usedada/cli-darwin-x64",
|
|
8
|
+
"linux-arm64": "@usedada/cli-linux-arm64",
|
|
9
|
+
"linux-x64": "@usedada/cli-linux-x64",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const platform = os.platform();
|
|
13
|
+
const arch = os.arch();
|
|
14
|
+
const key = `${platform}-${arch}`;
|
|
15
|
+
const pkg = PLATFORMS[key];
|
|
16
|
+
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
// Unsupported platform — the JS fallback in bin/dada will handle it.
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let pkgDir;
|
|
23
|
+
try {
|
|
24
|
+
const resolved = require.resolve(`${pkg}/package.json`);
|
|
25
|
+
pkgDir = path.dirname(resolved);
|
|
26
|
+
} catch {
|
|
27
|
+
console.error(`dada: platform package ${pkg} not installed. Try: npm install`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const src = path.join(pkgDir, "dada");
|
|
32
|
+
const dst = path.join(__dirname, "bin", "dada");
|
|
33
|
+
|
|
34
|
+
if (!fs.existsSync(src)) {
|
|
35
|
+
console.error(`dada: binary not found in ${pkg}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
40
|
+
fs.copyFileSync(src, dst);
|
|
41
|
+
fs.chmodSync(dst, 0o755);
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@usedada/cli",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "CLI for dada — the agent-native data layer.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"bin": { "dada": "bin/dada" },
|
|
7
|
+
"scripts": { "postinstall": "node install.js" },
|
|
8
|
+
"optionalDependencies": {
|
|
9
|
+
"@usedada/cli-darwin-arm64": "0.0.0",
|
|
10
|
+
"@usedada/cli-darwin-x64": "0.0.0",
|
|
11
|
+
"@usedada/cli-linux-arm64": "0.0.0",
|
|
12
|
+
"@usedada/cli-linux-x64": "0.0.0"
|
|
13
|
+
}
|
|
14
|
+
}
|