@null.channel/game 0.0.0-stage → 0.1.15

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/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # Temporary Holding Version
1
+ # null.channel
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The official terminal game launcher for null.channel.
4
+
5
+ ```sh
6
+ npm install -g '@null.channel/game'
7
+ null.channel # null-channel on Windows
8
+ ```
9
+
10
+ On macOS and Linux, `null.channel` is also available as an alias, matching the curl installer. Use `null-channel` on Windows.
11
+
12
+ Or run directly:
13
+
14
+ ```sh
15
+ npx '@null.channel/game'
16
+ bunx --bun '@null.channel/game'
17
+ ```
18
+
19
+ The npm command requires Node.js 22.14 or newer. `bunx --bun` uses Bun instead, so Node.js is not required for that command. Use Bun 1.4.4 or newer.
20
+
21
+ The package installs the native launcher for your operating system and CPU as an optional dependency. Keep optional dependencies enabled. macOS, Windows, and Linux support x64 and ARM64; Linux supports glibc and musl. There are no installation scripts or compilation steps.
22
+
23
+ The launcher downloads and verifies signed game updates when it starts. The package manager owns launcher updates. Pinning the npm package version pins the launcher, not the game. Game data stays in your user data directory when you uninstall the package.
24
+
25
+ ```sh
26
+ npm update -g '@null.channel/game'
27
+ npm uninstall -g '@null.channel/game'
28
+ ```
29
+
30
+ Run `null.channel --version` to check the launcher version. Play requires an interactive terminal and internet access. See https://null.channel for the browser game and other installation methods.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from 'node:fs';
3
+ import { resolveLauncher, runLauncher, selectPlatform } from './runtime.mjs';
4
+
5
+ try {
6
+ const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
7
+ const platforms = JSON.parse(readFileSync(new URL('../platforms.json', import.meta.url), 'utf8'));
8
+ const executable = resolveLauncher(selectPlatform(platforms), version);
9
+ process.exitCode = await runLauncher(executable, process.argv.slice(2));
10
+ } catch (error) {
11
+ const message =
12
+ error instanceof Error
13
+ ? error.message.replace(/[\p{Cc}\p{Cf}]/gu, '').slice(0, 500)
14
+ : 'Reinstall @null.channel/game.';
15
+ process.stderr.write(`Unable to start null.channel. ${message}\n`);
16
+ process.exitCode = 1;
17
+ }
@@ -0,0 +1,55 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFileSync } from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ import { constants } from 'node:os';
5
+ import { dirname, resolve } from 'node:path';
6
+
7
+ export function selectPlatform(platforms, os = process.platform, arch = process.arch, report = process.report) {
8
+ let libc;
9
+ if (os === 'linux') {
10
+ const diagnostic = report?.getReport();
11
+ if (!diagnostic || typeof diagnostic !== 'object' || typeof diagnostic.header !== 'object' || !diagnostic.header)
12
+ throw new Error('Unable to identify the Linux C runtime.');
13
+ libc = diagnostic.header.glibcVersionRuntime ? 'glibc' : 'musl';
14
+ }
15
+ const platform = platforms.find((entry) => entry.os === os && entry.arch === arch && entry.libc === libc);
16
+ if (!platform) throw new Error(`Unsupported platform: ${os}/${arch}${libc ? `/${libc}` : ''}.`);
17
+ return platform;
18
+ }
19
+
20
+ export function resolveLauncher(platform, version, require = createRequire(import.meta.url)) {
21
+ let manifestPath;
22
+ try {
23
+ manifestPath = require.resolve(`${platform.packageName}/package.json`);
24
+ } catch {
25
+ throw new Error(
26
+ `Missing ${platform.packageName}. Reinstall @null.channel/game with optional dependencies enabled.`
27
+ );
28
+ }
29
+ const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
30
+ if (manifest.name !== platform.packageName || manifest.version !== version)
31
+ throw new Error('Launcher package version mismatch. Reinstall @null.channel/game.');
32
+ return resolve(dirname(manifestPath), platform.binary);
33
+ }
34
+
35
+ export async function runLauncher(executable, args) {
36
+ return new Promise((resolve, reject) => {
37
+ const child = spawn(executable, args, { stdio: 'inherit', shell: false });
38
+ const interrupt = () => child.kill('SIGINT');
39
+ const terminate = () => child.kill('SIGTERM');
40
+ const cleanup = () => {
41
+ process.off('SIGINT', interrupt);
42
+ process.off('SIGTERM', terminate);
43
+ };
44
+ process.on('SIGINT', interrupt);
45
+ process.on('SIGTERM', terminate);
46
+ child.once('error', (error) => {
47
+ cleanup();
48
+ reject(error);
49
+ });
50
+ child.once('close', (code, signal) => {
51
+ cleanup();
52
+ resolve(code ?? (signal ? 128 + constants.signals[signal] : 1));
53
+ });
54
+ });
55
+ }
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
+ "version": "0.1.15",
3
+ "description": "The official null.channel terminal game launcher",
4
+ "homepage": "https://null.channel",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/alexanderbh/null.channel.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "registry": "https://registry.npmjs.org"
13
+ },
2
14
  "name": "@null.channel/game",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
