@command-center/command-center 0.7.5-rc0 → 0.8.0-rc1

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.
@@ -116,6 +116,21 @@ function resolveBinaryInPackage(packageName, binaryName) {
116
116
  return existsSync(binaryPath) ? binaryPath : null;
117
117
  }
118
118
 
119
+ // Resolves a binary from the global npm prefix. This is needed because
120
+ // `require.resolve()` (scoped to the wrapper's location) cannot find
121
+ // globally-installed packages.
122
+ function resolveBinaryInGlobalPackage(packageName, binaryName) {
123
+ let globalRoot;
124
+ try {
125
+ globalRoot = execSync("npm root -g", { encoding: "utf8" }).trim();
126
+ } catch {
127
+ return null;
128
+ }
129
+
130
+ const binaryPath = path.join(globalRoot, packageName, "dist", binaryName);
131
+ return existsSync(binaryPath) ? binaryPath : null;
132
+ }
133
+
119
134
  function resolveBinary() {
120
135
  const entry = PLATFORM_PACKAGES.get(PLATFORM_KEY);
121
136
  if (!entry) {
@@ -234,18 +249,28 @@ if (result.code === STATUS_ILLEGAL_INSTRUCTION && entry.fallbackPackageName) {
234
249
  // Resolve or install fallback binary
235
250
  // ####################
236
251
 
237
- let fallbackPath = resolveBinaryInPackage(
238
- entry.fallbackPackageName,
239
- entry.fallbackBinaryName,
240
- );
252
+ let fallbackPath =
253
+ resolveBinaryInPackage(
254
+ entry.fallbackPackageName,
255
+ entry.fallbackBinaryName,
256
+ ) ??
257
+ resolveBinaryInGlobalPackage(
258
+ entry.fallbackPackageName,
259
+ entry.fallbackBinaryName,
260
+ );
241
261
 
242
262
  if (!fallbackPath) {
243
263
  const installed = installFallbackPackage(entry.fallbackPackageName);
244
264
  if (installed) {
245
- fallbackPath = resolveBinaryInPackage(
246
- entry.fallbackPackageName,
247
- entry.fallbackBinaryName,
248
- );
265
+ fallbackPath =
266
+ resolveBinaryInPackage(
267
+ entry.fallbackPackageName,
268
+ entry.fallbackBinaryName,
269
+ ) ??
270
+ resolveBinaryInGlobalPackage(
271
+ entry.fallbackPackageName,
272
+ entry.fallbackBinaryName,
273
+ );
249
274
  }
250
275
  }
251
276
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@command-center/command-center",
3
- "version": "0.7.5-rc0",
3
+ "version": "0.8.0-rc1",
4
4
  "type": "module",
5
5
  "description": "Binary distribution of UpToSpeed Command Center",
6
6
  "bin": {
@@ -23,12 +23,12 @@
23
23
  "access": "public"
24
24
  },
25
25
  "optionalDependencies": {
26
- "@command-center/command-center-linux-arm64": "0.7.5-rc0",
27
- "@command-center/command-center-linux-x64": "0.7.5-rc0",
28
- "@command-center/command-center-macos-arm64": "0.7.5-rc0",
29
- "@command-center/command-center-macos-x64": "0.7.5-rc0",
30
- "@command-center/command-center-win-arm64": "0.7.5-rc0",
31
- "@command-center/command-center-win-x64": "0.7.5-rc0"
26
+ "@command-center/command-center-linux-arm64": "0.8.0-rc1",
27
+ "@command-center/command-center-linux-x64": "0.8.0-rc1",
28
+ "@command-center/command-center-macos-arm64": "0.8.0-rc1",
29
+ "@command-center/command-center-macos-x64": "0.8.0-rc1",
30
+ "@command-center/command-center-win-arm64": "0.8.0-rc1",
31
+ "@command-center/command-center-win-x64": "0.8.0-rc1"
32
32
  },
33
33
  "scripts": {}
34
34
  }