Skip to content

Commit 06b9bf3

Browse files
committed
Add prepublish script
1 parent 88334ce commit 06b9bf3

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.log
2+
build/!(debug)
23
node_modules
34
test
45
v8-debug-*.tgz

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
},
3939
"scripts": {
4040
"preinstall": "node -e 'process.exit(0)'",
41+
"prepublish": "node ./tools/prepublish.js",
4142
"install": "node-pre-gyp install --fallback-to-build",
4243
"rebuild": "node-pre-gyp rebuild",
4344
"test": "mocha --debug"

tools/prepublish.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
if (process.env.CI) process.exit(0);
2+
3+
var extend = require('util')._extend;
4+
var gyp = require('node-pre-gyp');
5+
6+
var versions = ['0.10.0', '0.12.0', '4.0.0', '5.0.0'];
7+
var matrix = {
8+
x64: ['win32', 'linux', 'darwin'],
9+
ia32: ['win32']
10+
};
11+
12+
var targets = [];
13+
Object.keys(matrix).forEach(function(arch) {
14+
matrix[arch].forEach(function(platform) {
15+
versions.forEach(function(version) {
16+
targets.push({
17+
target: version,
18+
target_platform: platform,
19+
target_arch: arch
20+
});
21+
});
22+
});
23+
}, []);
24+
25+
iterate();
26+
27+
function iterate(err) {
28+
if (err) {
29+
console.log(err.message);
30+
return process.exit(1);
31+
}
32+
33+
var target = targets.pop();
34+
35+
if (!target) process.exit(0);
36+
37+
var prog = extend(new gyp.Run(), {opts: target});
38+
39+
prog.commands.install([], iterate);
40+
}

0 commit comments

Comments
 (0)