forked from microsoft/vscode-extension-samples
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (22 loc) · 636 Bytes
/
index.js
File metadata and controls
26 lines (22 loc) · 636 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
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));
}
}
}