-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.ts
61 lines (54 loc) · 1.39 KB
/
fuse.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
import { fusebox, sparky } from "fuse-box";
import { tsc } from "fuse-box/sparky/tsc";
import * as path from "path";
class Context {}
const { rm, task } = sparky<Context>(Context);
task("default", async ctx => {
rm("./dist");
const transformer = fusebox({
cache: false,
dependencies: { serverIgnoreExternals: true },
entry: "src/transformer/development.ts",
target: "server",
watcher: { include: ["src/"] }
});
const { onComplete } = await transformer.runDev({
bundles: {
exported: true,
distRoot: path.join(__dirname, "dist"),
app: { path: "plugin.js" }
}
});
onComplete(({ server }) => server.start());
});
task("test:dist", async ctx => {
rm("./dist_test");
const { MyAwesomePlugin } = require("./dist");
const transformer = fusebox({
cache: false,
dependencies: { serverIgnoreExternals: true },
entry: "src/project/test.ts",
plugins: [MyAwesomePlugin()],
target: "server"
});
const { onComplete } = await transformer.runDev({
bundles: {
distRoot: path.join(__dirname, "dist_test"),
app: { path: "test_app.js" }
}
});
onComplete(({ server }) => server.start());
});
task("dist", async ctx => {
rm("./dist");
await tsc(
{
declaration: true,
module: "CommonJS",
skipLibCheck: true,
target: "ES2017",
outDir: "dist"
},
["src/transformer/index.ts"]
);
});