Skip to content

Commit 6089785

Browse files
committed
Add prepublish script
1 parent bcdc5e6 commit 6089785

File tree

5 files changed

+65
-16
lines changed

5 files changed

+65
-16
lines changed

.gitignore

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/profiler.node
21
build/*
32
node_modules/*
4-
.lock-wscript
5-
*.swp
6-
*.swo
7-
.DS_Store
8-
node_modules
3+
npm-debug.log

.npmignore

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
/build
2-
/node_modules
3-
/test
1+
*.log
2+
build/!(profiler)
3+
node_modules
4+
test
5+
v8-profiler-*.tgz
6+
.gitattributes
47
.gitignore
58
.npmignore
69
.travis.yml
10+
appveyor.yml

.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ before_install:
3232
export CXX=/usr/bin/g++-4.9;
3333
fi
3434

35+
- if [ $NODE_VERSION == "0.10" ]; then
36+
npm -g install npm@latest-2;
37+
fi
38+
3539
- rm -rf ~/.nvm/ && git clone --depth 1 "https://github.com/creationix/nvm.git" ~/.nvm
3640
- source ~/.nvm/nvm.sh
3741
- nvm install $NODE_VERSION

package.json

+10-7
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
],
2020
"license": "BSD-2-Clause",
2121
"binary": {
22-
"module_name" : "profiler",
23-
"module_path" : "./build/{module_name}/v{version}/{node_abi}-{platform}-{arch}/",
24-
"remote_path" : "./{module_name}/v{version}/",
22+
"module_name": "profiler",
23+
"module_path": "./build/{module_name}/v{version}/{node_abi}-{platform}-{arch}/",
24+
"remote_path": "./{module_name}/v{version}/",
2525
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
26-
"host" : "https://node-inspector.s3.amazonaws.com/"
26+
"host": "https://node-inspector.s3.amazonaws.com/"
2727
},
2828
"keywords": [
2929
"profiler",
@@ -39,12 +39,15 @@
3939
},
4040
"devDependencies": {
4141
"aws-sdk": "^2.0.0",
42+
"chai": "^1.9.1",
4243
"mocha": "^1.20.1",
43-
"chai": "^1.9.1"
44+
"rimraf": "^2.4.4"
4445
},
4546
"scripts": {
46-
"preinstall": " ",
47+
"preinstall": "node -e 'process.exit(0)'",
48+
"prepublish": "node ./tools/prepublish.js",
4749
"install": "node-pre-gyp install --fallback-to-build",
48-
"test": "mocha"
50+
"rebuild": "node-pre-gyp rebuild",
51+
"test": "mocha --debug"
4952
}
5053
}

tools/prepublish.js

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

0 commit comments

Comments
 (0)