From 80e4707af1e4e6574854d72046598fd754ca42b6 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Tue, 10 Oct 2023 19:23:24 +0100 Subject: [PATCH] Revert "Package managers cannot handle nested optionalDependencies" This partially reverts commit 51e56f994ce1332f77daf625e23820a895de074d. Ignoring plug'n'play, it looks like yarn and pnpm do get the filesystem layout right for this scenario, which is good news. It also looks like npm 10 will get it right too. --- lib/sharp.js | 13 ++++++------- npm/darwin-arm64/package.json | 3 +++ npm/darwin-x64/package.json | 3 +++ npm/linux-arm/package.json | 3 +++ npm/linux-arm64/package.json | 3 +++ npm/linux-x64/package.json | 3 +++ npm/linuxmusl-arm64/package.json | 3 +++ npm/linuxmusl-x64/package.json | 3 +++ 8 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/sharp.js b/lib/sharp.js index 6f28fcad..7c91f574 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -30,11 +30,8 @@ try { help.push('Possible solutions:'); // Common error messages if (prebuiltPlatforms.includes(runtimePlatform)) { - help.push('- Add explicit dependencies for the runtime platform:'); - help.push(` npm install --force @sharpen/sharp-${runtimePlatform}`); - if (!isWindows) { - help.push(` npm install --force @sharpen/sharp-libvips-${runtimePlatform}`); - } + help.push('- Add an explicit dependency for the runtime platform:'); + help.push(` npm install --force @sharpen/sharp-${runtimePlatform}"`); } else { help.push(`- The ${runtimePlatform} platform requires manual installation of libvips >= ${minimumLibvipsVersion}`); } @@ -43,7 +40,9 @@ try { const { engines } = require(`@sharpen/sharp-libvips-${runtimePlatform}/package`); const libcFound = `${familySync()} ${versionSync()}`; const libcRequires = `${engines.musl ? 'musl' : 'glibc'} ${engines.musl || engines.glibc}`; - help.push(`- Update your OS: found ${libcFound}, requires ${libcRequires}`); + help.push('- Update your OS:'); + help.push(` Found ${libcFound}`); + help.push(` Requires ${libcRequires}`); } catch (errEngines) {} } if (isMacOs && /Incompatible library version/.test(errLocal.message)) { @@ -54,7 +53,7 @@ try { help.push('- Run Node.js without using the --no-addons flag'); } if (process.versions.pnp) { - help.push('- Use a supported yarn linker, either pnpm or node-modules'); + help.push('- Use a supported yarn linker, either pnpm or node-modules:'); help.push(' yarn config set nodeLinker node-modules'); } // Link to installation docs diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index 0e6477b9..0067c694 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index 2253c433..447c1a4c 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index 92b3061d..48d58b80 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 420af688..46e697a9 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-linux-arm64": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index 1d98cdbb..5eb36de3 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/linuxmusl-arm64/package.json b/npm/linuxmusl-arm64/package.json index d711fe10..5f32ee64 100644 --- a/npm/linuxmusl-arm64/package.json +++ b/npm/linuxmusl-arm64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.1" + }, "files": [ "lib" ], diff --git a/npm/linuxmusl-x64/package.json b/npm/linuxmusl-x64/package.json index 5f989db0..3c41cc7f 100644 --- a/npm/linuxmusl-x64/package.json +++ b/npm/linuxmusl-x64/package.json @@ -13,6 +13,9 @@ "url": "https://opencollective.com/libvips" }, "preferUnplugged": true, + "optionalDependencies": { + "@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.1" + }, "files": [ "lib" ],