<commit_before>#! /usr/bin/env node

import 'source-map-support/register';
import program from 'commander';
import nativefier from './index';

const dns = require('dns');
const packageJson = require('./../package');
const log = require('loglevel');

function collect(val, memo) {
  memo.push(val);
  return memo;
}

function parseJson(val) {
  if (!val) return {};
  return JSON.parse(val);
}

function getProcessEnvs(val) {
  if (!val) return {};
  const pEnv = {};
  pEnv.processEnvs = parseJson(val);
  return pEnv;
}

function checkInternet() {
  dns.lookup('npmjs.com', (err) => {
    if (err && err.code === 'ENOTFOUND') {
      log.warn(
        '\nNo Internet Connection\nTo offline build, download electron from https://github.com/electron/electron/releases\nand place in ~/AppData/Local/electron/Cache/ on Windows,\n~/.cache/electron on Linux or ~/Library/Caches/electron/ on Mac\nUse --electron-version to specify the version you downloaded.',
      );
    }
  });
}

if (require.main === module) {
  program
    .version(packageJson.version)
    .arguments('<targetUrl> [dest]')
    .action((targetUrl, appDir) => {
      program.targetUrl = targetUrl;
      program.out = appDir;
    })
    .option('-n, --name <value>', 'app name')
    .option('-p, --platform <value>', "'osx', 'mas', 'linux' or 'windows'")
    .option('-a, --arch <value>', "'ia32' or 'x64' or 'armv7l'")<commit_msg>Add Unix/Mac-conventional `-v` version flag (PR#628)<commit_after>#! /usr/bin/env node

import 'source-map-support/register';
import program from 'commander';
import nativefier from './index';

const dns = require('dns');
const packageJson = require('./../package');
const log = require('loglevel');

function collect(val, memo) {
  memo.push(val);
  return memo;
}

function parseJson(val) {
  if (!val) return {};
  return JSON.parse(val);
}

function getProcessEnvs(val) {
  if (!val) return {};
  const pEnv = {};
  pEnv.processEnvs = parseJson(val);
  return pEnv;
}

function checkInternet() {
  dns.lookup('npmjs.com', (err) => {
    if (err && err.code === 'ENOTFOUND') {
      log.warn(
        '\nNo Internet Connection\nTo offline build, download electron from https://github.com/electron/electron/releases\nand place in ~/AppData/Local/electron/Cache/ on Windows,\n~/.cache/electron on Linux or ~/Library/Caches/electron/ on Mac\nUse --electron-version to specify the version you downloaded.',
      );
    }
  });
}

if (require.main === module) {
  program
    .version(packageJson.version, '--version, -V, -v')
    .arguments('<targetUrl> [dest]')
    .action((targetUrl, appDir) => {
      program.targetUrl = targetUrl;
      program.out = appDir;
    })
    .option('-n, --name <value>', 'app name')
    .option('-p, --platform <value>', "'osx', 'mas', 'linux' or 'windows'")
    .option('-a, --arch <value>', "'ia32' or 'x64' or 'armv7l'")
{'fraction_non_alphanumeric': 0.18312324929971988, 'fraction_numerical': 0.004551820728291317, 'mean_word_length': 3.506309148264984, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '700933', 'n_tokens_mistral': 982, 'n_tokens_neox': 954, 'n_words': 239}