Skip to content

Commit a127a61

Browse files
firededevelar
authored andcommitted
fix(electron-builder): Configuring yargs through package.json is deprecated #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
1 parent 5308531 commit a127a61

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/electron-builder/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,5 @@
6363
"typings": "./out/index.d.ts",
6464
"publishConfig": {
6565
"tag": "next"
66-
},
67-
"yargs": {
68-
"camel-case-expansion": false
6966
}
7067
}

packages/electron-builder/src/builder.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,7 @@ export function build(rawOptions?: CliOptions): Promise<Array<string>> {
235235
export function configureBuildCommand(yargs: yargs.Argv): yargs.Argv {
236236
const publishGroup = "Publishing:"
237237
const buildGroup = "Building:"
238-
const deprecated = "Deprecated:";
239-
240-
(yargs as any).parserConfiguration({
241-
"camel-case-expansion": false,
242-
})
238+
const deprecated = "Deprecated:"
243239

244240
return yargs
245241
.option("mac", {

packages/electron-builder/src/cli/cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { start } from "./start"
1717

1818
// tslint:disable:no-unused-expression
1919
yargs
20+
.parserConfiguration({
21+
"camel-case-expansion": false,
22+
})
2023
.command(["build", "*"], "Build", configureBuildCommand, wrap(build))
2124
.command("install-app-deps", "Install app deps", configureInstallAppDepsCommand, wrap(installAppDeps))
2225
.command("node-gyp-rebuild", "Rebuild own native code", configureInstallAppDepsCommand /* yes, args the same as for install app deps */, wrap(rebuildAppNativeCode))

packages/electron-builder/src/cli/install-app-deps.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export function configureInstallAppDepsCommand(yargs: yargs.Argv): yargs.Argv {
1919
// https://github.com/yargs/yargs/issues/760
2020
// demandOption is required to be set
2121
return yargs
22+
.parserConfiguration({
23+
"camel-case-expansion": false,
24+
})
2225
.option("platform", {
2326
choices: ["linux", "darwin", "win32"],
2427
default: process.platform,

test/src/BuildTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test("cli", async () => {
1212
// because these methods are internal
1313
const { configureBuildCommand, normalizeOptions } = require("electron-builder/out/builder")
1414
const yargs = require("yargs")
15+
yargs.parserConfiguration({"camel-case-expansion": false})
1516
configureBuildCommand(yargs)
1617

1718
function parse(input: string): any {

0 commit comments

Comments
 (0)