Skip to content

Commit 1ad2a82

Browse files
committed
Minor clean-ups and fixes
1 parent ea4103d commit 1ad2a82

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dependencies": {
5252
"async": "^2.1.2",
5353
"download-manager": "^0.1.3",
54-
"fs-extra": "^0.30.0",
54+
"fs-extra": "^1.0.0",
5555
"prebuild-install": "1.0.2"
5656
},
5757
"devDependencies": {

scripts/adjustEnvVars.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ while getopts ":b:c:M:" opt; do
2828

2929
:)
3030
echo "Option -$OPTARG requires an argument." >&2
31-
exit 1
31+
exit 2
3232
;;
3333
esac
3434
done

scripts/prepublish

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
#!/usr/bin/env node
22

3-
// Reset the generic bin symlinks before publishing to npm sothey point to the
4-
// native platform libraries
3+
/**
4+
* Reset the generic bin symlinks before publishing to npm so they point to the
5+
* native platform libraries
6+
*/
57

68
const fs = require('fs')
79

810

9-
const DIR = 'bin'
10-
const bins = Object.keys(require('../package.json').bin)
11-
const bypass = fs.readFileSync('bypass.js')
12-
13-
1411
// http://stackoverflow.com/a/34597104/586382
1512
// By design, NPM will run prepublish script after `npm install` (see
1613
// [npm docs](https://docs.npmjs.com/misc/scripts))
1714
// This trick ensures that when script is executed using `npm <whatever>` it is
1815
// run only when the command is `npm publish`.
1916
const npm_config_argv = process.env.npm_config_argv
20-
if(npm_config_argv && JSON.parse(npm_config_argv).original[0] === 'publish')
17+
if(npm_config_argv && JSON.parse(npm_config_argv).original[0] === 'publish'
18+
|| process.argv[2] === '--force')
19+
{
20+
const DIR = 'bin'
21+
2122
fs.mkdir(DIR, function(err)
2223
{
2324
if(err && err.code !== 'EEXIST') throw err
2425

25-
// Re-create the symlinks stubs
26-
bins.forEach(function(file)
26+
fs.readFile('bypass.js', function(err, bypass)
2727
{
28-
fs.writeFileSync(DIR+'/'+file, bypass, {mode: 0o755})
28+
if(err) throw err
29+
30+
// Re-create the symlinks stubs
31+
Object.keys(require('../package.json').bin).forEach(function(file)
32+
{
33+
fs.writeFileSync(DIR+'/'+file, bypass, {mode: 0o755})
34+
})
2935
})
3036
})
37+
}

scripts/unbuild

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env sh
22

33
rm -rf build/ deps/
4-
rm -rf bin/ lib/ libexec/ share/ *-nodeos-linux-musl/
4+
rm -rf bin/ lib/ libexec/ share/ *-nodeos-linux-*/
5+
6+
npm run prepublish -- --force

0 commit comments

Comments
 (0)