mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Add some pre-publish hooks to help prevent bad releases
This commit is contained in:
parent
0063e13364
commit
3ede1e252e
3 changed files with 35 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,3 +7,4 @@ npm-debug.log
|
|||
gyp-mac-tool
|
||||
.node_pre_gyprc
|
||||
/.idea
|
||||
.pre-publish-info
|
||||
|
|
|
|||
30
bin/pre-publish.js
Executable file
30
bin/pre-publish.js
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var spawnSync = require('child_process').spawnSync;
|
||||
var fs = require('fs');
|
||||
var semver = require('semver');
|
||||
|
||||
// Log the packaging environment to be included in the npm bundle
|
||||
var lsExit = spawnSync('npm', ['ls']).status;
|
||||
var npmVersion = spawnSync('npm', ['-v']).stdout.toString().trim();
|
||||
|
||||
var info = {
|
||||
'versions': process.versions,
|
||||
'platform': process.platform,
|
||||
'arch': process.arch,
|
||||
'npm ls exit code': lsExit,
|
||||
'npm version': npmVersion
|
||||
};
|
||||
|
||||
fs.writeFileSync('.pre-publish-info', JSON.stringify(info, null, 2) + '\n');
|
||||
|
||||
if (lsExit !== 0) {
|
||||
console.error('ls exited with a', lsExit);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// if (!semver.gt(npmVersion, '3.0.0') && !process.env.CI) {
|
||||
// console.log('npm version must be above 3.0.0 <', npmVersion);
|
||||
// process.exit(1);
|
||||
// }
|
||||
|
||||
|
|
@ -72,10 +72,11 @@
|
|||
"mocha": "^2.4.5",
|
||||
"node-pre-gyp-github": "^1.1.2",
|
||||
"sandboxed-module": "^2.0.3",
|
||||
"semver": "^5.1.0",
|
||||
"sinon": "^1.17.3",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"bundledDependencies":[
|
||||
"bundledDependencies": [
|
||||
"node-pre-gyp"
|
||||
],
|
||||
"engines": {
|
||||
|
|
@ -92,7 +93,8 @@
|
|||
"gyp-rebuild": "node-gyp rebuild",
|
||||
"stress": "mocha --no-timeouts test/arduinoTest/stress.js",
|
||||
"grunt": "grunt",
|
||||
"test": "grunt --verbose"
|
||||
"test": "grunt --verbose",
|
||||
"prepublish": "node bin/pre-publish.js"
|
||||
},
|
||||
"gypfile": true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue