@gyeonghokim/pokemon-cli 0.1.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.js +35 -0
  2. package/package.json +32 -0
package/bin.js ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require('node:child_process');
3
+ const path = require('node:path');
4
+
5
+ // process.platform/arch -> published platform-package suffix (matches goreleaser GOOS/GOARCH)
6
+ const PLATFORMS = {
7
+ 'darwin-arm64': '@gyeonghokim/pokemon-cli-darwin-arm64',
8
+ 'darwin-x64': '@gyeonghokim/pokemon-cli-darwin-amd64',
9
+ 'linux-x64': '@gyeonghokim/pokemon-cli-linux-amd64',
10
+ 'linux-arm64': '@gyeonghokim/pokemon-cli-linux-arm64',
11
+ 'win32-x64': '@gyeonghokim/pokemon-cli-windows-amd64',
12
+ };
13
+
14
+ const key = `${process.platform}-${process.arch}`;
15
+ const pkgName = PLATFORMS[key];
16
+
17
+ if (!pkgName) {
18
+ console.error(`pokemon-cli: unsupported platform ${key}`);
19
+ process.exit(1);
20
+ }
21
+
22
+ let binPath;
23
+ try {
24
+ const binaryName = process.platform === 'win32' ? 'pokemon-cli.exe' : 'pokemon-cli';
25
+ binPath = path.join(path.dirname(require.resolve(`${pkgName}/package.json`)), binaryName);
26
+ } catch {
27
+ console.error(
28
+ `pokemon-cli: optional dependency "${pkgName}" is not installed. ` +
29
+ 'This usually means npm skipped it for your platform — try reinstalling.',
30
+ );
31
+ process.exit(1);
32
+ }
33
+
34
+ const result = spawnSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
35
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@gyeonghokim/pokemon-cli",
3
+ "version": "0.1.0",
4
+ "description": "Pikachu running around your terminal",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/GyeongHoKim/pokemon-cli.git"
9
+ },
10
+ "bin": {
11
+ "pokemon-cli": "bin.js"
12
+ },
13
+ "files": [
14
+ "bin.js"
15
+ ],
16
+ "os": [
17
+ "darwin",
18
+ "linux",
19
+ "win32"
20
+ ],
21
+ "cpu": [
22
+ "x64",
23
+ "arm64"
24
+ ],
25
+ "optionalDependencies": {
26
+ "@gyeonghokim/pokemon-cli-darwin-arm64": "0.1.0",
27
+ "@gyeonghokim/pokemon-cli-darwin-amd64": "0.1.0",
28
+ "@gyeonghokim/pokemon-cli-linux-amd64": "0.1.0",
29
+ "@gyeonghokim/pokemon-cli-linux-arm64": "0.1.0",
30
+ "@gyeonghokim/pokemon-cli-windows-amd64": "0.1.0"
31
+ }
32
+ }