Skip to content

Commit 6b10dd0

Browse files
committed
Tweak packaging to suit last minute .npmignore changes
1 parent 06e5144 commit 6b10dd0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

package/buildpackage.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,20 @@ async function packageUp() {
5454
fs.mkdirSync(nodbUtil.RELEASE_DIR, { recursive: true, mode: 0o755 });
5555
await copyDir(nodbUtil.STAGING_DIR, nodbUtil.RELEASE_DIR);
5656

57+
// Don't include source code etc. in the npm package. This is
58+
// done dynamically because .npmignore cannot exclude source code
59+
// by default otherwise compiling from a GitHub tag or branch
60+
// won't work.
61+
fs.appendFileSync('.npmignore', '\n/odpi\n/src\nbinding.gyp\n/package/buildbinary.js\n/package/buildpackage.js\n');
62+
5763
// Build the package
5864
execSync('npm pack');
65+
5966
} catch(err) {
6067
console.error(err);
6168
} finally {
62-
// Undo changes to package.json
63-
execSync('git checkout package.json');
69+
// Undo changes to the repo
70+
execSync('git checkout package.json .npmignore');
6471
}
6572
}
6673

0 commit comments

Comments
 (0)