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

'use strict';

var fs = require('fs');
var browserify = require('browserify');
var browserPack = require('browser-pack');
var exec = require('child_process').exec;
var sys = require('sys');
var puts = function(error, stdout, stderr) {
  if (error) console.log(error);
  //sys.puts(stdout);
  //sys.puts(stderr);
};

var pack = function (params) {
  var file = require.resolve('soop');
  var dir = file.substr(0, file.length - String('soop.js').length);
  var preludePath = dir + 'example/custom_prelude.js';
  params.raw = true;
  params.sourceMapPrefix = '//#';
  params.prelude = fs.readFileSync(preludePath, 'utf8');
  params.preludePath = preludePath;
  return browserPack(params);
};

var createBundle = function(opts) {


  opts.dir = opts.dir || 'js/';

  // concat browser vendor files
  exec('cd ' + opts.dir + 'browser; sh concat.sh', puts);

  var bopts = {
    pack: pack,
    debug: true,
    standalone: 'copay',
    insertGlobals: true
  };
  var b = browserify(bopts);
  b.require('./copay', {
    expose: 'copay'<commit_msg>Fix concat.sh failure when building copay on Windows. (and silent? bug in Linux builds - build.js attempts to cd to js/browser subdir, but there is no such directory in the copay project, and concat.sh resides in the project root)<commit_after>#!/usr/bin/env node

'use strict';

var fs = require('fs');
var browserify = require('browserify');
var browserPack = require('browser-pack');
var exec = require('child_process').exec;
var sys = require('sys');
var puts = function(error, stdout, stderr) {
  if (error) console.log(error);
  //sys.puts(stdout);
  //sys.puts(stderr);
};

var pack = function (params) {
  var file = require.resolve('soop');
  var dir = file.substr(0, file.length - String('soop.js').length);
  var preludePath = dir + 'example/custom_prelude.js';
  params.raw = true;
  params.sourceMapPrefix = '//#';
  params.prelude = fs.readFileSync(preludePath, 'utf8');
  params.preludePath = preludePath;
  return browserPack(params);
};

var createBundle = function(opts) {


  opts.dir = opts.dir || 'js/';

  // concat browser vendor files
  exec('sh concat.sh', puts);

  var bopts = {
    pack: pack,
    debug: true,
    standalone: 'copay',
    insertGlobals: true
  };
  var b = browserify(bopts);
  b.require('./copay', {
    expose: 'copay'
{'fraction_non_alphanumeric': 0.16005121638924455, 'fraction_numerical': 0.0017072129748186087, 'mean_word_length': 3.8833333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5471861', 'n_tokens_mistral': 815, 'n_tokens_neox': 804, 'n_words': 207}