@workersio/cli 0.6.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.
Files changed (2) hide show
  1. package/bin/wio +49 -0
  2. package/package.json +24 -0
package/bin/wio ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const { join } = require("path");
5
+
6
+ const PLATFORMS = {
7
+ "darwin-arm64": ["@workersio/cli-darwin-arm64", "wio"],
8
+ "darwin-x64": ["@workersio/cli-darwin-x64", "wio"],
9
+ "linux-x64": ["@workersio/cli-linux-x64", "wio"],
10
+ "linux-arm64": ["@workersio/cli-linux-arm64", "wio"],
11
+ "win32-x64": ["@workersio/cli-win32-x64", "wio.exe"],
12
+ };
13
+
14
+ const key = `${process.platform}-${process.arch}`;
15
+ const entry = PLATFORMS[key];
16
+
17
+ if (!entry) {
18
+ console.error(
19
+ `error: @workersio/cli does not ship a binary for ${key}.\n` +
20
+ "Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64"
21
+ );
22
+ process.exit(1);
23
+ }
24
+
25
+ const [pkg, bin] = entry;
26
+
27
+ let binPath;
28
+ try {
29
+ const pkgJson = require.resolve(join(pkg, "package.json"));
30
+ binPath = join(pkgJson, "..", bin);
31
+ } catch {
32
+ console.error(
33
+ `error: could not find ${pkg}. Try reinstalling:\n` +
34
+ " npm install -g @workersio/cli"
35
+ );
36
+ process.exit(1);
37
+ }
38
+
39
+ const result = spawnSync(binPath, process.argv.slice(2), {
40
+ stdio: "inherit",
41
+ env: process.env,
42
+ });
43
+
44
+ if (result.error) {
45
+ console.error(`error: failed to run wio: ${result.error.message}`);
46
+ process.exit(1);
47
+ }
48
+
49
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@workersio/cli",
3
+ "version": "0.6.0",
4
+ "description": "Workers IO CLI: read your account's bug reports from the terminal",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "wio": "bin/wio"
8
+ },
9
+ "files": [
10
+ "bin"
11
+ ],
12
+ "optionalDependencies": {
13
+ "@workersio/cli-darwin-arm64": "0.6.0",
14
+ "@workersio/cli-darwin-x64": "0.6.0",
15
+ "@workersio/cli-linux-arm64": "0.6.0",
16
+ "@workersio/cli-linux-x64": "0.6.0",
17
+ "@workersio/cli-win32-x64": "0.6.0"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/workersio/formal.git",
22
+ "directory": "packages/wio/npm/cli"
23
+ }
24
+ }