@lpm-registry/cli 0.67.0 → 0.69.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 +9 -4
- package/bin/native.js +24 -2
- package/package.json +7 -6
- package/scripts/install-binary.js +5 -1
package/README.md
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Fast, secure, all-in-one package manager written in Rust.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install -g @lpm-registry/cli
|
|
6
|
+
npm install -g @lpm-registry/cli --allow-scripts=@lpm-registry/cli
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
This package is the npm gateway for the native LPM CLI. It installs a small
|
|
10
10
|
JavaScript launcher plus the matching platform package, such as
|
|
11
|
-
`@lpm-registry/cli-darwin-arm64
|
|
11
|
+
`@lpm-registry/cli-darwin-arm64`, `@lpm-registry/cli-linux-x64`, or
|
|
12
|
+
`@lpm-registry/cli-linux-x64-musl`. A tiny
|
|
12
13
|
`postinstall` verifier checks the native binary and wires the global command to
|
|
13
14
|
it where the platform allows that.
|
|
14
15
|
|
|
@@ -38,8 +39,12 @@ with optional dependencies enabled:
|
|
|
38
39
|
npm install -g @lpm-registry/cli
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
If install scripts
|
|
42
|
-
can validate the native binary during installation
|
|
42
|
+
If your npm policy blocks install scripts, allow LPM's installer script so npm
|
|
43
|
+
can validate the native binary during installation:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install -g @lpm-registry/cli --allow-scripts=@lpm-registry/cli
|
|
47
|
+
```
|
|
43
48
|
|
|
44
49
|
Other install methods are documented at
|
|
45
50
|
[github.com/lpm-dev/rust-client](https://github.com/lpm-dev/rust-client).
|
package/bin/native.js
CHANGED
|
@@ -27,6 +27,11 @@ export const PLATFORMS = Object.freeze({
|
|
|
27
27
|
lpm: "lpm",
|
|
28
28
|
lpx: "lpx",
|
|
29
29
|
},
|
|
30
|
+
"linux-x64-musl": {
|
|
31
|
+
pkg: "@lpm-registry/cli-linux-x64-musl",
|
|
32
|
+
lpm: "lpm",
|
|
33
|
+
lpx: "lpx",
|
|
34
|
+
},
|
|
30
35
|
"win32-x64": {
|
|
31
36
|
pkg: "@lpm-registry/cli-win32-x64",
|
|
32
37
|
lpm: "lpm.exe",
|
|
@@ -34,15 +39,32 @@ export const PLATFORMS = Object.freeze({
|
|
|
34
39
|
},
|
|
35
40
|
});
|
|
36
41
|
|
|
37
|
-
export function platformKey(
|
|
42
|
+
export function platformKey(
|
|
43
|
+
platform = process.platform,
|
|
44
|
+
arch = os.arch(),
|
|
45
|
+
libc,
|
|
46
|
+
) {
|
|
47
|
+
if (platform === "linux" && libc === "musl") {
|
|
48
|
+
return `linux-${arch}-musl`;
|
|
49
|
+
}
|
|
38
50
|
return `${platform}-${arch}`;
|
|
39
51
|
}
|
|
40
52
|
|
|
53
|
+
export function detectLinuxLibc(
|
|
54
|
+
report = process.platform === "linux" ? process.report?.getReport?.() : undefined,
|
|
55
|
+
) {
|
|
56
|
+
if (!report) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return report.header?.glibcVersionRuntime ? "glibc" : "musl";
|
|
60
|
+
}
|
|
61
|
+
|
|
41
62
|
export function resolveNativeBinary(options = {}) {
|
|
42
63
|
const command = options.command ?? "lpm";
|
|
43
64
|
const env = options.env ?? process.env;
|
|
44
65
|
const platform = options.platform ?? process.platform;
|
|
45
66
|
const arch = options.arch ?? os.arch();
|
|
67
|
+
const libc = options.libc ?? detectLinuxLibc();
|
|
46
68
|
const requireFn = options.requireFn ?? require;
|
|
47
69
|
|
|
48
70
|
const override = env.LPM_BINARY_PATH;
|
|
@@ -54,7 +76,7 @@ export function resolveNativeBinary(options = {}) {
|
|
|
54
76
|
};
|
|
55
77
|
}
|
|
56
78
|
|
|
57
|
-
const key = platformKey(platform, arch);
|
|
79
|
+
const key = platformKey(platform, arch, libc);
|
|
58
80
|
const spec = PLATFORMS[key];
|
|
59
81
|
if (!spec) {
|
|
60
82
|
throw new LpmWrapperError(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lpm-registry/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.69.0",
|
|
4
4
|
"description": "LPM CLI native binary installer for npm",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@lpm-registry/cli-darwin-arm64": "0.
|
|
30
|
-
"@lpm-registry/cli-darwin-x64": "0.
|
|
31
|
-
"@lpm-registry/cli-linux-arm64": "0.
|
|
32
|
-
"@lpm-registry/cli-linux-x64": "0.
|
|
33
|
-
"@lpm-registry/cli-
|
|
29
|
+
"@lpm-registry/cli-darwin-arm64": "0.69.0",
|
|
30
|
+
"@lpm-registry/cli-darwin-x64": "0.69.0",
|
|
31
|
+
"@lpm-registry/cli-linux-arm64": "0.69.0",
|
|
32
|
+
"@lpm-registry/cli-linux-x64": "0.69.0",
|
|
33
|
+
"@lpm-registry/cli-linux-x64-musl": "0.69.0",
|
|
34
|
+
"@lpm-registry/cli-win32-x64": "0.69.0"
|
|
34
35
|
},
|
|
35
36
|
"type": "module",
|
|
36
37
|
"engines": {
|
|
@@ -7,6 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
import {
|
|
8
8
|
LpmWrapperError,
|
|
9
9
|
PLATFORMS,
|
|
10
|
+
detectLinuxLibc,
|
|
10
11
|
platformKey,
|
|
11
12
|
resolveNativeBinary,
|
|
12
13
|
} from "../bin/native.js";
|
|
@@ -21,6 +22,7 @@ export function installNativeBinaries(options = {}) {
|
|
|
21
22
|
const wrapperRoot = options.wrapperRoot ?? defaultWrapperRoot;
|
|
22
23
|
const platform = options.platform ?? process.platform;
|
|
23
24
|
const arch = options.arch ?? os.arch();
|
|
25
|
+
const libc = options.libc ?? detectLinuxLibc();
|
|
24
26
|
const env = options.env ?? process.env;
|
|
25
27
|
const requireFn = options.requireFn ?? require;
|
|
26
28
|
const fsModule = options.fsModule ?? fs;
|
|
@@ -29,7 +31,7 @@ export function installNativeBinaries(options = {}) {
|
|
|
29
31
|
const validateTimeoutMs =
|
|
30
32
|
options.validateTimeoutMs ?? defaultValidateTimeoutMs;
|
|
31
33
|
|
|
32
|
-
const key = platformKey(platform, arch);
|
|
34
|
+
const key = platformKey(platform, arch, libc);
|
|
33
35
|
const spec = PLATFORMS[key];
|
|
34
36
|
if (!spec) {
|
|
35
37
|
logFn(
|
|
@@ -43,6 +45,7 @@ export function installNativeBinaries(options = {}) {
|
|
|
43
45
|
command: "lpm",
|
|
44
46
|
platform,
|
|
45
47
|
arch,
|
|
48
|
+
libc,
|
|
46
49
|
env,
|
|
47
50
|
requireFn,
|
|
48
51
|
});
|
|
@@ -63,6 +66,7 @@ export function installNativeBinaries(options = {}) {
|
|
|
63
66
|
command,
|
|
64
67
|
platform,
|
|
65
68
|
arch,
|
|
69
|
+
libc,
|
|
66
70
|
env,
|
|
67
71
|
requireFn,
|
|
68
72
|
});
|