forked from module-federation/module-federation-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkChangedWorkspaces.js
33 lines (31 loc) · 1.31 KB
/
checkChangedWorkspaces.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
const { exec } = require("child_process");
exec("npx lerna ls --all --json", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
try {
const allPackages = JSON.parse(stdout);
exec("npx lerna ls --all --since=origin/master --json", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
try {
const updatedPackages = JSON.parse(stdout);
if (stdout.includes("cypress")) {
// TODO filter for "@" added temporary to not to add packages wich are not automated and formated yet.
const newPackages = allPackages.filter(x => !x.name.includes("_") && !updatedPackages.includes(x) && !x.name.includes("cypress") && !x.name.includes("@"));
console.log(JSON.stringify({ container: newPackages.map(x => x.name)}));
} else {
console.log(JSON.stringify({ container: updatedPackages.filter(x => !x.name.includes("_") && !x.name.includes("@")).map(x => x.name)
}))
}
} catch (e) {
console.error(e);
}
});
} catch (e) {
console.error(e);
}
});