mirror of
https://github.com/lovell/sharp.git
synced 2026-02-04 13:46:19 +01:00
Add version to shared library filename to help avoid collision
This commit is contained in:
@@ -7,12 +7,13 @@
|
||||
|
||||
const { familySync, versionSync } = require('detect-libc');
|
||||
|
||||
const { version } = require('../package.json');
|
||||
const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require('./libvips');
|
||||
const runtimePlatform = runtimePlatformArch();
|
||||
|
||||
const paths = [
|
||||
`../src/build/Release/sharp-${runtimePlatform}.node`,
|
||||
'../src/build/Release/sharp-wasm32.node',
|
||||
`../src/build/Release/sharp-${runtimePlatform}-${version}.node`,
|
||||
`../src/build/Release/sharp-wasm32-${version}.node`,
|
||||
`@img/sharp-${runtimePlatform}/sharp.node`,
|
||||
'@img/sharp-wasm32/sharp.node'
|
||||
];
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-darwin-arm64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-darwin-arm64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-darwin-x64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-darwin-x64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -44,9 +44,10 @@ cpSync(releaseDir, libDir, {
|
||||
}
|
||||
});
|
||||
|
||||
// Generate README
|
||||
const { name, description } = require(`./${platform}/package.json`);
|
||||
// Generate README and index.cjs
|
||||
const { version, name, description } = require(`./${platform}/package.json`);
|
||||
writeFileSync(join(destDir, 'README.md'), `# \`${name}\`\n\n${description}.\n${licensing}`);
|
||||
writeFileSync(join(destDir, 'index.cjs'), `module.exports = require('./lib/sharp-${platform}-${version}.node');`);
|
||||
|
||||
// Copy Apache-2.0 LICENSE
|
||||
copyFileSync(join(__dirname, '..', 'LICENSE'), join(destDir, 'LICENSE'));
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-arm": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-arm.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-arm64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-arm64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-ppc64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-ppc64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-riscv64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-riscv64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-s390x": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-s390x.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linux-x64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-x64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linuxmusl-arm64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linuxmusl-arm64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"@img/sharp-libvips-linuxmusl-x64": "1.3.0-rc.1"
|
||||
},
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
@@ -25,7 +26,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linuxmusl-x64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-wasm32.node.js",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
@@ -23,7 +24,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-win32-arm64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
@@ -23,7 +24,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-win32-ia32.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"files": [
|
||||
"index.cjs",
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
@@ -23,7 +24,7 @@
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-win32-x64.node",
|
||||
"./sharp.node": "./index.cjs",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
'variables': {
|
||||
'vips_version': '<!(node -p "require(\'../lib/libvips\').minimumLibvipsVersion")',
|
||||
'platform_and_arch': '<!(node -p "require(\'../lib/libvips\').buildPlatformArch()")',
|
||||
'sharp_version': '<!(node -p "require(\'../package.json\').version")',
|
||||
'sharp_libvips_version': '<!(node -p "require(\'../package.json\').optionalDependencies[\'@img/sharp-libvips-<(platform_and_arch)\']")',
|
||||
'sharp_libvips_yarn_locator': '<!(node -p "require(\'../lib/libvips\').yarnLocator()")',
|
||||
'sharp_libvips_include_dir': '<!(node -p "require(\'../lib/libvips\').buildSharpLibvipsIncludeDir()")',
|
||||
@@ -81,7 +82,7 @@
|
||||
}]
|
||||
]
|
||||
}, {
|
||||
'target_name': 'sharp-<(platform_and_arch)',
|
||||
'target_name': 'sharp-<(platform_and_arch)-<(sharp_version)',
|
||||
'defines': [
|
||||
'G_DISABLE_ASSERT',
|
||||
'G_DISABLE_CAST_CHECKS',
|
||||
@@ -282,7 +283,7 @@
|
||||
'target_name': 'copy-dll',
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'sharp-<(platform_and_arch)'
|
||||
'sharp-<(platform_and_arch)-<(sharp_version)'
|
||||
],
|
||||
'conditions': [
|
||||
['OS == "win"', {
|
||||
|
||||
Reference in New Issue
Block a user