Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 83a4611

Browse files
committed
ESify our nodejs scripts
1 parent 2d0428e commit 83a4611

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

build/phantom.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
/* eslint-env node */
2+
/* eslint-env es6 */
23

34
'use strict';
45

5-
var os = require('os');
6-
var glob = require('glob');
7-
var async = require('async');
8-
var qunit = require('node-qunit-phantomjs');
6+
const os = require('os');
7+
const glob = require('glob');
8+
const async = require('async');
9+
const qunit = require('node-qunit-phantomjs');
910

10-
var THREADS = os.cpus().length <= 2 ? 1 : os.cpus().length / 2;
11+
const cpus = os.cpus().length;
12+
const THREADS = cpus <= 2 ? 1 : cpus / 2;
1113

12-
var ignores = [
14+
const ignore = [
1315
'test/fixtures/jquery/missing.html',
1416
'test/fixtures/jquery/and_bs_js_both_missing.html',
1517
'test/fixtures/charset/not-utf8.html'
1618
];
1719

18-
glob('test/fixtures/**/*.html', {ignore: ignores}, function (err, files) {
20+
glob('test/fixtures/**/*.html', {ignore}, (err, files) => {
1921
if (err) {
2022
throw err;
2123
}
2224

2325
async.eachLimit(files,
2426
THREADS,
25-
function (file, callback) {
27+
(file, callback) => {
2628
qunit(file, {timeout: 10}, callback);
27-
}, function (er) {
29+
},
30+
(er) => {
2831
if (er) {
2932
throw er;
3033
}

build/stamp.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,23 @@
33
*/
44

55
/* eslint-env node */
6+
/* eslint-env es6 */
67

78
'use strict';
89

9-
var fs = require('fs');
10+
const path = require('path');
11+
const pkg = require(path.resolve('package.json'));
12+
const year = new Date().getFullYear();
1013

11-
fs.readFile('package.json', function (err, data) {
12-
if (err) {
13-
throw err;
14-
}
15-
16-
var pkg = JSON.parse(data);
17-
var year = new Date().getFullYear();
18-
19-
var stampTop = '/*!\n * Bootlint v' + pkg.version + ' (' + pkg.homepage + ')\n' +
20-
' * ' + pkg.description + '\n' +
21-
' * Copyright (c) 2014-' + year + ' The Bootlint Authors\n' +
22-
' * Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE).\n' +
23-
' */\n';
14+
const stampTop =
15+
`/*!
16+
* Bootlint v${pkg.version} (${pkg.homepage})
17+
* ${pkg.description}
18+
* Copyright (c) 2014-${year} The Bootlint Authors
19+
* Licensed under the MIT License (https://github.com/twbs/bootlint/blob/master/LICENSE).
20+
*/
2421
25-
process.stdout.write(stampTop);
22+
`;
2623

27-
process.stdin.pipe(process.stdout);
28-
});
24+
process.stdout.write(stampTop);
25+
process.stdin.pipe(process.stdout);

0 commit comments

Comments
 (0)