forked from bpampuch/pdfmake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-examples.js
More file actions
32 lines (27 loc) · 738 Bytes
/
build-examples.js
File metadata and controls
32 lines (27 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const fs = require('fs');
const exec = require('child_process').exec;
const log = require('fancy-log');
var errCount = 0;
var position = 0;
process.chdir('examples');
const items = fs.readdirSync('.');
const files = items.filter(file => file.substring(file.length - 3, file.length) === '.js');
files.forEach(function (file) {
exec(`node ${file}`, function (err, stdout, stderr) {
position++;
log('FILE: ', file, ` (${position}/${files.length})`);
log(stdout);
if (stderr) {
errCount++;
log.error(stderr);
} else if (err) {
errCount++;
log.error(err);
}
if (position === files.length) {
if (errCount) {
log.error('Errors count: ', errCount);
}
}
});
});