diff --git a/build/phantom.js b/build/phantom.js index 6b81ab8..469e866 100644 --- a/build/phantom.js +++ b/build/phantom.js @@ -1,30 +1,32 @@ -/* eslint-env node */ +/* eslint-env node, es6 */ 'use strict'; -var os = require('os'); -var glob = require('glob'); -var async = require('async'); -var qunit = require('node-qunit-phantomjs'); +const os = require('os'); +const glob = require('glob'); +const async = require('async'); +const qunit = require('node-qunit-phantomjs'); -var THREADS = os.cpus().length <= 2 ? 1 : os.cpus().length / 2; +const cpus = os.cpus().length; +const THREADS = cpus <= 2 ? 1 : cpus / 2; -var ignores = [ +const ignore = [ 'test/fixtures/jquery/missing.html', 'test/fixtures/jquery/and_bs_js_both_missing.html', 'test/fixtures/charset/not-utf8.html' ]; -glob('test/fixtures/**/*.html', {ignore: ignores}, function (err, files) { +glob('test/fixtures/**/*.html', {ignore}, (err, files) => { if (err) { throw err; } async.eachLimit(files, THREADS, - function (file, callback) { + (file, callback) => { qunit(file, {timeout: 10}, callback); - }, function (er) { + }, + (er) => { if (er) { throw er; } diff --git a/build/stamp.js b/build/stamp.js index c150f27..80a104a 100644 --- a/build/stamp.js +++ b/build/stamp.js @@ -1,28 +1,22 @@ -/* This file is taken from - and adapted for Bootlint. - */ +// This file is taken from Bootstrap and adapted for Bootlint. -/* eslint-env node */ +/* eslint-env node, es6 */ 'use strict'; -var fs = require('fs'); +const path = require('path'); +const pkg = require(path.resolve('package.json')); +const year = new Date().getFullYear(); -fs.readFile('package.json', function (err, data) { - if (err) { - throw err; - } +const stampTop = +`/*! + * Bootlint v${pkg.version} (${pkg.homepage}) + * ${pkg.description} + * Copyright (c) 2014-${year} The Bootlint Authors + * Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE). + */ - var pkg = JSON.parse(data); - var year = new Date().getFullYear(); +`; - var stampTop = '/*!\n * Bootlint v' + pkg.version + ' (' + pkg.homepage + ')\n' + - ' * ' + pkg.description + '\n' + - ' * Copyright (c) 2014-' + year + ' The Bootlint Authors\n' + - ' * Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE).\n' + - ' */\n'; - - process.stdout.write(stampTop); - - process.stdin.pipe(process.stdout); -}); +process.stdout.write(stampTop); +process.stdin.pipe(process.stdout);