Skip to content

Commit 1a2c1c8

Browse files
committed
Add version to shared library filename to help avoid collision
1 parent aaeded2 commit 1a2c1c8

File tree

17 files changed

+36
-20
lines changed

17 files changed

+36
-20
lines changed

lib/sharp.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
const { familySync, versionSync } = require('detect-libc');
99

10+
const { version } = require('../package.json');
1011
const { runtimePlatformArch, isUnsupportedNodeRuntime, prebuiltPlatforms, minimumLibvipsVersion } = require('./libvips');
1112
const runtimePlatform = runtimePlatformArch();
1213

1314
const paths = [
14-
`../src/build/Release/sharp-${runtimePlatform}.node`,
15-
'../src/build/Release/sharp-wasm32.node',
15+
`../src/build/Release/sharp-${runtimePlatform}-${version}.node`,
16+
`../src/build/Release/sharp-wasm32-${version}.node`,
1617
`@img/sharp-${runtimePlatform}/sharp.node`,
1718
'@img/sharp-wasm32/sharp.node'
1819
];

npm/darwin-arm64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-darwin-arm64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-darwin-arm64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/darwin-x64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-darwin-x64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-darwin-x64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/from-local-build.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ cpSync(releaseDir, libDir, {
4444
}
4545
});
4646

47-
// Generate README
48-
const { name, description } = require(`./${platform}/package.json`);
47+
// Generate README and index.cjs
48+
const { version, name, description } = require(`./${platform}/package.json`);
4949
writeFileSync(join(destDir, 'README.md'), `# \`${name}\`\n\n${description}.\n${licensing}`);
50+
writeFileSync(join(destDir, 'index.cjs'), `module.exports = require('./lib/sharp-${platform}-${version}.node');`);
5051

5152
// Copy Apache-2.0 LICENSE
5253
copyFileSync(join(__dirname, '..', 'LICENSE'), join(destDir, 'LICENSE'));

npm/linux-arm/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-arm": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-arm.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/linux-arm64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-arm64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-arm64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/linux-ppc64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-ppc64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-ppc64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/linux-riscv64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-riscv64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-riscv64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/linux-s390x/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-s390x": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-s390x.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

npm/linux-x64/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
"@img/sharp-libvips-linux-x64": "1.3.0-rc.1"
1919
},
2020
"files": [
21+
"index.cjs",
2122
"lib"
2223
],
2324
"publishConfig": {
2425
"access": "public"
2526
},
2627
"type": "commonjs",
2728
"exports": {
28-
"./sharp.node": "./lib/sharp-linux-x64.node",
29+
"./sharp.node": "./index.cjs",
2930
"./package": "./package.json"
3031
},
3132
"engines": {

0 commit comments

Comments
 (0)