Separate build script from install script #4458

The --build-from-source flag is now deprecated and will soon
be removed along with the need to define an install script.

This will remove a whole category of package manager
warnings about install scripts and "built" dependencies.

Most people don't need to build sharp from source, but for
those that do, a suitable method is now something like:

$ npm install package-that-depends-on-sharp
$ npm explore sharp -- npm run build
This commit is contained in:
Lovell Fuller
2025-10-07 14:32:44 +01:00
parent 2324d75f7f
commit 1bbee519aa
10 changed files with 65 additions and 46 deletions

View File

@@ -92,7 +92,8 @@
"Don Denton <don@happycollision.com>"
],
"scripts": {
"install": "node install/check.js",
"build": "node install/build.js",
"install": "node install/check.js || npm run build",
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
"test": "npm run lint && npm run test-unit",
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
@@ -139,7 +140,7 @@
],
"dependencies": {
"@img/colour": "^1.0.0",
"detect-libc": "^2.1.0",
"detect-libc": "^2.1.1",
"semver": "^7.7.2"
},
"optionalDependencies": {
@@ -167,7 +168,7 @@
"@img/sharp-win32-x64": "0.34.4"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@biomejs/biome": "^2.2.5",
"@cpplint/cli": "^0.1.0",
"@emnapi/runtime": "^1.5.0",
"@img/sharp-libvips-dev": "1.2.3",
@@ -180,7 +181,7 @@
"exif-reader": "^2.0.2",
"extract-zip": "^2.0.1",
"icc": "^3.0.0",
"jsdoc-to-markdown": "^9.1.2",
"jsdoc-to-markdown": "^9.1.3",
"node-addon-api": "^8.5.0",
"node-gyp": "^11.4.2",
"tar-fs": "^3.1.1",