Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --version to print out Packager/Node versions, target platform/arch #841

Merged
merged 1 commit into from May 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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