@remcp/remcp 0.2.91 → 0.2.93
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/package.json +1 -1
- package/src/cli/service.mjs +22 -7
package/package.json
CHANGED
package/src/cli/service.mjs
CHANGED
|
@@ -25,8 +25,20 @@ export function globalCliPath() {
|
|
|
25
25
|
return servicePlatform() === 'win32' ? path.join(prefix, 'remcp.cmd') : path.join(prefix, 'bin', 'remcp');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
function npmGlobalInstallArgs(specs, { preferOnline = false } = {}) {
|
|
29
|
+
return [
|
|
30
|
+
'install',
|
|
31
|
+
'--global',
|
|
32
|
+
...specs,
|
|
33
|
+
...(preferOnline ? ['--prefer-online'] : []),
|
|
34
|
+
'--no-audit',
|
|
35
|
+
'--no-fund',
|
|
36
|
+
'--loglevel=error',
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
export function npmGlobalInstall(...specs) {
|
|
29
|
-
run(npm.command, [...npm.args,
|
|
41
|
+
run(npm.command, [...npm.args, ...npmGlobalInstallArgs(specs)]);
|
|
30
42
|
}
|
|
31
43
|
|
|
32
44
|
function pathEntryExists(file) {
|
|
@@ -47,7 +59,7 @@ function globalPackagePath(prefix, packageName) {
|
|
|
47
59
|
return path.join(prefix, 'lib', 'node_modules', ...parts);
|
|
48
60
|
}
|
|
49
61
|
|
|
50
|
-
function transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs }) {
|
|
62
|
+
function transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs, preferOnline = false }) {
|
|
51
63
|
prefix = String(prefix || '').trim();
|
|
52
64
|
if (!path.isAbsolute(prefix)) throw new Error(`npm global prefix must be absolute for a macOS update: ${prefix || '(empty)'}`);
|
|
53
65
|
const backupRoot = path.join(prefix, `.remcp-update-backup-${process.pid}-${Date.now()}`);
|
|
@@ -85,7 +97,7 @@ function transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs }
|
|
|
85
97
|
uniqueNames.forEach((name, index) => moveAside(globalPackagePath(prefix, name), `package-${index}`));
|
|
86
98
|
if (uniqueNames.includes(PACKAGE_NAME)) moveAside(path.join(prefix, 'bin', 'remcp'), 'bin-remcp');
|
|
87
99
|
|
|
88
|
-
run(resolved.command, [...resolved.args,
|
|
100
|
+
run(resolved.command, [...resolved.args, ...npmGlobalInstallArgs(specs, { preferOnline })]);
|
|
89
101
|
} catch (error) {
|
|
90
102
|
restore(error);
|
|
91
103
|
throw error;
|
|
@@ -98,23 +110,26 @@ function transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs }
|
|
|
98
110
|
}
|
|
99
111
|
}
|
|
100
112
|
|
|
113
|
+
// Release updates use exact versions that may have been published only moments ago. npm can keep a
|
|
114
|
+
// cached pre-publication packument long enough to answer ETARGET after the registry already serves the
|
|
115
|
+
// version, so updates revalidate metadata while retaining npm's cache for package bytes.
|
|
101
116
|
export function npmGlobalUpdate(packageNames, ...specs) {
|
|
102
117
|
if (servicePlatform() !== 'darwin') {
|
|
103
|
-
|
|
118
|
+
run(npm.command, [...npm.args, ...npmGlobalInstallArgs(specs, { preferOnline:true })]);
|
|
104
119
|
return;
|
|
105
120
|
}
|
|
106
121
|
const prefix = globalPrefix();
|
|
107
|
-
transactionalMacGlobalInstall({ resolved:npm, prefix, packageNames, specs });
|
|
122
|
+
transactionalMacGlobalInstall({ resolved:npm, prefix, packageNames, specs, preferOnline:true });
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
export function npmGlobalUpdateForNode(nodePath, packageNames, ...specs) {
|
|
111
126
|
const resolved = resolveNpm({ nodePath, home, platform:servicePlatform() });
|
|
112
127
|
if (servicePlatform() !== 'darwin') {
|
|
113
|
-
run(resolved.command, [...resolved.args,
|
|
128
|
+
run(resolved.command, [...resolved.args, ...npmGlobalInstallArgs(specs, { preferOnline:true })]);
|
|
114
129
|
return;
|
|
115
130
|
}
|
|
116
131
|
const prefix = output(resolved.command, [...resolved.args, 'prefix', '--global']);
|
|
117
|
-
transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs });
|
|
132
|
+
transactionalMacGlobalInstall({ resolved, prefix, packageNames, specs, preferOnline:true });
|
|
118
133
|
}
|
|
119
134
|
|
|
120
135
|
export function quoteSystemd(value) {
|