term-survivors 0.1.2-alpha.1

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/index.js +48 -0
  2. package/package.json +33 -0
package/index.js ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawnSync } = require("child_process");
5
+ const { platform, arch } = process;
6
+
7
+ const PLATFORMS = {
8
+ darwin: {
9
+ arm64: "@term-survivors/darwin-arm64/term-survivors",
10
+ x64: "@term-survivors/darwin-x64/term-survivors",
11
+ },
12
+ linux: {
13
+ x64: "@term-survivors/linux-x64/term-survivors",
14
+ arm64: "@term-survivors/linux-arm64/term-survivors",
15
+ },
16
+ win32: {
17
+ x64: "@term-survivors/win32-x64/term-survivors.exe",
18
+ },
19
+ };
20
+
21
+ const binPath = PLATFORMS?.[platform]?.[arch];
22
+
23
+ if (!binPath) {
24
+ console.error(
25
+ `term-survivors: unsupported platform ${platform}-${arch}.\n` +
26
+ `Supported: darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64`
27
+ );
28
+ process.exit(1);
29
+ }
30
+
31
+ let bin;
32
+ try {
33
+ bin = require.resolve(binPath);
34
+ } catch {
35
+ console.error(
36
+ `term-survivors: platform package for ${platform}-${arch} is not installed.\n` +
37
+ `Try: npm install --include=optional`
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = spawnSync(bin, process.argv.slice(2), { shell: false, stdio: "inherit" });
43
+
44
+ if (result.error) {
45
+ throw result.error;
46
+ }
47
+
48
+ process.exitCode = result.status;
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "term-survivors",
3
+ "version": "0.1.2-alpha.1",
4
+ "description": "A Vampire Survivors-like roguelike shooter that runs in the terminal",
5
+ "keywords": [
6
+ "game",
7
+ "roguelike",
8
+ "terminal",
9
+ "tui",
10
+ "survivors"
11
+ ],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://kimulaco@github.com/kimulaco/term-survivors.git"
16
+ },
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "files": [
21
+ "index.js"
22
+ ],
23
+ "bin": {
24
+ "term-survivors": "index.js"
25
+ },
26
+ "optionalDependencies": {
27
+ "@term-survivors/darwin-arm64": "0.1.2-alpha.1",
28
+ "@term-survivors/darwin-x64": "0.1.2-alpha.1",
29
+ "@term-survivors/linux-x64": "0.1.2-alpha.1",
30
+ "@term-survivors/linux-arm64": "0.1.2-alpha.1",
31
+ "@term-survivors/win32-x64": "0.1.2-alpha.1"
32
+ }
33
+ }