How to use the app-builder-lib/out/util/config.computeDefaultAppDirectory function in app-builder-lib

To help you get started, we’ve selected a few app-builder-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-builder / packages / electron-builder / src / cli / install-app-deps.ts View on Github external
export async function installAppDeps(args: any) {
  try {
    log.info({version: PACKAGE_VERSION}, "electron-builder")
  }
  catch (e) {
    // error in dev mode without babel
    if (!(e instanceof ReferenceError)) {
      throw e
    }
  }

  const projectDir = process.cwd()
  const packageMetadata = new Lazy(() => orNullIfFileNotExist(readJson(path.join(projectDir, "package.json"))))
  const config = await getConfig(projectDir, null, null, packageMetadata)
  const results = await Promise.all([
    computeDefaultAppDirectory(projectDir, use(config.directories, it => it!.app)),
    getElectronVersion(projectDir, config, packageMetadata),
  ])

  // if two package.json — force full install (user wants to install/update app deps in addition to dev)
  await installOrRebuild(config, results[0], {
    frameworkInfo: {version: results[1], useCustomDist: true},
    platform: args.platform,
    arch: args.arch,
    productionDeps: createLazyProductionDeps(results[0], null),
  }, results[0] !== projectDir)
}