-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
87 lines (69 loc) · 2.3 KB
/
gulpfile.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const { series } = require("gulp");
const execa = require("execa");
// print output of commands into the terminal
const stdio = "inherit";
const argv = require("yargs").help(false).argv
// Order sensitive
const packages = [
{ name: "language-diagrams-protocol"},
{ name: "language-diagrams-langium"},
{ name: "language-diagrams-server"},
{ name: "language-diagrams-webview"},
{ name: "language-diagrams-vscode"},
]
async function execInProject(project, task) {
try {
console.log("Running for: " + project)
await execa("yarn", ["workspace", project, "run", task],{
stdio,
});
} catch (e) {
console.error(e)
}
}
async function testAll() {
if (argv.coverage) {
await execa("yarn", ["exec", "jest","--ci", "--json", "--coverage", "--testLocationInResults", "--outputFile=report.json"], {
stdio,
})
} else {
await execa("yarn", ["exec", "jest"], {
stdio,
})
}
}
const build = series(packages.map(it => async function() {
await execInProject(it.name, "build");
}))
const prepare = series(packages.map(it => async function() {
await execInProject(it.name, "prepare");
}))
const clean = series(packages.map(it => async function() {
await execInProject(it.name, "clean")
}))
const depcheck = series(packages.map(it => async function() {
await execInProject(it.name, "depcheck")
}))
const help = async () => {
await execa("gulp", ["-T", "--depth", "1"], { stdio })
}
const test = series(build, testAll)
const test_nobuild = series(packages.map(it => async function() {
await execInProject(it.name, "test")
}))
exports.build = build;
exports.build.description = "Build all packages.";
exports.clean = clean
exports.clean.description = "Cleans all the build files"
exports.prepare = prepare
exports.prepare.description = "Cleans, builds and lints all packages"
exports.depcheck = depcheck
exports.depcheck.description = "Check package dependancies"
exports.test = test
exports.test.description = "Run all tests in the repository."
exports.test.flags = {
"--coverage": "Collect coverage information during the test run.",
}
exports.test_nobuild = test_nobuild
exports.test_nobuild.description = "Run all tests in the repository without building first."
exports.help = help