Skip to content

Commit 54d0ff4

Browse files
committed
Fixed badly binded function on prepublish script
1 parent acb967d commit 54d0ff4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/prepublish

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ const fs = require('fs')
66
const TRUNCATE_DIR = 'bin'
77

88

9+
function truncateFile(file)
10+
{
11+
fs.truncateSync(TRUNCATE_DIR+'/'+file, 0)
12+
}
13+
14+
915
// http://stackoverflow.com/a/34597104/586382
1016
// NPM will run prepublish script after `npm install`
1117
// (https://docs.npmjs.com/misc/scripts). This ensures that when script is
@@ -16,5 +22,5 @@ if(npm_config_argv && JSON.parse(npm_config_argv).original[0] === 'publish')
1622
{
1723
if(err) throw err
1824

19-
files.forEach(fs.truncateSync.bind(fs, TRUNCATE_DIR+'/'+file, 0))
25+
files.forEach(truncateFile)
2026
})

0 commit comments

Comments
 (0)