2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-16 18:15:08 +00:00

Add prune option

Fixes GH-4
This commit is contained in:
Zach Bruggeman 2015-03-23 14:58:28 -07:00
parent da320cc264
commit 90b7cbb334
2 changed files with 19 additions and 7 deletions

View File

@ -89,12 +89,23 @@ module.exports = function packager (opts, cb) {
ncp(opts.dir, paths.app, {filter: filter}, function copied (err) { ncp(opts.dir, paths.app, {filter: filter}, function copied (err) {
if (err) return cb(err) if (err) return cb(err)
function moveApp (err) {
if (err) return cb(err)
// finally, move app into cwd // finally, move app into cwd
var finalPath = opts.out || process.cwd() var finalPath = opts.out || process.cwd()
// TODO dont spawn, but I couldn't find a good module // TODO dont spawn, but I couldn't find a good module
child.exec('mv "' + newApp + '" "' + finalPath + '"', function moved (err) { child.exec('mv "' + newApp + '" "' + finalPath + '"', function moved (err) {
cb(err, path.join(finalPath, opts.name + '.app')) 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 - `app-bundle-id` - bundle identifier to use in the app plist
- `helper-bundle-id` - bundle identifier to use in the app helper 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 - `ignore` (default none) - do not copy files into App whose filenames regex .match this string
- `prune` - runs `npm prune --production` on the app