mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Distribute prebuilt binaries via the npm registry #3750
- Remove all custom download logic for prebuilt binaries - Add scripts to populate package contents - Specify minimum versions of common package managers - Remove sharp.vendor runtime API as no-longer relevant - Update installation docs and issue templates
This commit is contained in:
42
npm/darwin-arm64/package.json
Normal file
42
npm/darwin-arm64/package.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-darwin-arm64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with macOS ARM64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/darwin-arm64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-darwin-arm64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
39
npm/darwin-x64/package.json
Normal file
39
npm/darwin-x64/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-darwin-x64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with macOS x64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/darwin-x64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-darwin-x64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
51
npm/from-github-release.js
Normal file
51
npm/from-github-release.js
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright 2013 Lovell Fuller and others.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
'use strict';
|
||||
|
||||
// Populate contents of all packages with the current GitHub release
|
||||
|
||||
const { writeFile, copyFile } = require('node:fs/promises');
|
||||
const path = require('node:path');
|
||||
const { Readable } = require('node:stream');
|
||||
const { pipeline } = require('node:stream/promises');
|
||||
const { createGunzip } = require('node:zlib');
|
||||
const { extract } = require('tar-fs');
|
||||
|
||||
const { workspaces } = require('./package.json');
|
||||
const { version } = require('../package.json');
|
||||
|
||||
const mapTarballEntry = (header) => {
|
||||
header.name = path.basename(header.name);
|
||||
return header;
|
||||
};
|
||||
|
||||
workspaces.map(async platform => {
|
||||
const url = `https://github.com/lovell/sharp/releases/download/v${version}/sharp-v${version}-napi-v7-${platform}.tar.gz`;
|
||||
const dir = path.join(__dirname, platform);
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
console.log(`Skipping ${platform}: ${response.statusText}`);
|
||||
return;
|
||||
}
|
||||
// Extract prebuild tarball
|
||||
await pipeline(
|
||||
Readable.fromWeb(response.body),
|
||||
createGunzip(),
|
||||
extract(path.join(dir, 'lib'), { map: mapTarballEntry })
|
||||
);
|
||||
// Generate README
|
||||
const { name, description } = require(`./${platform}/package.json`);
|
||||
await writeFile(path.join(dir, 'README.md'), `# ${name}\n${description}`);
|
||||
// Copy Apache-2.0 LICENSE
|
||||
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))
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
26
npm/from-local-build.js
Normal file
26
npm/from-local-build.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2013 Lovell Fuller and others.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
'use strict';
|
||||
|
||||
// Populate contents of a single npm/sharpen-sharp-<build-platform> package
|
||||
// with the local/CI build directory for local/CI prebuild testing
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const { buildPlatformArch } = require('../lib/libvips');
|
||||
const platform = buildPlatformArch();
|
||||
const dest = path.join(__dirname, platform);
|
||||
|
||||
// Use same config as prebuild to copy binary files
|
||||
const release = path.join(__dirname, '..', 'build', 'Release');
|
||||
const prebuildrc = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '.prebuildrc'), 'utf8'));
|
||||
const include = new RegExp(prebuildrc['include-regex'], 'i');
|
||||
fs.cpSync(release, path.join(dest, 'lib'), {
|
||||
recursive: true,
|
||||
filter: (file) => {
|
||||
const name = path.basename(file);
|
||||
return name === 'Release' || include.test(name);
|
||||
}
|
||||
});
|
||||
45
npm/linux-arm/package.json
Normal file
45
npm/linux-arm/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-linux-arm",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) ARM (32-bit)",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linux-arm"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-arm.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"glibc": ">=2.28"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"arm"
|
||||
]
|
||||
}
|
||||
45
npm/linux-arm64/package.json
Normal file
45
npm/linux-arm64/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-linux-arm64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) ARM64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linux-arm64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-linux-arm64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-arm64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
45
npm/linux-x64/package.json
Normal file
45
npm/linux-x64/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-linux-x64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) x64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linux-x64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-x64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
45
npm/linuxmusl-arm64/package.json
Normal file
45
npm/linuxmusl-arm64/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-linuxmusl-arm64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Linux (musl) ARM64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linuxmusl-arm64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linuxmusl-arm64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"musl": ">=1.2.2"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
]
|
||||
}
|
||||
45
npm/linuxmusl-x64/package.json
Normal file
45
npm/linuxmusl-x64/package.json
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-linuxmusl-x64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Linux (musl) x64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linuxmusl-x64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linuxmusl-x64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0",
|
||||
"musl": ">=1.2.2"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
16
npm/package.json
Normal file
16
npm/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@sharpen/sharp",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"private": "true",
|
||||
"workspaces": [
|
||||
"darwin-x64",
|
||||
"darwin-arm64",
|
||||
"linux-arm",
|
||||
"linux-arm64",
|
||||
"linuxmusl-arm64",
|
||||
"linuxmusl-x64",
|
||||
"linux-x64",
|
||||
"win32-ia32",
|
||||
"win32-x64"
|
||||
]
|
||||
}
|
||||
41
npm/win32-ia32/package.json
Normal file
41
npm/win32-ia32/package.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-win32-ia32",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Windows x86 (32-bit)",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/win32-ia32"
|
||||
},
|
||||
"license": "Apache-2.0 AND LGPL-3.0-or-later",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-win32-ia32": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-win32-ia32.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"cpu": [
|
||||
"ia32"
|
||||
]
|
||||
}
|
||||
41
npm/win32-x64/package.json
Normal file
41
npm/win32-x64/package.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "@sharpen/sharp-win32-x64",
|
||||
"version": "0.0.1-alpha.1",
|
||||
"description": "Prebuilt sharp for use with Windows x64",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/win32-x64"
|
||||
},
|
||||
"license": "Apache-2.0 AND LGPL-3.0-or-later",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@sharpen/sharp-libvips-win32-x64": "0.0.1-alpha.1"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-win32-x64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0",
|
||||
"npm": ">=9.6.5",
|
||||
"yarn": ">=3.2.0",
|
||||
"pnpm": ">=7.1.0"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user