Add tslint as devDependency for all samples

This commit is contained in:
Pine Wu
2018-11-08 10:39:34 -08:00
parent 1eb0370270
commit e361ab05b5
48 changed files with 8970 additions and 3670 deletions

26
index.js Normal file
View File

@ -0,0 +1,26 @@
const fs = require('fs');
const path = require('path');
const cp = require('child_process');
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
function npmInstall(location) {
const result = cp.spawnSync(npm, ['install', '-D', 'tslint'], {
cwd: location,
stdio: 'inherit'
});
if (result.error || result.status !== 0) {
process.exit(1);
}
}
const cwd = process.cwd();
for (const element of fs.readdirSync(cwd)) {
if (element[0] !== '.' && element.endsWith('-sample')) {
const fullpath = path.join(cwd, element, 'package.json');
if (fs.existsSync(fullpath)) {
npmInstall(path.join(cwd, element));
}
}
}