Merge pull request #7 from maxogden/npm-prune

Add prune option
This commit is contained in:
Max Ogden 2015-03-23 16:54:51 -07:00
commit 24f0476eeb
2 changed files with 19 additions and 7 deletions

View File

@ -88,13 +88,24 @@ module.exports = function packager (opts, cb) {
// copy users app into .app
ncp(opts.dir, paths.app, {filter: filter}, function copied (err) {
if (err) return cb(err)
// finally, move app into cwd
var finalPath = opts.out || process.cwd()
// TODO dont spawn, but I couldn't find a good module
child.exec('mv "' + newApp + '" "' + finalPath + '"', function moved (err) {
cb(err, path.join(finalPath, opts.name + '.app'))
})
function moveApp (err) {
if (err) return cb(err)
// finally, move app into cwd
var finalPath = opts.out || process.cwd()
// TODO dont spawn, but I couldn't find a good module
child.exec('mv "' + newApp + '" "' + finalPath + '"', function moved (err) {
cb(err, path.join(finalPath, opts.name + '.app'))
})
}
// run npm prune
if (opts.prune) {
child.exec('npm prune --production', { cwd: paths.app }, moveApp)
} else {
moveApp()
}
})
}
}

View File

@ -36,3 +36,4 @@ these are optional CLI options you can pass in
- `app-bundle-id` - bundle identifier to use in the app plist
- `helper-bundle-id` - bundle identifier to use in the app helper plist
- `ignore` (default none) - do not copy files into App whose filenames regex .match this string
- `prune` - runs `npm prune --production` on the app