@packageninja/enterprise-cli 1.2.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.
- package/README.md +26 -0
- package/bin/package-ninja-ee.js +68 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @packageninja/enterprise-cli
|
|
2
|
+
|
|
3
|
+
Enterprise CLI entry package for Package Ninja.
|
|
4
|
+
|
|
5
|
+
Install globally:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @packageninja/enterprise-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Run:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
package-ninja-ee login
|
|
15
|
+
package-ninja-ee install
|
|
16
|
+
package-ninja-ee test
|
|
17
|
+
package-ninja-ee publish
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or run without global install:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx -y @packageninja/enterprise-cli login
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This package resolves the correct platform binary package for your OS/CPU.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
const { existsSync } = require("node:fs");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
|
|
7
|
+
const PLATFORM_TO_PACKAGE = {
|
|
8
|
+
"win32-x64": "@packageninja/enterprise-cli-win32-x64",
|
|
9
|
+
"win32-arm64": "@packageninja/enterprise-cli-win32-arm64",
|
|
10
|
+
"linux-x64": "@packageninja/enterprise-cli-linux-x64",
|
|
11
|
+
"linux-arm64": "@packageninja/enterprise-cli-linux-arm64",
|
|
12
|
+
"darwin-x64": "@packageninja/enterprise-cli-darwin-x64",
|
|
13
|
+
"darwin-arm64": "@packageninja/enterprise-cli-darwin-arm64"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function fail(message) {
|
|
17
|
+
process.stderr.write(`package-ninja-ee: ${message}\n`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function resolveBinary() {
|
|
22
|
+
const override = (process.env.PACKAGE_NINJA_EE_BIN_PATH || "").trim();
|
|
23
|
+
if (override) {
|
|
24
|
+
if (!existsSync(override)) {
|
|
25
|
+
fail(`override binary path does not exist: ${override}`);
|
|
26
|
+
}
|
|
27
|
+
return override;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
31
|
+
const pkgName = PLATFORM_TO_PACKAGE[platformKey];
|
|
32
|
+
if (!pkgName) {
|
|
33
|
+
fail(`unsupported platform: ${platformKey}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let pkgRoot;
|
|
37
|
+
try {
|
|
38
|
+
pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
fail(`missing platform package (${pkgName}). Reinstall with: npm i -g @packageninja/enterprise-cli`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const binName = process.platform === "win32" ? "package-ninja-ee.exe" : "package-ninja-ee";
|
|
44
|
+
const binaryPath = path.join(pkgRoot, "bin", binName);
|
|
45
|
+
if (!existsSync(binaryPath)) {
|
|
46
|
+
fail(`platform binary not found: ${binaryPath}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return binaryPath;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const binaryPath = resolveBinary();
|
|
53
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
env: process.env
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
child.on("error", (error) => {
|
|
59
|
+
fail(`failed to start binary: ${error.message}`);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
child.on("exit", (code, signal) => {
|
|
63
|
+
if (signal) {
|
|
64
|
+
process.kill(process.pid, signal);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
process.exit(code == null ? 1 : code);
|
|
68
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@packageninja/enterprise-cli",
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "Package Ninja Enterprise CLI launcher with platform-specific binary dependencies.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"package-ninja-ee": "bin/package-ninja-ee.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/package-ninja-ee.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@packageninja/enterprise-cli-win32-x64": "1.2.1",
|
|
14
|
+
"@packageninja/enterprise-cli-win32-arm64": "1.2.1",
|
|
15
|
+
"@packageninja/enterprise-cli-linux-x64": "1.2.1",
|
|
16
|
+
"@packageninja/enterprise-cli-linux-arm64": "1.2.1",
|
|
17
|
+
"@packageninja/enterprise-cli-darwin-x64": "1.2.1",
|
|
18
|
+
"@packageninja/enterprise-cli-darwin-arm64": "1.2.1"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "restricted"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"package-ninja",
|
|
28
|
+
"enterprise",
|
|
29
|
+
"security",
|
|
30
|
+
"cli"
|
|
31
|
+
],
|
|
32
|
+
"license": "UNLICENSED"
|
|
33
|
+
}
|