forked from eslint/eslint-plugin-markdown
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm-prepare.js
28 lines (24 loc) · 874 Bytes
/
npm-prepare.js
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
/**
* @fileoverview Install examples' dependencies as part of local npm install for
* development and CI.
* @author btmills
*/
"use strict";
if (!process.env.NO_RECURSIVE_PREPARE) {
const childProcess = require("child_process");
const fs = require("fs");
const path = require("path");
const examplesDir = path.resolve(__dirname, "examples");
const examples = fs.readdirSync(examplesDir)
.filter(exampleDir => fs.statSync(path.join(examplesDir, exampleDir)).isDirectory())
.filter(exampleDir => fs.existsSync(path.join(examplesDir, exampleDir, "package.json")));
for (const example of examples) {
childProcess.execSync("npm install", {
cwd: path.resolve(examplesDir, example),
env: {
...process.env,
NO_RECURSIVE_PREPARE: "true"
}
});
}
}