From 825bfffd21ab7c46bb0968116437d1753bcbb696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Tue, 12 Feb 2019 06:15:51 -0800 Subject: [PATCH] create one headless file for all platforms Summary: We are distributing a single package via fbpkg containing the headless version linux and macOS. This changes the build process to only create a single zip-file containing these binaries. Reviewed By: passy Differential Revision: D14042031 fbshipit-source-id: 88992f17501353a70bc21799c6bd2957576268a3 --- scripts/build-headless.js | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/scripts/build-headless.js b/scripts/build-headless.js index 416fe744d..b86a82e9c 100644 --- a/scripts/build-headless.js +++ b/scripts/build-headless.js @@ -32,31 +32,30 @@ function preludeBundle(dir, versionNumber) { } async function createZip(buildDir, distDir, targets) { - return Promise.all( - targets.map( - target => - new Promise((resolve, reject) => { - const zip = new yazl.ZipFile(); - const binary = `flipper-${target === 'mac' ? 'macos' : target}`; - zip.addFile(path.join(buildDir, binary), binary); - const pluginDir = path.join(buildDir, PLUGINS_FOLDER_NAME); - fs.readdirSync(pluginDir).forEach(file => { - zip.addFile( - path.join(pluginDir, file), - path.join(PLUGINS_FOLDER_NAME, file), - ); - }); - zip.outputStream - .pipe( - fs.createWriteStream( - path.join(distDir, `Flipper-headless-${target}.zip`), - ), - ) - .on('close', resolve); - zip.end(); - }), - ), - ); + return new Promise((resolve, reject) => { + const zip = new yazl.ZipFile(); + + // add binaries for each target + targets.forEach(target => { + const binary = `flipper-${target === 'mac' ? 'macos' : target}`; + zip.addFile(path.join(buildDir, binary), binary); + }); + + // add plugins + const pluginDir = path.join(buildDir, PLUGINS_FOLDER_NAME); + fs.readdirSync(pluginDir).forEach(file => { + zip.addFile( + path.join(pluginDir, file), + path.join(PLUGINS_FOLDER_NAME, file), + ); + }); + + // write zip file + zip.outputStream + .pipe(fs.createWriteStream(path.join(distDir, `Flipper-headless.zip`))) + .on('close', resolve); + zip.end(); + }); } (async () => {