@cloudcent/cli 0.0.0-test.4 → 0.0.0-test.5
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/cloudcent.js +47 -0
- package/package.json +7 -7
package/bin/cloudcent.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
"darwin-arm64": "@cloudcent/cli-darwin-arm64",
|
|
9
|
+
"darwin-x64": "@cloudcent/cli-darwin-x64",
|
|
10
|
+
"linux-arm64": "@cloudcent/cli-linux-arm64",
|
|
11
|
+
"linux-x64": "@cloudcent/cli-linux-x64",
|
|
12
|
+
"win32-arm64": "@cloudcent/cli-win32-arm64",
|
|
13
|
+
"win32-x64": "@cloudcent/cli-win32-x64",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const platform = `${os.platform()}-${os.arch()}`;
|
|
17
|
+
const pkg = PLATFORMS[platform];
|
|
18
|
+
|
|
19
|
+
if (!pkg) {
|
|
20
|
+
console.error(`Unsupported platform: ${platform}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const binName = os.platform() === "win32" ? "cloudcent.exe" : "cloudcent";
|
|
25
|
+
|
|
26
|
+
let binPath;
|
|
27
|
+
try {
|
|
28
|
+
binPath = path.join(
|
|
29
|
+
path.dirname(require.resolve(`${pkg}/package.json`)),
|
|
30
|
+
"bin",
|
|
31
|
+
binName
|
|
32
|
+
);
|
|
33
|
+
} catch {
|
|
34
|
+
console.error(
|
|
35
|
+
`Could not find binary package ${pkg}.
|
|
36
|
+
` +
|
|
37
|
+
`Try reinstalling: npm install -g @cloudcent/cli`
|
|
38
|
+
);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const result = spawnSync(binPath, process.argv.slice(2), {
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
env: process.env,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcent/cli",
|
|
3
|
-
"version": "0.0.0-test.
|
|
3
|
+
"version": "0.0.0-test.5",
|
|
4
4
|
"description": "Cloud cost estimation CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"cloudcent": "bin/cloudcent.js"
|
|
15
15
|
},
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"@cloudcent/cli-darwin-arm64": "0.0.0-test.
|
|
18
|
-
"@cloudcent/cli-darwin-x64": "0.0.0-test.
|
|
19
|
-
"@cloudcent/cli-linux-arm64": "0.0.0-test.
|
|
20
|
-
"@cloudcent/cli-linux-x64": "0.0.0-test.
|
|
21
|
-
"@cloudcent/cli-win32-arm64": "0.0.0-test.
|
|
22
|
-
"@cloudcent/cli-win32-x64": "0.0.0-test.
|
|
17
|
+
"@cloudcent/cli-darwin-arm64": "0.0.0-test.5",
|
|
18
|
+
"@cloudcent/cli-darwin-x64": "0.0.0-test.5",
|
|
19
|
+
"@cloudcent/cli-linux-arm64": "0.0.0-test.5",
|
|
20
|
+
"@cloudcent/cli-linux-x64": "0.0.0-test.5",
|
|
21
|
+
"@cloudcent/cli-win32-arm64": "0.0.0-test.5",
|
|
22
|
+
"@cloudcent/cli-win32-x64": "0.0.0-test.5"
|
|
23
23
|
}
|
|
24
24
|
}
|