Skip to content

Commit

Permalink
fix: package names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jujulego authored Aug 22, 2024
1 parent d75a2a2 commit 1a770ee
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions npm/ring/bin/ring
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ function getBinaryPath() {
// Try all places in order until we get a hit.

// 1. The package which contains the binary we _should_ be running.
const correctBinary = availablePlatforms.includes(platform) && availableArchs.includes(resolvedArch) ? `ring-${platform}-${resolvedArch}/bin/ring${ext}` : null;
const correctBinary = availablePlatforms.includes(platform) && availableArchs.includes(resolvedArch) ? `@jujulego/ring-${platform}-${resolvedArch}/bin/ring${ext}` : null;
if (correctBinary !== null) {
try {
return require.resolve(`${correctBinary}`);
} catch (e) {}
}

// 2. Both Windows and macOS ARM boxes can run x64 binaries. Attempt to run under emulation.
const alternateBinary = (arch === 'arm64' && ['macos', 'windows'].includes(platform)) ? `ring-${platform}-amd64/bin/ring${ext}` : null;
const alternateBinary = (arch === 'arm64' && ['macos', 'windows'].includes(platform)) ? `@jujulego/ring-${platform}-amd64/bin/ring${ext}` : null;
if (SHOULD_ATTEMPT_EMULATED && alternateBinary !== null) {
try {
const resolvedPath = require.resolve(`${alternateBinary}`);
Expand Down Expand Up @@ -123,7 +123,7 @@ function getBinaryPath() {
// Investigate other failure modes.

// Has the wrong platform's binaries available.
const availableBinaries = availablePlatforms.map(platform => availableArchs.map(arch => `ring-${platform}-${arch}/bin/ring${platform === 'windows' ? '.exe' : ''}`)).flat();
const availableBinaries = availablePlatforms.map(platform => availableArchs.map(arch => `@jujulego/ring-${platform}-${arch}/bin/ring${platform === 'windows' ? '.exe' : ''}`)).flat();
const definitelyWrongBinaries = availableBinaries.filter(binary => binary !== correctBinary || binary !== correctBinary);
const otherInstalled = definitelyWrongBinaries.filter(binaryPath => {
try {
Expand All @@ -149,7 +149,7 @@ function getBinaryPath() {

// Check to see if we have partially-populated dependencies in the npm lockfile.
const MAX_LOOKUPS = 10;
const availablePackages = availablePlatforms.map(platform => availableArchs.map(arch => `ring-${platform}-${arch}`)).flat();
const availablePackages = availablePlatforms.map(platform => availableArchs.map(arch => `@jujulego/ring-${platform}-${arch}`)).flat();

try {
// Attempt to find project root.
Expand Down Expand Up @@ -179,14 +179,14 @@ function getBinaryPath() {
// Let's build their repair command:
let version = '';
let environment = '';
if (parsedLockfile?.packages[""]?.dependencies?.ring) {
version = `@${parsedLockfile.packages[""].dependencies.ring}`;
if (parsedLockfile?.packages[""]?.dependencies?.["@jujulego/ring"]) {
version = `@${parsedLockfile.packages[""].dependencies?.["@jujulego/ring"]}`;
environment = ' --save-prod';
} else if (parsedLockfile?.packages[""]?.devDependencies?.ring) {
version = `@${parsedLockfile.packages[""].devDependencies.ring}`;
} else if (parsedLockfile?.packages[""]?.devDependencies?.["@jujulego/ring"]) {
version = `@${parsedLockfile.packages[""].devDependencies?.["@jujulego/ring"]}`;
environment = ' --save-dev';
} else if (parsedLockfile?.packages[""]?.optionalDependencies?.ring) {
version = `@${parsedLockfile.packages[""].optionalDependencies.ring}`;
} else if (parsedLockfile?.packages[""]?.optionalDependencies?.["@jujulego/ring"]) {
version = `@${parsedLockfile.packages[""].optionalDependencies?.["@jujulego/ring"]}`;
environment = ' --save-optional';
}

Expand Down Expand Up @@ -221,4 +221,4 @@ try {
} catch (e) {
if (e && e.status) process.exit(e.status);
throw e;
}
}

0 comments on commit 1a770ee

Please sign in to comment.