<commit_before>var fs = require('fs')
var path = require('path')
var concat = require('concat')
var cpr = require('cpr')
var mkdirp = require('mkdirp')

var mpPath = path.resolve(__dirname, '../id_monkey_patches')
var idPath = path.resolve(__dirname, '../node_modules/iD')
var idDstPath = path.join(idPath, 'dist')
var dstPath = path.resolve(__dirname, '../vendor/iD')

mkdirp.sync(dstPath)

// Monkey patch and build iD
concat([
  path.join(mpPath, 'start.js'),
  path.join(idDstPath, 'iD.js'),
  path.join(mpPath, 'id-connection.js'),
  path.join(mpPath, 'id-modes-browse.js'),
  path.join(mpPath, 'id-ui-account.js'),
  path.join(mpPath, 'id-svg-tagclasses.js'),
  path.join(mpPath, 'osm-auth.js'),
  path.join(mpPath, 'end.js')
], path.join(dstPath, 'iD-patched.js'), done)

// Copy all iD dist assets
cpr(idDstPath, dstPath, {overwrite: true}, done)
cpr(path.join(idPath, 'data/imagery.json'), dstPath, done)

var presets = {
  presets: require('../node_modules/iD/data/presets/presets.json'),
  defaults: require('../node_modules/iD/data/presets/defaults.json'),
  categories: require('../node_modules/iD/data/presets/categories.json'),
  fields: require('../node_modules/iD/data/presets/fields.json')
}

fs.writeFileSync(path.join(dstPath, 'presets.json'), JSON.stringify(presets, null, '  '))

function done (err) {
  if (err) console.error(err)
}
<commit_msg>fix: build script overwrite<commit_after>var fs = require('fs')
var path = require('path')
var concat = require('concat')
var cpr = require('cpr')
var mkdirp = require('mkdirp')

var mpPath = path.resolve(__dirname, '../id_monkey_patches')
var idPath = path.resolve(__dirname, '../node_modules/iD')
var idDstPath = path.join(idPath, 'dist')
var dstPath = path.resolve(__dirname, '../vendor/iD')

mkdirp.sync(dstPath)

// Monkey patch and build iD
concat([
  path.join(mpPath, 'start.js'),
  path.join(idDstPath, 'iD.js'),
  path.join(mpPath, 'id-connection.js'),
  path.join(mpPath, 'id-modes-browse.js'),
  path.join(mpPath, 'id-ui-account.js'),
  path.join(mpPath, 'id-svg-tagclasses.js'),
  path.join(mpPath, 'osm-auth.js'),
  path.join(mpPath, 'end.js')
], path.join(dstPath, 'iD-patched.js'), done)

// Copy all iD dist assets
cpr(idDstPath, dstPath, {overwrite: true}, done)
cpr(path.join(idPath, 'data/imagery.json'), dstPath, {overwrite: true}, done)

var presets = {
  presets: require('../node_modules/iD/data/presets/presets.json'),
  defaults: require('../node_modules/iD/data/presets/defaults.json'),
  categories: require('../node_modules/iD/data/presets/categories.json'),
  fields: require('../node_modules/iD/data/presets/fields.json')
}

fs.writeFileSync(path.join(dstPath, 'presets.json'), JSON.stringify(presets, null, '  '))

function done (err) {
  if (err) console.error(err)
}

{'fraction_non_alphanumeric': 0.19248826291079812, 'fraction_numerical': 0.0, 'mean_word_length': 4.918803418803419, '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': '1512277', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1042, 'n_words': 187}