<commit_before>'use strict';

{exec} = require 'child_process'

desc 'Minify the source code for deployment.'
task 'minify', [ 'jstest' ], ->
  runTask minify, 'Minifying javascript...'
, async: true

desc 'Run the unit tests against the compiled output.'
task 'jstest', [ 'jslint' ], ->
  process.env.NODE_PATH = './build'
  runTask test, 'Testing javascript...'
, async: true

desc 'Lint the compiled output.'
task 'jslint', [ 'compile' ], ->
  runTask jslint, 'Linting javascript...'
, async: true

desc 'Compile the source coffeescript into javascript.'
task 'compile', [ 'cstest' ], ->
  runTask compile, 'Compiling coffeescript...'
, async: true

desc 'Run the unit tests against the source code.'
task 'cstest', [ 'cslint' ], ->
  process.env.NODE_PATH = './src'
  runTask test, 'Testing coffeescript...'
, async: true

desc 'Lint the source code.'
task 'cslint', [ 'prepare' ], ->
  runTask cslint, 'Linting coffeescript...'
, async: true

desc 'Install dependencies.'
task 'prepare', ->
  runTask prepare, 'Preparing the build environment...'
, async: true

runTask = (operation, message) ->
  console.log message
  operation()

minify = ->
  runCommand commands.minify

test = ->
  runCommand commands.test

jslint = ->
  runCommand commands.jslint

cslint = ->
  runCommand commands.cslint

compile = ->
  runCommand commands.compile

prepare = ->
  runCommand commands.prepare

runCommand = (command) ->
  exec command, { cwd: __dirname }, (error, stdout, stderr) ->
    console.log stdout
    if typeof error is 'object' && error isnt null
      console.log error.message
      process.exit 1
    after()

after = () ->
  process.env.NODE_PATH = originalNodePath
  complete()

commands =
  minify: './node_modules/.bin/uglifyjs --lift-vars --output ./build/types.min.js ./build/types.js'
  test: './node_modules/.bin/mocha --compilers coffee:coffee-script --ui tdd --reporter spec --colors --slow 50 ./test/types.coffee'
  jslint: './node_modules/.bin/jshint ./build/types.js --config config/jshint.json'
  cslint: './node_modules/.bin/coffeelint -f config/coffeelint.json ./src/types.coffee'
  compile: './node_modules/.bin/coffee -c -o ./build ./src/types.coffee'
  prepare: 'npm install'

originalNodePath = process.env.NODE_PATH
<commit_msg>Remove comment from minified output.<commit_after>'use strict';

{exec} = require 'child_process'

desc 'Minify the source code for deployment.'
task 'minify', [ 'jstest' ], ->
  runTask minify, 'Minifying javascript...'
, async: true

desc 'Run the unit tests against the compiled output.'
task 'jstest', [ 'jslint' ], ->
  process.env.NODE_PATH = './build'
  runTask test, 'Testing javascript...'
, async: true

desc 'Lint the compiled output.'
task 'jslint', [ 'compile' ], ->
  runTask jslint, 'Linting javascript...'
, async: true

desc 'Compile the source coffeescript into javascript.'
task 'compile', [ 'cstest' ], ->
  runTask compile, 'Compiling coffeescript...'
, async: true

desc 'Run the unit tests against the source code.'
task 'cstest', [ 'cslint' ], ->
  process.env.NODE_PATH = './src'
  runTask test, 'Testing coffeescript...'
, async: true

desc 'Lint the source code.'
task 'cslint', [ 'prepare' ], ->
  runTask cslint, 'Linting coffeescript...'
, async: true

desc 'Install dependencies.'
task 'prepare', ->
  runTask prepare, 'Preparing the build environment...'
, async: true

runTask = (operation, message) ->
  console.log message
  operation()

minify = ->
  runCommand commands.minify

test = ->
  runCommand commands.test

jslint = ->
  runCommand commands.jslint

cslint = ->
  runCommand commands.cslint

compile = ->
  runCommand commands.compile

prepare = ->
  runCommand commands.prepare

runCommand = (command) ->
  exec command, { cwd: __dirname }, (error, stdout, stderr) ->
    console.log stdout
    if typeof error is 'object' && error isnt null
      console.log error.message
      process.exit 1
    after()

after = () ->
  process.env.NODE_PATH = originalNodePath
  complete()

commands =
  minify: './node_modules/.bin/uglifyjs --no-copyright --lift-vars --output ./build/types.min.js ./build/types.js'
  test: './node_modules/.bin/mocha --compilers coffee:coffee-script --ui tdd --reporter spec --colors --slow 50 ./test/types.coffee'
  jslint: './node_modules/.bin/jshint ./build/types.js --config config/jshint.json'
  cslint: './node_modules/.bin/coffeelint -f config/coffeelint.json ./src/types.coffee'
  compile: './node_modules/.bin/coffee -c -o ./build ./src/types.coffee'
  prepare: 'npm install'

originalNodePath = process.env.NODE_PATH

{'fraction_non_alphanumeric': 0.1484409310496267, 'fraction_numerical': 0.0013175230566534915, 'mean_word_length': 3.465686274509804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '2432507', 'n_tokens_mistral': 1532, 'n_tokens_neox': 1491, 'n_words': 425}