From f8b6cb6d5bb9b3d33aa92e6d14fc0f4662eb54b2 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 12 Oct 2023 17:03:37 +0100 Subject: [PATCH] Update package names to use 'img' npm organisation --- .circleci/config.yml | 8 +++---- .github/workflows/ci.yml | 6 ++--- docs/install.md | 8 +++---- lib/libvips.js | 6 ++--- lib/sharp.js | 6 ++--- lib/utility.js | 4 ++-- npm/darwin-arm64/package.json | 4 ++-- npm/darwin-x64/package.json | 4 ++-- npm/from-github-release.js | 15 +++++++------ npm/linux-arm/package.json | 4 ++-- npm/linux-arm64/package.json | 4 ++-- npm/linux-x64/package.json | 4 ++-- npm/linuxmusl-arm64/package.json | 4 ++-- npm/linuxmusl-x64/package.json | 4 ++-- npm/package.json | 2 +- npm/win32-ia32/package.json | 5 ++--- npm/win32-x64/package.json | 8 +++---- package.json | 38 ++++++++++++++++---------------- src/binding.gyp | 8 +++---- 19 files changed, 71 insertions(+), 71 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e8732ca7..c7d07d64 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -38,7 +38,7 @@ jobs: - run: sudo docker exec sharp sh -c "npm test" - run: | sudo docker exec sharp sh -c "npm run package-from-local-build" - sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@sharpen/sharp-linux-arm64=file:./npm/linux-arm64\"" + sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linux-arm64=file:./npm/linux-arm64\"" sudo docker exec sharp sh -c "npm run clean" sudo docker exec sharp sh -c "npm install --ignore-scripts" sudo docker exec sharp sh -c "npm test" @@ -62,7 +62,7 @@ jobs: - run: sudo docker exec sharp sh -c "npm test" - run: | sudo docker exec sharp sh -c "npm run package-from-local-build" - sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@sharpen/sharp-linux-arm64=file:./npm/linux-arm64\"" + sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linux-arm64=file:./npm/linux-arm64\"" sudo docker exec sharp sh -c "npm run clean" sudo docker exec sharp sh -c "npm install --ignore-scripts" sudo docker exec sharp sh -c "npm test" @@ -79,7 +79,7 @@ jobs: - run: sudo docker exec sharp sh -c "npm test" - run: | sudo docker exec sharp sh -c "npm run package-from-local-build" - sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@sharpen/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\"" + sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\"" sudo docker exec sharp sh -c "npm run clean" sudo docker exec sharp sh -c "npm install --ignore-scripts" sudo docker exec sharp sh -c "npm test" @@ -99,7 +99,7 @@ jobs: - run: sudo docker exec sharp sh -c "npm test" - run: | sudo docker exec sharp sh -c "npm run package-from-local-build" - sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@sharpen/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\"" + sudo docker exec sharp sh -c "npm pkg set \"optionalDependencies.@img/sharp-linuxmusl-arm64=file:./npm/linuxmusl-arm64\"" sudo docker exec sharp sh -c "npm run clean" sudo docker exec sharp sh -c "npm install --ignore-scripts" sudo docker exec sharp sh -c "npm test" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d76d905b..05515a91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: - name: Test packaging run: | npm run package-from-local-build - npm pkg set "optionalDependencies.@sharpen/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" + npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" npm run clean npm install --ignore-scripts npm test @@ -141,7 +141,7 @@ jobs: npm install --build-from-source npx mocha --no-config --spec=test/unit/io.js npm run package-from-local-build - npm pkg set "optionalDependencies.@sharpen/sharp-linux-arm=file:./npm/linux-arm" + npm pkg set "optionalDependencies.@img/sharp-linux-arm=file:./npm/linux-arm" npm run clean npm install --ignore-scripts npx mocha --no-config --spec=test/unit/io.js --timeout=30000 @@ -182,7 +182,7 @@ jobs: - name: Test packaging run: | npm run package-from-local-build - npm pkg set "optionalDependencies.@sharpen/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" + npm pkg set "optionalDependencies.@img/sharp-${{ matrix.platform }}=file:./npm/${{ matrix.platform }}" npm run clean npm install --ignore-scripts npm test diff --git a/docs/install.md b/docs/install.md index 9f676773..1b942159 100644 --- a/docs/install.md +++ b/docs/install.md @@ -106,14 +106,14 @@ must include binaries for either the linux-x64 or linux-arm64 platforms depending on the chosen architecture. When building your deployment package on a machine that differs from the target architecture, -you will need to install either `@sharpen/sharp-linux-x64` or `@sharpen/sharp-linux-arm64` package. +you will need to install either `@img/sharp-linux-x64` or `@img/sharp-linux-arm64` package. ```sh -npm install --force @sharpen/sharp-linux-x64 +npm install --force @img/sharp-linux-x64 ``` ```sh -npm install --force @sharpen/sharp-linux-arm64 +npm install --force @img/sharp-linux-arm64 ``` To get the best performance select the largest memory available. @@ -165,7 +165,7 @@ custom: - sharp packagerOptions: scripts: - - npm install --force @sharpen/sharp-linux-x64 + - npm install --force @img/sharp-linux-x64 ``` ## TypeScript diff --git a/lib/libvips.js b/lib/libvips.js index 8e51f07e..ebb41fd0 100644 --- a/lib/libvips.js +++ b/lib/libvips.js @@ -48,7 +48,7 @@ const buildPlatformArch = () => { const buildSharpLibvipsIncludeDir = () => { try { - return require('@sharpen/sharp-libvips-dev/include'); + return require('@img/sharp-libvips-dev/include'); } catch {} /* istanbul ignore next */ return ''; @@ -56,7 +56,7 @@ const buildSharpLibvipsIncludeDir = () => { const buildSharpLibvipsCPlusPlusDir = () => { try { - return require('@sharpen/sharp-libvips-dev/cplusplus'); + return require('@img/sharp-libvips-dev/cplusplus'); } catch {} /* istanbul ignore next */ return ''; @@ -64,7 +64,7 @@ const buildSharpLibvipsCPlusPlusDir = () => { const buildSharpLibvipsLibDir = () => { try { - return require(`@sharpen/sharp-libvips-${buildPlatformArch()}/lib`); + return require(`@img/sharp-libvips-${buildPlatformArch()}/lib`); } catch {} /* istanbul ignore next */ return ''; diff --git a/lib/sharp.js b/lib/sharp.js index 629b8989..3b9a0078 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -18,7 +18,7 @@ try { } catch (errLocal) { try { // Check for runtime package - module.exports = require(`@sharpen/sharp-${runtimePlatform}/sharp.node`); + module.exports = require(`@img/sharp-${runtimePlatform}/sharp.node`); } catch (errPackage) { const help = ['Could not load the "sharp" module at runtime']; if (errLocal.code !== 'MODULE_NOT_FOUND') { @@ -31,13 +31,13 @@ try { // Common error messages if (prebuiltPlatforms.includes(runtimePlatform)) { help.push('- Add an explicit dependency for the runtime platform:'); - help.push(` npm install --force @sharpen/sharp-${runtimePlatform}`); + help.push(` npm install --force @img/sharp-${runtimePlatform}`); } else { help.push(`- The ${runtimePlatform} platform requires manual installation of libvips >= ${minimumLibvipsVersion}`); } if (isLinux && /symbol not found/i.test(errPackage)) { try { - const { engines } = require(`@sharpen/sharp-libvips-${runtimePlatform}/package`); + const { engines } = require(`@img/sharp-libvips-${runtimePlatform}/package`); const libcFound = `${familySync()} ${versionSync()}`; const libcRequires = `${engines.musl ? 'musl' : 'glibc'} ${engines.musl || engines.glibc}`; help.push('- Update your OS:'); diff --git a/lib/utility.js b/lib/utility.js index 174782c1..bddfe5d9 100644 --- a/lib/utility.js +++ b/lib/utility.js @@ -60,10 +60,10 @@ let versions = { /* istanbul ignore next */ if (!libvipsVersion.isGlobal) { try { - versions = require(`@sharpen/sharp-${runtimePlatform}/versions`); + versions = require(`@img/sharp-${runtimePlatform}/versions`); } catch (_) { try { - versions = require(`@sharpen/sharp-libvips-${runtimePlatform}/versions`); + versions = require(`@img/sharp-libvips-${runtimePlatform}/versions`); } catch (_) {} } } diff --git a/npm/darwin-arm64/package.json b/npm/darwin-arm64/package.json index e6a1a55a..a3ee8693 100644 --- a/npm/darwin-arm64/package.json +++ b/npm/darwin-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-darwin-arm64", + "name": "@img/sharp-darwin-arm64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with macOS ARM64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.2" + "@img/sharp-libvips-darwin-arm64": "0.0.1" }, "files": [ "lib" diff --git a/npm/darwin-x64/package.json b/npm/darwin-x64/package.json index df7d5e94..ed86b817 100644 --- a/npm/darwin-x64/package.json +++ b/npm/darwin-x64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-darwin-x64", + "name": "@img/sharp-darwin-x64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with macOS x64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.2" + "@img/sharp-libvips-darwin-x64": "0.0.1" }, "files": [ "lib" diff --git a/npm/from-github-release.js b/npm/from-github-release.js index 5da25119..866d0395 100644 --- a/npm/from-github-release.js +++ b/npm/from-github-release.js @@ -5,7 +5,7 @@ // Populate contents of all packages with the current GitHub release -const { writeFile, copyFile, rm } = require('node:fs/promises'); +const { readFile, writeFile, appendFile, copyFile, rm } = require('node:fs/promises'); const path = require('node:path'); const { Readable } = require('node:stream'); const { pipeline } = require('node:stream/promises'); @@ -60,11 +60,12 @@ workspaces.map(async platform => { await copyFile(path.join(__dirname, '..', 'LICENSE'), path.join(dir, 'LICENSE')); // Copy Windows-specific files if (platform.startsWith('win32-')) { - const sharpLibvipsDir = path.join(require(`@sharpen/sharp-libvips-${platform}/lib`), '..'); - await Promise.all( - ['versions.json', 'THIRD-PARTY-NOTICES.md'].map( - filename => copyFile(path.join(sharpLibvipsDir, filename), path.join(dir, filename)) - ) - ); + const sharpLibvipsDir = path.join(require(`@img/sharp-libvips-${platform}/lib`), '..'); + // Copy versions.json + await copyFile(path.join(sharpLibvipsDir, 'versions.json'), path.join(dir, 'versions.json')); + // Append third party licensing to README + const readme = await readFile(path.join(sharpLibvipsDir, 'README.md'), { encoding: 'utf-8' }); + const thirdParty = readme.substring(readme.indexOf('\nThis software contains')); + appendFile(path.join(dir, 'README.md'), thirdParty); } }); diff --git a/npm/linux-arm/package.json b/npm/linux-arm/package.json index bcfce2e4..0e96cf9c 100644 --- a/npm/linux-arm/package.json +++ b/npm/linux-arm/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-linux-arm", + "name": "@img/sharp-linux-arm", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.2" + "@img/sharp-libvips-linux-arm": "0.0.1" }, "files": [ "lib" diff --git a/npm/linux-arm64/package.json b/npm/linux-arm64/package.json index 1bf079de..3b8493a7 100644 --- a/npm/linux-arm64/package.json +++ b/npm/linux-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-linux-arm64", + "name": "@img/sharp-linux-arm64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Linux (glibc) ARM64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-linux-arm64": "0.0.1-alpha.2" + "@img/sharp-libvips-linux-arm64": "0.0.1" }, "files": [ "lib" diff --git a/npm/linux-x64/package.json b/npm/linux-x64/package.json index f1274330..0a9f3657 100644 --- a/npm/linux-x64/package.json +++ b/npm/linux-x64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-linux-x64", + "name": "@img/sharp-linux-x64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Linux (glibc) x64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.2" + "@img/sharp-libvips-linux-x64": "0.0.1" }, "files": [ "lib" diff --git a/npm/linuxmusl-arm64/package.json b/npm/linuxmusl-arm64/package.json index f481e7f6..0c4217de 100644 --- a/npm/linuxmusl-arm64/package.json +++ b/npm/linuxmusl-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-linuxmusl-arm64", + "name": "@img/sharp-linuxmusl-arm64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Linux (musl) ARM64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.2" + "@img/sharp-libvips-linuxmusl-arm64": "0.0.1" }, "files": [ "lib" diff --git a/npm/linuxmusl-x64/package.json b/npm/linuxmusl-x64/package.json index c39c8b00..8a51b8bd 100644 --- a/npm/linuxmusl-x64/package.json +++ b/npm/linuxmusl-x64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-linuxmusl-x64", + "name": "@img/sharp-linuxmusl-x64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Linux (musl) x64", "homepage": "https://sharp.pixelplumbing.com", @@ -14,7 +14,7 @@ }, "preferUnplugged": true, "optionalDependencies": { - "@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.2" + "@img/sharp-libvips-linuxmusl-x64": "0.0.1" }, "files": [ "lib" diff --git a/npm/package.json b/npm/package.json index f91c6038..de6d480b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp", + "name": "@img/sharp", "version": "0.0.1-alpha.8", "private": "true", "workspaces": [ diff --git a/npm/win32-ia32/package.json b/npm/win32-ia32/package.json index 3ccd3cdd..4d8559d9 100644 --- a/npm/win32-ia32/package.json +++ b/npm/win32-ia32/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-win32-ia32", + "name": "@img/sharp-win32-ia32", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Windows x86 (32-bit)", "homepage": "https://sharp.pixelplumbing.com", @@ -15,8 +15,7 @@ "preferUnplugged": true, "files": [ "lib", - "versions.json", - "THIRD-PARTY-NOTICES.md" + "versions.json" ], "publishConfig": { "access": "public" diff --git a/npm/win32-x64/package.json b/npm/win32-x64/package.json index f33bb4d4..d65e6fc9 100644 --- a/npm/win32-x64/package.json +++ b/npm/win32-x64/package.json @@ -1,5 +1,5 @@ { - "name": "@sharpen/sharp-win32-x64", + "name": "@img/sharp-win32-x64", "version": "0.0.1-alpha.8", "description": "Prebuilt sharp for use with Windows x64", "homepage": "https://sharp.pixelplumbing.com", @@ -15,8 +15,7 @@ "preferUnplugged": true, "files": [ "lib", - "versions.json", - "THIRD-PARTY-NOTICES.md" + "versions.json" ], "publishConfig": { "access": "public" @@ -24,7 +23,8 @@ "type": "commonjs", "exports": { "./sharp.node": "./lib/sharp-win32-x64.node", - "./package": "./package.json" + "./package": "./package.json", + "./versions": "./versions.json" }, "engines": { "node": "^18.17.0 || ^20.3.0 || >=21.0.0", diff --git a/package.json b/package.json index a7d70ce5..28561570 100644 --- a/package.json +++ b/package.json @@ -139,27 +139,27 @@ "semver": "^7.5.4" }, "optionalDependencies": { - "@sharpen/sharp-darwin-arm64": "0.0.1-alpha.8", - "@sharpen/sharp-darwin-x64": "0.0.1-alpha.8", - "@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-linux-arm64": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.2", - "@sharpen/sharp-linux-arm": "0.0.1-alpha.8", - "@sharpen/sharp-linux-arm64": "0.0.1-alpha.8", - "@sharpen/sharp-linux-x64": "0.0.1-alpha.8", - "@sharpen/sharp-linuxmusl-arm64": "0.0.1-alpha.8", - "@sharpen/sharp-linuxmusl-x64": "0.0.1-alpha.8", - "@sharpen/sharp-win32-ia32": "0.0.1-alpha.8", - "@sharpen/sharp-win32-x64": "0.0.1-alpha.8" + "@img/sharp-darwin-arm64": "0.0.1-alpha.8", + "@img/sharp-darwin-x64": "0.0.1-alpha.8", + "@img/sharp-libvips-darwin-arm64": "0.0.1", + "@img/sharp-libvips-darwin-x64": "0.0.1", + "@img/sharp-libvips-linux-arm": "0.0.1", + "@img/sharp-libvips-linux-arm64": "0.0.1", + "@img/sharp-libvips-linux-x64": "0.0.1", + "@img/sharp-libvips-linuxmusl-arm64": "0.0.1", + "@img/sharp-libvips-linuxmusl-x64": "0.0.1", + "@img/sharp-linux-arm": "0.0.1-alpha.8", + "@img/sharp-linux-arm64": "0.0.1-alpha.8", + "@img/sharp-linux-x64": "0.0.1-alpha.8", + "@img/sharp-linuxmusl-arm64": "0.0.1-alpha.8", + "@img/sharp-linuxmusl-x64": "0.0.1-alpha.8", + "@img/sharp-win32-ia32": "0.0.1-alpha.8", + "@img/sharp-win32-x64": "0.0.1-alpha.8" }, "devDependencies": { - "@sharpen/sharp-libvips-dev": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-win32-ia32": "0.0.1-alpha.2", - "@sharpen/sharp-libvips-win32-x64": "0.0.1-alpha.2", + "@img/sharp-libvips-dev": "0.0.1", + "@img/sharp-libvips-win32-ia32": "0.0.1", + "@img/sharp-libvips-win32-x64": "0.0.1", "@types/node": "*", "async": "^3.2.4", "cc": "^3.0.1", diff --git a/src/binding.gyp b/src/binding.gyp index 473a8cc6..8d891f48 100644 --- a/src/binding.gyp +++ b/src/binding.gyp @@ -157,8 +157,8 @@ 'OTHER_LDFLAGS': [ # Ensure runtime linking is relative to sharp.node '-Wl,-rpath,\'@loader_path/../../sharp-libvips-<(platform_and_arch)/lib\'', - '-Wl,-rpath,\'@loader_path/../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'', - '-Wl,-rpath,\'@loader_path/../../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'' + '-Wl,-rpath,\'@loader_path/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'', + '-Wl,-rpath,\'@loader_path/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'' ] } }], @@ -178,8 +178,8 @@ '-Wl,-s', '-Wl,--disable-new-dtags', '-Wl,-rpath=\'$$ORIGIN/../../sharp-libvips-<(platform_and_arch)/lib\'', - '-Wl,-rpath=\'$$ORIGIN/../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'', - '-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@sharpen/sharp-libvips-<(platform_and_arch)/lib\'' + '-Wl,-rpath=\'$$ORIGIN/../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'', + '-Wl,-rpath=\'$$ORIGIN/../../../node_modules/@img/sharp-libvips-<(platform_and_arch)/lib\'' ] } }]