Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add prepublish script
  • Loading branch information
3y3 committed Dec 6, 2015
1 parent bcdc5e6 commit 3638152
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 16 deletions.
7 changes: 1 addition & 6 deletions .gitignore
@@ -1,8 +1,3 @@
/profiler.node
build/*
node_modules/*
.lock-wscript
*.swp
*.swo
.DS_Store
node_modules
npm-debug.log
10 changes: 7 additions & 3 deletions .npmignore
@@ -1,6 +1,10 @@
/build
/node_modules
/test
*.log
build/!(profiler)
node_modules
test
v8-profiler-*.tgz
.gitattributes
.gitignore
.npmignore
.travis.yml
appveyor.yml
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -37,6 +37,10 @@ before_install:
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION

- if [ $NODE_VERSION == "0.10" ]; then
npm -g install npm@latest-2;
fi

- export PATH="./node_modules/.bin/:$PATH"

- PUBLISH_BINARY=false
Expand Down
17 changes: 10 additions & 7 deletions package.json
Expand Up @@ -19,11 +19,11 @@
],
"license": "BSD-2-Clause",
"binary": {
"module_name" : "profiler",
"module_path" : "./build/{module_name}/v{version}/{node_abi}-{platform}-{arch}/",
"remote_path" : "./{module_name}/v{version}/",
"module_name": "profiler",
"module_path": "./build/{module_name}/v{version}/{node_abi}-{platform}-{arch}/",
"remote_path": "./{module_name}/v{version}/",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz",
"host" : "https://node-inspector.s3.amazonaws.com/"
"host": "https://node-inspector.s3.amazonaws.com/"
},
"keywords": [
"profiler",
Expand All @@ -39,12 +39,15 @@
},
"devDependencies": {
"aws-sdk": "^2.0.0",
"chai": "^1.9.1",
"mocha": "^1.20.1",
"chai": "^1.9.1"
"rimraf": "^2.4.4"
},
"scripts": {
"preinstall": " ",
"preinstall": "node -e 'process.exit(0)'",
"prepublish": "node ./tools/prepublish.js",
"install": "node-pre-gyp install --fallback-to-build",
"test": "mocha"
"rebuild": "node-pre-gyp rebuild",
"test": "mocha --debug"
}
}
43 changes: 43 additions & 0 deletions tools/prepublish.js
@@ -0,0 +1,43 @@
if (process.env.CI) process.exit(0);

var rimraf = require('rimraf');
var extend = require('util')._extend;
var gyp = require('node-pre-gyp');

rimraf.sync('./build');

var versions = ['0.10.0', '0.12.0', '4.0.0', '5.0.0'];
var matrix = {
x64: ['win32', 'linux', 'darwin'],
ia32: ['win32']
};

var targets = [];
Object.keys(matrix).forEach(function(arch) {
matrix[arch].forEach(function(platform) {
versions.forEach(function(version) {
targets.push({
target: version,
target_platform: platform,
target_arch: arch
});
});
});
}, []);

iterate();

function iterate(err) {
if (err) {
console.log(err.message);
return process.exit(1);
}

var target = targets.pop();

if (!target) process.exit(0);

var prog = extend(new gyp.Run(), {opts: target});

prog.commands.install([], iterate);
}

0 comments on commit 3638152

Please sign in to comment.