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qBAAI,IAAJ,CAAS,6DAAT;;AACA,EAAA,IAAI,GACD,KADH,CACS,4BADT;AAED,C","sourcesContent":["#! /usr/bin/env node\n\nimport { log, use, getArchCliNames } from \"builder-util\"\nimport { printErrorAndExit } from \"builder-util/out/promise\"\nimport { computeDefaultAppDirectory, getConfig } from \"app-builder-lib/out/util/config\"\nimport { getElectronVersion } from \"app-builder-lib/out/electron/electronVersion\"\nimport { createLazyProductionDeps } from \"app-builder-lib/out/util/packageDependencies\"\nimport { installOrRebuild } from \"app-builder-lib/out/util/yarn\"\nimport { readJson } from \"fs-extra-p\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { orNullIfFileNotExist } from \"read-config-file\"\nimport yargs from \"yargs\"\n\ndeclare const PACKAGE_VERSION: string\n\n/** @internal */\nexport function configureInstallAppDepsCommand(yargs: yargs.Yargs): yargs.Yargs {\n  // https://github.com/yargs/yargs/issues/760\n  // demandOption is required to be set\n  return yargs\n    .option(\"platform\", {\n      choices: [\"linux\", \"darwin\", \"win32\"],\n      default: process.platform,\n      description: \"The target platform\",\n    })\n    .option(\"arch\", {\n      choices: getArchCliNames().concat(\"all\"),\n      default: process.arch === \"arm\" ? \"armv7l\" : process.arch,\n      description: \"The target arch\",\n    })\n}\n\n/** @internal */\nexport async function installAppDeps(args: any) {\n  try {\n    log.info({version: PACKAGE_VERSION}, \"electron-builder\")\n  }\n  catch (e) {\n    // error in dev mode without babel\n    if (!(e instanceof ReferenceError)) {\n      throw e\n    }\n  }\n\n  const projectDir = process.cwd()\n  const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, \"package.json\"))))\n  const config = await getConfig(projectDir, null, null, packageMetadata)\n  const muonVersion = config.muonVersion\n  const results = await Promise.all<string>([\n    computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),\n    muonVersion == null ? getElectronVersion(projectDir, config, packageMetadata) : Promise.resolve(muonVersion),\n  ])\n\n  // if two package.json — force full install (user wants to install/update app deps in addition to dev)\n  await installOrRebuild(config, results[0], {\n    frameworkInfo: {version: results[1], useCustomDist: muonVersion == null},\n    platform: args.platform,\n    arch: args.arch,\n    productionDeps: createLazyProductionDeps(results[0]),\n  }, results[0] !== projectDir)\n}\n\nfunction main() {\n  return installAppDeps(configureInstallAppDepsCommand(yargs).argv)\n}\n\nif (process.mainModule === module) {\n  log.warn(\"please use as subcommand: electron-builder install-app-deps\")\n  main()\n    .catch(printErrorAndExit)\n}"],"sourceRoot":""}