15
+ "bin": {
16
+ "null-channel": "bin/null-channel.mjs",
17
+ "null.channel": "bin/null-channel.mjs"
18
+ },
19
+ "engines": {
20
+ "node": ">=22.14.0"
21
+ },
22
+ "files": [
23
+ "bin/null-channel.mjs",
24
+ "bin/runtime.mjs",
25
+ "platforms.json"
26
+ ],
27
+ "optionalDependencies": {
28
+ "@null.channel/game-linux-x64": "0.1.15",
29
+ "@null.channel/game-linux-arm64": "0.1.15",
30
+ "@null.channel/game-linux-x64-musl": "0.1.15",
31
+ "@null.channel/game-linux-arm64-musl": "0.1.15",
32
+ "@null.channel/game-darwin-x64": "0.1.15",
33
+ "@null.channel/game-darwin-arm64": "0.1.15",
34
+ "@null.channel/game-windows-x64": "0.1.15",
35
+ "@null.channel/game-windows-arm64": "0.1.15"
36
+ }
37
+ }
package/platforms.json ADDED
@@ -0,0 +1,62 @@
1
+ [
2
+ {
3
+ "id": "linux-x64",
4
+ "os": "linux",
5
+ "arch": "x64",
6
+ "libc": "glibc",
7
+ "packageName": "@null.channel/game-linux-x64",
8
+ "binary": "bin/launcher"
9
+ },
10
+ {
11
+ "id": "linux-arm64",
12
+ "os": "linux",
13
+ "arch": "arm64",
14
+ "libc": "glibc",
15
+ "packageName": "@null.channel/game-linux-arm64",
16
+ "binary": "bin/launcher"
17
+ },
18
+ {
19
+ "id": "linux-x64-musl",
20
+ "os": "linux",
21
+ "arch": "x64",
22
+ "libc": "musl",
23
+ "packageName": "@null.channel/game-linux-x64-musl",
24
+ "binary": "bin/launcher"
25
+ },
26
+ {
27
+ "id": "linux-arm64-musl",
28
+ "os": "linux",
29
+ "arch": "arm64",
30
+ "libc": "musl",
31
+ "packageName": "@null.channel/game-linux-arm64-musl",
32
+ "binary": "bin/launcher"
33
+ },
34
+ {
35
+ "id": "darwin-x64",
36
+ "os": "darwin",
37
+ "arch": "x64",
38
+ "packageName": "@null.channel/game-darwin-x64",
39
+ "binary": "bin/launcher"
40
+ },
41
+ {
42
+ "id": "darwin-arm64",
43
+ "os": "darwin",
44
+ "arch": "arm64",
45
+ "packageName": "@null.channel/game-darwin-arm64",
46
+ "binary": "bin/launcher"
47
+ },
48
+ {
49
+ "id": "windows-x64",
50
+ "os": "win32",
51
+ "arch": "x64",
52
+ "packageName": "@null.channel/game-windows-x64",
53
+ "binary": "bin/launcher.exe"
54
+ },
55
+ {
56
+ "id": "windows-arm64",
57
+ "os": "win32",
58
+ "arch": "arm64",
59
+ "packageName": "@null.channel/game-windows-arm64",
60
+ "binary": "bin/launcher.exe"
61
+ }
62
+ ]