Skip to content

Commit

Permalink
fix(electron-builder): Configuring yargs through package.json is depr…
Browse files Browse the repository at this point in the history
…ecated #3751

1. remove `yargs` field from `package.json`.
2. upgrade `@types/yargs` for better type definitions.
3. move `parserConfiguration` to the entry point for every "bin".

Close #3751
  • Loading branch information
firede authored and develar committed May 9, 2019
1 parent 5308531 commit a127a61
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
3 changes: 0 additions & 3 deletions packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,5 @@
"typings": "./out/index.d.ts",
"publishConfig": {
"tag": "next"
},
"yargs": {
"camel-case-expansion": false
}
}
6 changes: 1 addition & 5 deletions packages/electron-builder/src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,7 @@ export function build(rawOptions?: CliOptions): Promise<Array<string>> {
export function configureBuildCommand(yargs: yargs.Argv): yargs.Argv {
const publishGroup = "Publishing:"
const buildGroup = "Building:"
const deprecated = "Deprecated:";

(yargs as any).parserConfiguration({
"camel-case-expansion": false,
})
const deprecated = "Deprecated:"

return yargs
.option("mac", {
Expand Down
3 changes: 3 additions & 0 deletions packages/electron-builder/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { start } from "./start"

// tslint:disable:no-unused-expression
yargs
.parserConfiguration({
"camel-case-expansion": false,
})
.command(["build", "*"], "Build", configureBuildCommand, wrap(build))
.command("install-app-deps", "Install app deps", configureInstallAppDepsCommand, wrap(installAppDeps))
.command("node-gyp-rebuild", "Rebuild own native code", configureInstallAppDepsCommand /* yes, args the same as for install app deps */, wrap(rebuildAppNativeCode))
Expand Down
3 changes: 3 additions & 0 deletions packages/electron-builder/src/cli/install-app-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export function configureInstallAppDepsCommand(yargs: yargs.Argv): yargs.Argv {
// https://github.com/yargs/yargs/issues/760
// demandOption is required to be set
return yargs
.parserConfiguration({
"camel-case-expansion": false,
})
.option("platform", {
choices: ["linux", "darwin", "win32"],
default: process.platform,
Expand Down
1 change: 1 addition & 0 deletions test/src/BuildTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test("cli", async () => {
// because these methods are internal
const { configureBuildCommand, normalizeOptions } = require("electron-builder/out/builder")
const yargs = require("yargs")
yargs.parserConfiguration({"camel-case-expansion": false})
configureBuildCommand(yargs)

function parse(input: string): any {
Expand Down

0 comments on commit a127a61

Please sign in to comment.