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as chalk from \"chalk\"\nimport { build as _build, Configuration, DIR_TARGET, Packager, PackagerOptions, Platform } from \"app-builder-lib\"\nimport { PublishOptions } from \"electron-publish\"\nimport * as yargs from \"yargs\"\n\nexport function createYargs(): yargs.Argv {\n return yargs.parserConfiguration({\n \"camel-case-expansion\": false,\n })\n}\n\nexport interface BuildOptions extends PackagerOptions, PublishOptions {}\n\nexport interface CliOptions extends PackagerOptions, PublishOptions {\n x64?: boolean\n ia32?: boolean\n armv7l?: boolean\n arm64?: boolean\n universal?: boolean\n\n dir?: boolean\n}\n\n/** @private */\nexport function normalizeOptions(args: CliOptions): BuildOptions {\n if (args.targets != null) {\n return args\n }\n\n const targets = new Map>>()\n\n function processTargets(platform: Platform, types: Array) {\n function commonArch(currentIfNotSpecified: boolean): Array {\n const result = Array()\n if (args.x64) {\n result.push(Arch.x64)\n }\n if (args.armv7l) {\n result.push(Arch.armv7l)\n }\n if (args.arm64) {\n result.push(Arch.arm64)\n }\n if (args.ia32) {\n result.push(Arch.ia32)\n }\n if (args.universal) {\n result.push(Arch.universal)\n }\n\n return result.length === 0 && currentIfNotSpecified ? [archFromString(process.arch)] : result\n }\n\n let archToType = targets.get(platform)\n if (archToType == null) {\n archToType = new Map>()\n targets.set(platform, archToType)\n }\n\n if (types.length === 0) {\n const defaultTargetValue = args.dir ? [DIR_TARGET] : []\n for (const arch of commonArch(args.dir === true)) {\n archToType.set(arch, defaultTargetValue)\n }\n return\n }\n\n for (const type of types) {\n const suffixPos = type.lastIndexOf(\":\")\n if (suffixPos > 0) {\n addValue(archToType, archFromString(type.substring(suffixPos + 1)), type.substring(0, suffixPos))\n } else {\n for (const arch of commonArch(true)) {\n addValue(archToType, arch, type)\n }\n }\n }\n }\n\n if (args.mac != null) {\n processTargets(Platform.MAC, args.mac)\n }\n\n if (args.linux != null) {\n processTargets(Platform.LINUX, args.linux)\n }\n\n if (args.win != null) {\n processTargets(Platform.WINDOWS, args.win)\n }\n\n if (targets.size === 0) {\n processTargets(Platform.current(), [])\n }\n\n const result: any = { ...args }\n result.targets = targets\n\n delete result.dir\n delete result.mac\n delete result.linux\n delete result.win\n\n const r = result\n delete r.m\n delete r.o\n delete r.l\n delete r.w\n delete r.windows\n delete r.macos\n delete r.$0\n delete r._\n delete r.version\n delete r.help\n delete r.c\n delete r.p\n delete r.pd\n\n delete result.ia32\n delete result.x64\n delete result.armv7l\n delete result.arm64\n delete result.universal\n\n let config = result.config\n\n // config is array when combining dot-notation values with a config file value\n // https://github.com/electron-userland/electron-builder/issues/2016\n if (Array.isArray(config)) {\n const newConfig: Configuration = {}\n for (const configItem of config) {\n if (typeof configItem === \"object\") {\n deepAssign(newConfig, configItem)\n } else if (typeof configItem === \"string\") {\n newConfig.extends = configItem\n }\n }\n\n config = newConfig\n result.config = newConfig\n }\n\n // AJV cannot coerce \"null\" string to null if string is also allowed (because null string is a valid value)\n if (config != null && typeof config !== \"string\") {\n if (config.extraMetadata != null) {\n coerceTypes(config.extraMetadata)\n }\n\n // ability to disable code sign using -c.mac.identity=null\n if (config.mac != null) {\n coerceValue(config.mac, \"identity\")\n }\n\n // fix Boolean type by coerceTypes\n if (config.nsis != null) {\n coerceTypes(config.nsis)\n }\n if (config.nsisWeb != null) {\n coerceTypes(config.nsisWeb)\n }\n }\n\n if (\"project\" in r && !(\"projectDir\" in result)) {\n result.projectDir = r.project\n }\n delete r.project\n\n return result as BuildOptions\n}\n\nfunction coerceValue(host: any, key: string): void {\n const value = host[key]\n if (value === \"true\") {\n host[key] = true\n } else if (value === \"false\") {\n host[key] = false\n } else if (value === \"null\") {\n host[key] = null\n } else if (key === \"version\" && typeof value === \"number\") {\n host[key] = value.toString()\n } else if (value != null && typeof value === \"object\") {\n coerceTypes(value)\n }\n}\n\n/** @private */\nexport function coerceTypes(host: any): any {\n for (const key of Object.getOwnPropertyNames(host)) {\n coerceValue(host, key)\n }\n return host\n}\n\nexport function createTargets(platforms: Array, type?: string | null, arch?: string | null): Map>> {\n const targets = new Map>>()\n for (const platform of platforms) {\n const archs =\n arch === \"all\" ? (platform === Platform.MAC ? [Arch.x64, Arch.arm64, Arch.universal] : [Arch.x64, Arch.ia32]) : [archFromString(arch == null ? process.arch : arch)]\n const archToType = new Map>()\n targets.set(platform, archToType)\n\n for (const arch of archs) {\n archToType.set(arch, type == null ? [] : [type])\n }\n }\n return targets\n}\n\nexport function build(rawOptions?: CliOptions): Promise> {\n const buildOptions = normalizeOptions(rawOptions || {})\n return _build(buildOptions, new Packager(buildOptions))\n}\n\n/**\n * @private\n */\nexport function configureBuildCommand(yargs: yargs.Argv): yargs.Argv {\n const publishGroup = \"Publishing:\"\n const buildGroup = \"Building:\"\n return yargs\n .option(\"mac\", {\n group: buildGroup,\n alias: [\"m\", \"o\", \"macos\"],\n description: `Build for macOS, accepts target list (see ${chalk.underline(\"https://goo.gl/5uHuzj\")}).`,\n type: \"array\",\n })\n .option(\"linux\", {\n group: buildGroup,\n alias: \"l\",\n description: `Build for Linux, accepts target list (see ${chalk.underline(\"https://goo.gl/4vwQad\")})`,\n type: \"array\",\n })\n .option(\"win\", {\n group: buildGroup,\n alias: [\"w\", \"windows\"],\n description: `Build for Windows, accepts target list (see ${chalk.underline(\"https://goo.gl/jYsTEJ\")})`,\n type: \"array\",\n })\n .option(\"x64\", {\n group: buildGroup,\n description: \"Build for x64\",\n type: \"boolean\",\n })\n .option(\"ia32\", {\n group: buildGroup,\n description: \"Build for ia32\",\n type: \"boolean\",\n })\n .option(\"armv7l\", {\n group: buildGroup,\n description: \"Build for armv7l\",\n type: \"boolean\",\n })\n .option(\"arm64\", {\n group: buildGroup,\n description: \"Build for arm64\",\n type: \"boolean\",\n })\n .option(\"universal\", {\n group: buildGroup,\n description: \"Build for universal\",\n type: \"boolean\",\n })\n .option(\"dir\", {\n group: buildGroup,\n description: \"Build unpacked dir. Useful to test.\",\n type: \"boolean\",\n })\n .option(\"publish\", {\n group: publishGroup,\n alias: \"p\",\n description: `Publish artifacts, see ${chalk.underline(\"https://goo.gl/tSFycD\")}`,\n choices: [\"onTag\", \"onTagOrDraft\", \"always\", \"never\", undefined as any],\n })\n .option(\"prepackaged\", {\n alias: [\"pd\"],\n group: buildGroup,\n description: \"The path to prepackaged app (to pack in a distributable format)\",\n })\n .option(\"projectDir\", {\n alias: [\"project\"],\n group: buildGroup,\n description: \"The path to project directory. Defaults to current working directory.\",\n })\n .option(\"config\", {\n alias: [\"c\"],\n group: buildGroup,\n description:\n \"The path to an electron-builder config. Defaults to `electron-builder.yml` (or `json`, or `json5`, or `js`, or `ts`), see \" + chalk.underline(\"https://goo.gl/YFRJOM\"),\n })\n .group([\"help\", \"version\"], \"Other:\")\n .example(\"electron-builder -mwl\", \"build for macOS, Windows and Linux\")\n .example(\"electron-builder --linux deb tar.xz\", \"build deb and tar.xz for Linux\")\n .example(\"electron-builder --win --ia32\", \"build for Windows ia32\")\n .example(\"electron-builder -c.extraMetadata.foo=bar\", \"set package.json property `foo` to `bar`\")\n .example(\"electron-builder --config.nsis.unicode=false\", \"configure unicode options for NSIS\")\n}\n"]}