Skip to content

Commit

Permalink
#44449: update sharp download script
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturWierzbicki committed Feb 23, 2022
1 parent 5e8b24f commit 02c5551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion scripts/download_sharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ const [
const packageJson = JSON.parse(fs.readFileSync('./package.json'))

const packageName = 'sharp';
const packageVersion = Object.entries(packageJson.dependencies).find(([depName]) => depName === packageName)[1]
const packages = Object.entries(packageJson.dependencies).find(([depName]) => depName === packageName);
if (!packages?.length) {
console.log('Sharp dependency not found')
return;
}

const packageVersion = packages[1]

console.log(`Found ${packageName} with version ${packageVersion}`)

Expand Down
8 changes: 6 additions & 2 deletions scripts/pkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ const outputNodeModules = `${outputPath}/node_modules`
childProcess.execSync(`"./node_modules/.bin/pkg" -t node14-${platform}-${arch} . --out-path ${outputPath} --no-native-build`, {stdio: 'inherit'});

childProcess.execSync(`rm -rf ${outputNodeModules}`)
fs.mkdirSync(`${outputNodeModules}/sharp`, {recursive: true})
childProcess.execSync(`cp -RP ./node_modules/sharp/build ${outputNodeModules}/sharp && cp -RP ./node_modules/sharp/vendor ${outputNodeModules}/sharp`)

const sharpExists = fs.existsSync('./node_modules/sharp')
if (sharpExists) {
fs.mkdirSync(`${outputNodeModules}/sharp`, {recursive: true})
childProcess.execSync(`cp -RP ./node_modules/sharp/build ${outputNodeModules}/sharp && cp -RP ./node_modules/sharp/vendor ${outputNodeModules}/sharp`)
}

0 comments on commit 02c5551

Please sign in to comment.