Skip to content

Commit

Permalink
Add --version to print out Packager/Node versions, target platform/arch
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed May 13, 2018
1 parent b7b06d9 commit 3ba8d69
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions cli.js
Expand Up @@ -34,6 +34,12 @@ function printUsageAndExit (isError) {

if (args.help) {
printUsageAndExit(false)
} else if (args.version) {
if (typeof args.version !== 'boolean') {
console.error('--version does not take an argument. Perhaps you meant --app-version or --electron-version?\n')
}
console.log(common.hostInfo())
process.exit(0)
} else if (!args.dir) {
printUsageAndExit(true)
}
Expand Down
6 changes: 6 additions & 0 deletions common.js
@@ -1,5 +1,6 @@
'use strict'

const metadata = require('./package.json')
const os = require('os')
const path = require('path')
const sanitize = require('sanitize-filename')
Expand Down Expand Up @@ -149,6 +150,11 @@ module.exports = {
return pathToNormalize.replace(/\\/g, '/')
},

hostInfo: function hostInfo () {
return `Electron Packager ${metadata.version}\n` +
`Node ${process.version}\n` +
`Host Operating system: ${process.platform} (${process.arch})`
},
info: info,
warning: warning
}
5 changes: 1 addition & 4 deletions index.js
Expand Up @@ -8,16 +8,13 @@ const fs = require('fs-extra')
const getMetadataFromPackageJSON = require('./infer')
const hooks = require('./hooks')
const ignore = require('./ignore')
const metadata = require('./package.json')
const nodeify = require('nodeify')
const path = require('path')
const pify = require('pify')
const targets = require('./targets')

function debugHostInfo () {
debug(`Electron Packager ${metadata.version}`)
debug(`Node ${process.version}`)
debug(`Host Operating system: ${process.platform} (${process.arch})`)
debug(common.hostInfo())
}

class Packager {
Expand Down
9 changes: 7 additions & 2 deletions usage.txt
@@ -1,17 +1,22 @@
Usage: electron-packager <sourcedir> <appname> [options...]

Required options
Required parameters

sourcedir the base directory of the application source

Examples: electron-packager ./
electron-packager ./ --all

Optional options
Optional parameters

appname the name of the app, if it needs to be different from the "productName" or "name"
in the nearest package.json

Options

version prints the version of Electron Packager and Node, plus the target platform and
arch, for bug reporting purposes, and exits immediately

* All platforms *

all equivalent to --platform=all --arch=all
Expand Down

0 comments on commit 3ba8d69

Please sign in to comment.