@kosli/cli 2.13.1-SNAPSHOT-b45c7e62
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/install.js +54 -0
- package/package.json +41 -0
package/install.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Postinstall script: validates that the platform binary was installed correctly.
|
|
4
|
+
// Runs after `npm install @kosli/cli`.
|
|
5
|
+
|
|
6
|
+
const { execFileSync } = require("child_process");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
|
|
10
|
+
const SUPPORTED = {
|
|
11
|
+
linux: { x64: true, arm64: true, arm: true },
|
|
12
|
+
darwin: { x64: true, arm64: true },
|
|
13
|
+
win32: { x64: true, arm64: true },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const platform = process.platform;
|
|
17
|
+
const arch = process.arch;
|
|
18
|
+
|
|
19
|
+
if (!SUPPORTED[platform] || !SUPPORTED[platform][arch]) {
|
|
20
|
+
// Not a supported platform — exit cleanly so npm install doesn't fail.
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const packageName = `@kosli/cli-${platform}-${arch}`;
|
|
25
|
+
|
|
26
|
+
let binaryPath;
|
|
27
|
+
try {
|
|
28
|
+
const packageDir = path.dirname(
|
|
29
|
+
require.resolve(`${packageName}/package.json`)
|
|
30
|
+
);
|
|
31
|
+
const binaryName = platform === "win32" ? "kosli.exe" : "kosli";
|
|
32
|
+
binaryPath = path.join(packageDir, "bin", binaryName);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Optional dependency was skipped (e.g. --no-optional). Warn but don't fail.
|
|
35
|
+
process.stderr.write(
|
|
36
|
+
`[kosli] Warning: ${packageName} is not installed.\n` +
|
|
37
|
+
`[kosli] The kosli binary will not be available.\n` +
|
|
38
|
+
`[kosli] Re-run without --no-optional to fix this.\n`
|
|
39
|
+
);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!fs.existsSync(binaryPath)) {
|
|
44
|
+
process.stderr.write(`[kosli] Warning: binary not found at ${binaryPath}\n`);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
execFileSync(binaryPath, ["version"], { stdio: "ignore" });
|
|
50
|
+
} catch (e) {
|
|
51
|
+
process.stderr.write(
|
|
52
|
+
`[kosli] Warning: binary validation failed: ${e.message}\n`
|
|
53
|
+
);
|
|
54
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kosli/cli",
|
|
3
|
+
"version": "2.13.1-SNAPSHOT-b45c7e62",
|
|
4
|
+
"description": "CLI client for reporting compliance events to https://kosli.com",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Kosli Inc. <hello@kosli.com>",
|
|
7
|
+
"homepage": "https://kosli.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kosli-dev/cli.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/kosli-dev/cli/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"cli",
|
|
17
|
+
"kosli",
|
|
18
|
+
"compliance",
|
|
19
|
+
"supply-chain",
|
|
20
|
+
"devops"
|
|
21
|
+
],
|
|
22
|
+
"files": [
|
|
23
|
+
"install.js"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"postinstall": "node install.js"
|
|
27
|
+
},
|
|
28
|
+
"optionalDependencies": {
|
|
29
|
+
"@kosli/cli-darwin-arm64": "2.13.1-SNAPSHOT-b45c7e62",
|
|
30
|
+
"@kosli/cli-darwin-x64": "2.13.1-SNAPSHOT-b45c7e62",
|
|
31
|
+
"@kosli/cli-linux-arm": "2.13.1-SNAPSHOT-b45c7e62",
|
|
32
|
+
"@kosli/cli-linux-arm64": "2.13.1-SNAPSHOT-b45c7e62",
|
|
33
|
+
"@kosli/cli-linux-x64": "2.13.1-SNAPSHOT-b45c7e62",
|
|
34
|
+
"@kosli/cli-win32-arm64": "2.13.1-SNAPSHOT-b45c7e62",
|
|
35
|
+
"@kosli/cli-win32-x64": "2.13.1-SNAPSHOT-b45c7e62"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"registry": "https://registry.npmjs.org",
|
|
39
|
+
"access": "public"
|
|
40
|
+
}
|
|
41
|
+
}
|