forked from aris-creator/jancok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateDependencies.js
47 lines (42 loc) · 1.18 KB
/
updateDependencies.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Updates package.json dependencies in all packages in interactive mode
*/
const execa = require("execa");
const path = require("path");
const fs = require("fs-jetpack");
async function run() {
const rootDirPath = path.join(__dirname, "..");
const packagesDirPath = path.join(rootDirPath, "packages");
const list = fs
.list(packagesDirPath)
.map((filename) => path.join(packagesDirPath, filename))
.filter((file) => fs.exists(file) === "dir");
list.push(rootDirPath);
try {
for (let index = 0; index < list.length; index++) {
await execa("npx", ["npm-check-updates", "-i"], {
stdio: "inherit",
cwd: list[index],
});
}
// This case will be used in future with -u flag
// await Promise.all(
// list.map(async directory => {
// return await execa("ncu", ["-i"], {
// stdio: "inherit",
// cwd: directory
// });
// })
// );
await execa("yarn", [], {
stdio: "inherit",
cwd: rootDirPath,
});
} catch (e) {
console.error(
"Problem with updating dependencies, make sure you have npm-check-updates installed globally"
);
console.error(e);
}
}
run();