forked from resFactory/factory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.ts
More file actions
69 lines (66 loc) · 2.5 KB
/
Copy pathTaskfile.ts
File metadata and controls
69 lines (66 loc) · 2.5 KB
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
import * as t from "./lib/task/core.ts";
import * as tcss from "./lib/task/transform-css.ts";
import * as bjs from "./lib/task/bundle-js.ts";
import * as udd from "./lib/task/udd.ts";
import * as ss from "./lib/sql/shell/task.ts";
// see setup and usage instructions in lib/task/README.md
export class Tasks extends t.EventEmitter<{
help(): void;
updateSupportDeps(): Promise<void>;
updateDenoDeps(): Promise<void>;
bundleJsFromTsTwin(): Promise<void>;
discoverBundleJsFromTsTwin(): Promise<void>;
discoverJsTargetsWithoutTsTwins(): Promise<void>;
transformCssFromTsTwin(): Promise<void>;
discoverTransformCssFromTsTwin(): Promise<void>;
discoverCssTargetsWithoutTsTwins(): Promise<void>;
bundleAll(): Promise<void>;
discoverBundleable(): Promise<void>;
lintBundleable(): Promise<void>;
maintain(): Promise<void>;
}> {
constructor() {
super();
// this is ugly but necessary due to events.EventEmitter making _events_ private :-(
this.on("help", t.eeHelpTask(this));
this.on("updateSupportDeps", ss.ensureSupportBinsTask());
this.on("updateDenoDeps", udd.updateDenoDepsTask());
this.on("bundleJsFromTsTwin", bjs.bundleJsFromTsTwinTask());
this.on("discoverBundleJsFromTsTwin", bjs.discoverBundleJsFromTsTwinTask());
this.on(
"discoverJsTargetsWithoutTsTwins",
bjs.discoverJsTargetsWithoutTsTwinsTask(),
);
this.on("transformCssFromTsTwin", tcss.transformCssFromTsTwinTask());
this.on(
"discoverTransformCssFromTsTwin",
tcss.discoverTransformCssFromTsTwinTask(),
);
this.on(
"discoverCssTargetsWithoutTsTwins",
tcss.discoverCssTargetsWithoutTsTwinsTask(),
);
this.on("bundleAll", async () => {
await this.emit("bundleJsFromTsTwin");
await this.emit("transformCssFromTsTwin");
});
this.on("discoverBundleable", async () => {
await this.emit("discoverBundleJsFromTsTwin");
await this.emit("discoverTransformCssFromTsTwin");
});
this.on("lintBundleable", async () => {
await this.emit("discoverJsTargetsWithoutTsTwins");
await this.emit("discoverCssTargetsWithoutTsTwins");
});
this.on("maintain", async () => {
await this.emit("updateSupportDeps");
await this.emit("updateDenoDeps");
await this.emit("bundleAll");
});
}
}
// only execute tasks if Taskfile.ts is being called as a script; otherwise
// it might be imported for tasks or other reasons and we shouldn't "run".
if (import.meta.main) {
await t.eventEmitterCLI(Deno.args, new Tasks());
}