@lpm-registry/cli 0.76.0-nightly.20260826.156.390fd37 → 0.76.5
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 +51 -10
- package/bin/native.js +5 -5
- package/package.json +7 -7
- package/scripts/install-binary.js +34 -7
package/README.md
CHANGED
|
@@ -6,15 +6,46 @@ Fast, secure, all-in-one package manager written in Rust.
|
|
|
6
6
|
npm install -g @lpm-registry/cli --allow-scripts=@lpm-registry/cli
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
This package is the npm gateway for the native LPM CLI. It installs
|
|
10
|
-
|
|
9
|
+
This package is the npm gateway for the native LPM CLI. It installs the
|
|
10
|
+
matching platform package, such as
|
|
11
11
|
`@lpm-registry/cli-darwin-arm64`, `@lpm-registry/cli-linux-x64`, or
|
|
12
|
-
`@lpm-registry/cli-linux-x64-musl`.
|
|
13
|
-
|
|
14
|
-
it where the platform allows that.
|
|
12
|
+
`@lpm-registry/cli-linux-x64-musl`. The `postinstall` script validates the native
|
|
13
|
+
program and connects `lpm` and `lpx` directly to it.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
commands run
|
|
15
|
+
On macOS, the platform package contains a signed `LPM CLI.app`. The direct
|
|
16
|
+
commands run `LPM CLI.app/Contents/MacOS/lpm-rs`. They do not start Node or a
|
|
17
|
+
shell. LPM CLI runs when LPM Vault is not installed or not open.
|
|
18
|
+
|
|
19
|
+
The package keeps a small JavaScript launcher for installs that disable
|
|
20
|
+
scripts. This launcher only finds and starts the native program. It does not
|
|
21
|
+
implement package-manager behavior.
|
|
22
|
+
|
|
23
|
+
## Installer behavior
|
|
24
|
+
|
|
25
|
+
These tools install the Rust client. They are not `lpm self-update` modes.
|
|
26
|
+
|
|
27
|
+
| Installer | Default command behavior | Install script option |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| npm 11 | Direct native command | No extra option |
|
|
30
|
+
| npm 12 | JavaScript launcher | Use `--allow-scripts=@lpm-registry/cli` |
|
|
31
|
+
| Yarn | Direct native command | No extra option |
|
|
32
|
+
| Bun | JavaScript launcher | Use `--trust` |
|
|
33
|
+
| pnpm | JavaScript launcher | Use `--allow-build=@lpm-registry/cli` to validate the native program |
|
|
34
|
+
| Volta | Volta shim, then the native command | No extra option |
|
|
35
|
+
|
|
36
|
+
The JavaScript launcher only starts the Rust program. All LPM functions remain
|
|
37
|
+
available. The launcher adds one process start before the Rust program starts.
|
|
38
|
+
|
|
39
|
+
Use these commands for the native optimization on npm, Bun, or pnpm:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g @lpm-registry/cli --allow-scripts=@lpm-registry/cli
|
|
43
|
+
bun add -g @lpm-registry/cli --trust
|
|
44
|
+
pnpm add -g @lpm-registry/cli --allow-build=@lpm-registry/cli
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
On macOS, pnpm keeps its launcher after it validates the signed app. This
|
|
48
|
+
preserves the links that pnpm manages.
|
|
18
49
|
|
|
19
50
|
Source for this npm package lives in `lpm-dev/rust-client/npm/cli`.
|
|
20
51
|
|
|
@@ -24,12 +55,21 @@ Source for this npm package lives in `lpm-dev/rust-client/npm/cli`.
|
|
|
24
55
|
lpm self-update
|
|
25
56
|
```
|
|
26
57
|
|
|
27
|
-
|
|
58
|
+
`lpm self-update` detects npm, pnpm, Bun, Yarn, and Volta installations. It
|
|
59
|
+
runs the update command for the detected installer.
|
|
60
|
+
|
|
61
|
+
For an npm installation, self-update runs:
|
|
28
62
|
|
|
29
63
|
```bash
|
|
30
64
|
npm install -g @lpm-registry/cli@<version>
|
|
31
65
|
```
|
|
32
66
|
|
|
67
|
+
On macOS, this install keeps the complete signed app bundle. If npm permits the
|
|
68
|
+
installer script, the script restores the direct command links.
|
|
69
|
+
|
|
70
|
+
If the detected installer blocks scripts, the update still completes. The
|
|
71
|
+
JavaScript launcher remains active until you use the applicable trust option.
|
|
72
|
+
|
|
33
73
|
## Troubleshooting
|
|
34
74
|
|
|
35
75
|
If your package manager was configured to omit optional dependencies, reinstall
|
|
@@ -39,8 +79,9 @@ with optional dependencies enabled:
|
|
|
39
79
|
npm install -g @lpm-registry/cli
|
|
40
80
|
```
|
|
41
81
|
|
|
42
|
-
If your npm policy blocks install scripts,
|
|
43
|
-
|
|
82
|
+
If your npm policy blocks install scripts, LPM uses the JavaScript fallback.
|
|
83
|
+
Allow the installer script to validate the native program and create direct
|
|
84
|
+
commands:
|
|
44
85
|
|
|
45
86
|
```bash
|
|
46
87
|
npm install -g @lpm-registry/cli --allow-scripts=@lpm-registry/cli
|
package/bin/native.js
CHANGED
|
@@ -9,13 +9,13 @@ const require = createRequire(import.meta.url);
|
|
|
9
9
|
export const PLATFORMS = Object.freeze({
|
|
10
10
|
"darwin-arm64": {
|
|
11
11
|
pkg: "@lpm-registry/cli-darwin-arm64",
|
|
12
|
-
lpm: "lpm",
|
|
13
|
-
lpx: "
|
|
12
|
+
lpm: "LPM CLI.app/Contents/MacOS/lpm-rs",
|
|
13
|
+
lpx: "LPM CLI.app/Contents/MacOS/lpm-rs",
|
|
14
14
|
},
|
|
15
15
|
"darwin-x64": {
|
|
16
16
|
pkg: "@lpm-registry/cli-darwin-x64",
|
|
17
|
-
lpm: "lpm",
|
|
18
|
-
lpx: "
|
|
17
|
+
lpm: "LPM CLI.app/Contents/MacOS/lpm-rs",
|
|
18
|
+
lpx: "LPM CLI.app/Contents/MacOS/lpm-rs",
|
|
19
19
|
},
|
|
20
20
|
"linux-arm64": {
|
|
21
21
|
pkg: "@lpm-registry/cli-linux-arm64",
|
|
@@ -114,7 +114,7 @@ export function resolveNativeBinary(options = {}) {
|
|
|
114
114
|
return {
|
|
115
115
|
path: binaryPath,
|
|
116
116
|
source: spec.pkg,
|
|
117
|
-
argsPrefix: [],
|
|
117
|
+
argsPrefix: command === "lpx" && spec.lpm === spec.lpx ? ["dlx"] : [],
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lpm-registry/cli",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.5",
|
|
4
4
|
"description": "LPM CLI native binary installer for npm",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"README.md"
|
|
27
27
|
],
|
|
28
28
|
"optionalDependencies": {
|
|
29
|
-
"@lpm-registry/cli-darwin-arm64": "0.76.
|
|
30
|
-
"@lpm-registry/cli-darwin-x64": "0.76.
|
|
31
|
-
"@lpm-registry/cli-linux-arm64": "0.76.
|
|
32
|
-
"@lpm-registry/cli-linux-x64": "0.76.
|
|
33
|
-
"@lpm-registry/cli-linux-x64-musl": "0.76.
|
|
34
|
-
"@lpm-registry/cli-win32-x64": "0.76.
|
|
29
|
+
"@lpm-registry/cli-darwin-arm64": "0.76.5",
|
|
30
|
+
"@lpm-registry/cli-darwin-x64": "0.76.5",
|
|
31
|
+
"@lpm-registry/cli-linux-arm64": "0.76.5",
|
|
32
|
+
"@lpm-registry/cli-linux-x64": "0.76.5",
|
|
33
|
+
"@lpm-registry/cli-linux-x64-musl": "0.76.5",
|
|
34
|
+
"@lpm-registry/cli-win32-x64": "0.76.5"
|
|
35
35
|
},
|
|
36
36
|
"type": "module",
|
|
37
37
|
"engines": {
|
|
@@ -73,6 +73,8 @@ export function installNativeBinaries(options = {}) {
|
|
|
73
73
|
validateTimeoutMs,
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
+
const retainLauncherShims = shouldRetainLauncherShims({ platform, env });
|
|
77
|
+
|
|
76
78
|
const optimized = [];
|
|
77
79
|
for (const command of commands) {
|
|
78
80
|
const native =
|
|
@@ -87,12 +89,14 @@ export function installNativeBinaries(options = {}) {
|
|
|
87
89
|
requireFn,
|
|
88
90
|
});
|
|
89
91
|
const target = optimizedTargetPath(wrapperRoot, platform, command);
|
|
90
|
-
const action =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
const action = retainLauncherShims
|
|
93
|
+
? "launcher"
|
|
94
|
+
: stageOptimizedBinary({
|
|
95
|
+
source: native.path,
|
|
96
|
+
target,
|
|
97
|
+
platform,
|
|
98
|
+
fsModule,
|
|
99
|
+
});
|
|
96
100
|
optimized.push({
|
|
97
101
|
command,
|
|
98
102
|
source: native.path,
|
|
@@ -101,10 +105,22 @@ export function installNativeBinaries(options = {}) {
|
|
|
101
105
|
});
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
if (retainLauncherShims) {
|
|
109
|
+
logFn(
|
|
110
|
+
`[lpm] Validated native binary from ${spec.pkg}; retaining pnpm-compatible launchers.`,
|
|
111
|
+
);
|
|
112
|
+
} else {
|
|
113
|
+
logFn(`[lpm] Installed native binary from ${spec.pkg}`);
|
|
114
|
+
}
|
|
105
115
|
return { status: "installed", platform: key, package: spec.pkg, optimized };
|
|
106
116
|
}
|
|
107
117
|
|
|
118
|
+
export function shouldRetainLauncherShims({ platform, env = process.env } = {}) {
|
|
119
|
+
if (platform !== "darwin") return false;
|
|
120
|
+
const userAgent = env.npm_config_user_agent ?? env.NPM_CONFIG_USER_AGENT ?? "";
|
|
121
|
+
return /^pnpm\//i.test(userAgent.trim());
|
|
122
|
+
}
|
|
123
|
+
|
|
108
124
|
export function isSudoTransition({ geteuid, env = process.env } = {}) {
|
|
109
125
|
if (typeof geteuid !== "function" || geteuid() !== 0) {
|
|
110
126
|
return false;
|
|
@@ -178,6 +194,10 @@ export function validateNativeBinary(
|
|
|
178
194
|
|
|
179
195
|
export function stageOptimizedBinary({ source, target, platform, fsModule = fs }) {
|
|
180
196
|
fsModule.mkdirSync(path.dirname(target), { recursive: true });
|
|
197
|
+
if (platform === "darwin") {
|
|
198
|
+
atomicSymlink(source, target, fsModule);
|
|
199
|
+
return "symlink";
|
|
200
|
+
}
|
|
181
201
|
if (platform === "win32") {
|
|
182
202
|
atomicCopy(source, target, fsModule);
|
|
183
203
|
return "copy";
|
|
@@ -192,6 +212,13 @@ export function stageOptimizedBinary({ source, target, platform, fsModule = fs }
|
|
|
192
212
|
}
|
|
193
213
|
}
|
|
194
214
|
|
|
215
|
+
function atomicSymlink(source, target, fsModule) {
|
|
216
|
+
replaceWithTemp(target, fsModule, temp => {
|
|
217
|
+
const relativeSource = path.relative(path.dirname(target), source);
|
|
218
|
+
fsModule.symlinkSync(relativeSource, temp, "file");
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
195
222
|
function optimizedTargetPath(wrapperRoot, platform, command) {
|
|
196
223
|
const filename = platform === "win32" ? `${command}.exe` : command;
|
|
197
224
|
return path.join(wrapperRoot, "bin", filename);
|