зеркало из https://github.com/twbs/bootlint.git
ES6-ify our node.js scripts.
This commit is contained in:
Родитель
4ca78706a6
Коммит
f62a1fbe48
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,28 +1,22 @@
|
|||
/* This file is taken from <https://github.com/twbs/bootstrap/blob/v4-dev/build/stamp.js>
|
||||
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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче