From 6b10dd0d0855ae63fec1f60f45032f846230cac1 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 24 Jan 2019 10:52:15 +1100 Subject: [PATCH] Tweak packaging to suit last minute .npmignore changes --- package/buildpackage.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/package/buildpackage.js b/package/buildpackage.js index 5ce8f1ef..af99fabb 100644 --- a/package/buildpackage.js +++ b/package/buildpackage.js @@ -54,13 +54,20 @@ async function packageUp() { fs.mkdirSync(nodbUtil.RELEASE_DIR, { recursive: true, mode: 0o755 }); await copyDir(nodbUtil.STAGING_DIR, nodbUtil.RELEASE_DIR); + // Don't include source code etc. in the npm package. This is + // done dynamically because .npmignore cannot exclude source code + // by default otherwise compiling from a GitHub tag or branch + // won't work. + fs.appendFileSync('.npmignore', '\n/odpi\n/src\nbinding.gyp\n/package/buildbinary.js\n/package/buildpackage.js\n'); + // Build the package execSync('npm pack'); + } catch(err) { console.error(err); } finally { - // Undo changes to package.json - execSync('git checkout package.json'); + // Undo changes to the repo + execSync('git checkout package.json .npmignore'); } }