Skip to content

Commit 5f75ec8

Browse files
committed
beef up "npm run pack"
Now also properly rebuilds contents after install. Should work well for Windows!
1 parent 3bc907f commit 5f75ec8

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"bin": "index.js",
77
"scripts": {
8-
"pack": "npm dedupe && find . -type file | grep -v workshop.tar.gz | grep -v .git | tar -cvzf ./workshop.tar.gz -T -",
8+
"pack": "rm -rf node_modules && npm install && npm dedupe && node prepack && find . -type file | grep -v workshop.tar.gz | grep -v .git | tar -cvzf ./workshop.tar.gz -T - && node postpack",
99
"test": "echo \"Error: no test specified\" && exit 1",
1010
"start": "mkdir answers; cd answers && NODE_ENV=development node .."
1111
},
@@ -71,4 +71,4 @@
7171
"wordwrap": "0.0.2",
7272
"xhr": "^1.9.0"
7373
}
74-
}
74+
}

postpack.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var fs = require('fs')
2+
3+
var pkg = JSON.parse(fs.readFileSync(
4+
__dirname + '/package.json'
5+
, 'utf8'))
6+
7+
delete pkg.scripts.postinstall
8+
9+
fs.writeFileSync(__dirname + '/package.json', JSON.stringify(pkg, null, 2))

prepack.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var fs = require('fs')
2+
3+
var pkg = JSON.parse(fs.readFileSync(
4+
__dirname + '/package.json'
5+
, 'utf8'))
6+
7+
pkg.scripts.postinstall = 'npm rebuild --prefix ./'
8+
9+
fs.writeFileSync(__dirname + '/package.json', JSON.stringify(pkg, null, 2))

0 commit comments

Comments
 (0)