<commit_before>import { execFile, spawn as _spawn, ChildProcess, SpawnOptions } from "child_process"
import { Promise as BluebirdPromise } from "bluebird"
import { homedir } from "os"
import * as path from "path"
import { readJson, stat, Stats, unlink } from "fs-extra-p"
import { yellow, red } from "chalk"
import debugFactory = require("debug")
import { warn, task, log } from "./log"
import { createHash } from "crypto"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./awaiter")

export const debug = debugFactory("electron-builder")
export const debug7z = debugFactory("electron-builder:7z")

const DEFAULT_APP_DIR_NAMES = ["app", "www"]

export function installDependencies(appDir: string, electronVersion: string, arch: string = process.arch, command: string = "install"): BluebirdPromise<any> {
  const gypHome = path.join(homedir(), ".electron-gyp")
  return task(`${(command === "install" ? "Installing" : "Rebuilding")} app dependencies for arch ${arch} to ${appDir}`, spawnNpmProduction(command, appDir, Object.assign({}, process.env, {
      npm_config_disturl: "https://atom.io/download/atom-shell",
      npm_config_target: electronVersion,
      npm_config_runtime: "electron",
      npm_config_arch: arch,
      HOME: gypHome,
      USERPROFILE: gypHome,
    })
  ))
}

export function spawnNpmProduction(command: string, appDir: string, env?: any): BluebirdPromise<any> {
  let npmExecPath = process.env.npm_execpath || process.env.NPM_CLI_JS
  const npmExecArgs = [command, "--production", "--cache-min", "999999999"]
  if (npmExecPath == null) {<commit_msg>fix: pass --build-from-source to force native dep compilation<commit_after>import { execFile, spawn as _spawn, ChildProcess, SpawnOptions } from "child_process"
import { Promise as BluebirdPromise } from "bluebird"
import { homedir } from "os"
import * as path from "path"
import { readJson, stat, Stats, unlink } from "fs-extra-p"
import { yellow, red } from "chalk"
import debugFactory = require("debug")
import { warn, task, log } from "./log"
import { createHash } from "crypto"

//noinspection JSUnusedLocalSymbols
const __awaiter = require("./awaiter")

export const debug = debugFactory("electron-builder")
export const debug7z = debugFactory("electron-builder:7z")

const DEFAULT_APP_DIR_NAMES = ["app", "www"]

export function installDependencies(appDir: string, electronVersion: string, arch: string = process.arch, command: string = "install"): BluebirdPromise<any> {
  const gypHome = path.join(homedir(), ".electron-gyp")
  return task(`${(command === "install" ? "Installing" : "Rebuilding")} app dependencies for arch ${arch} to ${appDir}`, spawnNpmProduction(command, appDir, Object.assign({}, process.env, {
      npm_config_disturl: "https://atom.io/download/atom-shell",
      npm_config_target: electronVersion,
      npm_config_runtime: "electron",
      npm_config_arch: arch,
      HOME: gypHome,
      USERPROFILE: gypHome,
    })
  ))
}

export function spawnNpmProduction(command: string, appDir: string, env?: any): BluebirdPromise<any> {
  let npmExecPath = process.env.npm_execpath || process.env.NPM_CLI_JS
  const npmExecArgs = [command, "--production", "--build-from-source", "--cache-min", "999999999"]
  if (npmExecPath == null) {
{'fraction_non_alphanumeric': 0.13693583051888242, 'fraction_numerical': 0.006754682222904513, 'mean_word_length': 5.135593220338983, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2832776', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1002, 'n_words': 274}