From 1d1a90144f80d042d504c3356a2e8331d3f7589f Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sun, 10 Nov 2019 00:42:52 +0800 Subject: [PATCH] Fix bin permissions (#6902) --- scripts/build/build.js | 2 +- scripts/build/rollup-plugins/executable.js | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/build/build.js b/scripts/build/build.js index 40add9f49..ad5c9fca8 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -99,7 +99,7 @@ async function run(params) { await execa("rm", ["-rf", ".cache"]); } - const bundleCache = new Cache(".cache/", "v18"); + const bundleCache = new Cache(".cache/", "v19"); await bundleCache.load(); console.log(chalk.inverse(" Building packages ")); diff --git a/scripts/build/rollup-plugins/executable.js b/scripts/build/rollup-plugins/executable.js index 2c60a65ee..c643c4042 100644 --- a/scripts/build/rollup-plugins/executable.js +++ b/scripts/build/rollup-plugins/executable.js @@ -6,13 +6,17 @@ const path = require("path"); module.exports = function() { let banner; let entry; + let file; return { name: "executable", - options(options) { - entry = path.resolve(options.input); - return options; + options(inputOptions) { + entry = path.resolve(inputOptions.input); + }, + + generateBundle(outputOptions) { + file = outputOptions.file; }, load(id) { @@ -36,12 +40,9 @@ module.exports = function() { } }, - writeBundle(bundle) { - if (banner) { - const files = Object.keys(bundle); - files.forEach(file => { - fs.chmodSync(bundle[file].facadeModuleId, 0o755 & ~process.umask()); - }); + writeBundle() { + if (banner && file) { + fs.chmodSync(file, 0o755 & ~process.umask()); } } };