@orggem/mini-pod 0.0.0-stage → 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.
- package/README.md +12 -2
- package/bin/sandbox-cli.js +2 -0
- package/bin/sandboxd.js +2 -0
- package/launcher.js +52 -0
- package/package.json +31 -4
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mini-pod on npm
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
After an npm release is available, install the CLI and daemon with Node.js 18 or later:
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @orggem/mini-pod
|
|
7
|
+
sandbox-cli --help
|
|
8
|
+
sandboxd --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Prebuilt binaries are provided for Windows x64, Linux x64/arm64 (glibc), and macOS x64/arm64. Alpine Linux and other musl-based systems are not supported by these binaries. Do not omit optional dependencies when installing the package.
|
|
12
|
+
|
|
13
|
+
The npm package does not include QEMU or a signed guest runtime bundle. Install or supply those separately, start `sandboxd serve` with a trusted bundle and public key, then connect with `sandbox-cli`. See the [mini-pod README](https://github.com/OrgGem/mini-pod#readme) for configuration and examples.
|
package/bin/sandboxd.js
ADDED
package/launcher.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
|
|
6
|
+
const packages = new Set([
|
|
7
|
+
'win32-x64',
|
|
8
|
+
'linux-x64',
|
|
9
|
+
'linux-arm64',
|
|
10
|
+
'darwin-x64',
|
|
11
|
+
'darwin-arm64',
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
function platformPackage(platform, arch, glibcVersion) {
|
|
15
|
+
const target = `${platform}-${arch}`;
|
|
16
|
+
if (!packages.has(target)) {
|
|
17
|
+
throw new Error(`Unsupported platform: ${target}`);
|
|
18
|
+
}
|
|
19
|
+
if (platform === 'linux' && !glibcVersion) {
|
|
20
|
+
throw new Error('Linux binaries require glibc; musl/Alpine is not supported.');
|
|
21
|
+
}
|
|
22
|
+
return `@orggem/mini-pod-${target}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function run(command) {
|
|
26
|
+
try {
|
|
27
|
+
const glibcVersion = process.platform === 'linux'
|
|
28
|
+
? process.report.getReport().header.glibcVersionRuntime
|
|
29
|
+
: undefined;
|
|
30
|
+
const packageName = platformPackage(process.platform, process.arch, glibcVersion);
|
|
31
|
+
let packageJson;
|
|
32
|
+
try {
|
|
33
|
+
packageJson = require.resolve(`${packageName}/package.json`);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
if (err.code !== 'MODULE_NOT_FOUND') throw err;
|
|
36
|
+
throw new Error(`The ${packageName} binary package is missing. Reinstall with optional dependencies enabled.`);
|
|
37
|
+
}
|
|
38
|
+
const executable = path.join(path.dirname(packageJson), 'bin', command + (process.platform === 'win32' ? '.exe' : ''));
|
|
39
|
+
const result = spawnSync(executable, process.argv.slice(2), { stdio: 'inherit' });
|
|
40
|
+
if (result.error) throw result.error;
|
|
41
|
+
if (result.signal) {
|
|
42
|
+
process.kill(process.pid, result.signal);
|
|
43
|
+
} else {
|
|
44
|
+
process.exitCode = result.status ?? 1;
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error(`${command}: ${err.message}`);
|
|
48
|
+
process.exitCode = 1;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = { platformPackage, run };
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orggem/mini-pod",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line client and daemon for the mini-pod sandbox runtime",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/OrgGem/mini-pod.git",
|
|
9
|
+
"directory": "npm"
|
|
10
|
+
},
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"sandbox-cli": "bin/sandbox-cli.js",
|
|
16
|
+
"sandboxd": "bin/sandboxd.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"launcher.js",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@orggem/mini-pod-win32-x64": "0.1.0",
|
|
25
|
+
"@orggem/mini-pod-linux-x64": "0.1.0",
|
|
26
|
+
"@orggem/mini-pod-linux-arm64": "0.1.0",
|
|
27
|
+
"@orggem/mini-pod-darwin-x64": "0.1.0",
|
|
28
|
+
"@orggem/mini-pod-darwin-arm64": "0.1.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
}
|
|
33
|
+
}
|