-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtasksfile.ts
81 lines (68 loc) · 2.16 KB
/
tasksfile.ts
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
import {ICLIOptions} from "@pawelgalazka/cli";
import {cli, help, sh} from "tasksfile";
function clean() {
sh("rm -rf node_modules");
sh("rm -rf build");
}
function lint() {
sh("docker-compose run --rm backend yarn run lint", {async: false, nopipe: true});
}
function npm(options: any, task = "--help") {
sh("docker-compose run --rm backend yarn run " + task, {async: false, nopipe: true});
}
function compile() {
sh("docker-compose run --rm backend yarn run build", {async: false, nopipe: true});
}
function build() {
sh("docker-compose down", {async: false, nopipe: true});
sh("docker-compose -f docker-compose-cleanup.yml down -v", {async: false, nopipe: true});
sh("docker-compose build", {async: false, nopipe: true});
}
function seed() {
sh("docker-compose run --rm backend yarn run seed", {async: false, nopipe: true});
}
function seedUndo() {
sh("docker-compose run --rm backend yarn run seed:revert-all", {async: false, nopipe: true});
}
function e2e() {
sh("docker-compose run -e NODE_ENV=test-e2e --rm backend yarn run test:e2e", {async: false, nopipe: true});
}
function unit() {
sh("docker-compose run -e NODE_ENV=test --no-deps --rm backend yarn run test:unit", {async: false, nopipe: true});
}
function test(options: ICLIOptions, type = "") {
if (type === "unit") {
unit();
} else if (type === "e2e") {
e2e();
} else {
sh("docker-compose run -e NODE_ENV=test --no-deps --rm backend yarn run test", {async: false, nopipe: true});
}
}
function dev() {
sh("docker-compose up", {async: false, nopipe: true});
}
help(e2e, "Runs end-to-end tests");
help(unit, "Runs nodejs unit tests");
help(test, "Runs nodejs tests");
help(dev, "Starts application and all dependent services");
help(npm, "Executes yarn script");
help(compile, "Transpiles files to es5");
help(clean, "Removes all build directories and dependencies");
help(lint, "Runs eslint on current project");
help(build, "Builds new docker image");
help(seed, "Seed database");
help(seedUndo, "Reverts database seeds")
cli({
clean,
lint,
npm,
build,
seed,
seedUndo,
unit,
test,
compile,
dev,
e2e,
});