-
Notifications
You must be signed in to change notification settings - Fork 0
/
just.config.ts
72 lines (62 loc) · 2.11 KB
/
just.config.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
import { argv, parallel, series, task, tscTask } from "just-scripts";
import {
BundleTaskParameters,
CopyTaskParameters,
bundleTask,
cleanTask,
cleanCollateralTask,
copyTask,
coreLint,
mcaddonTask,
setupEnvironment,
ZipTaskParameters,
STANDARD_CLEAN_PATHS,
DEFAULT_CLEAN_DIRECTORIES,
getOrThrowFromProcess,
watchTask,
} from "@minecraft/core-build-tasks";
import path from "path";
// Setup env variables
setupEnvironment(path.resolve(__dirname, ".env"));
const projectName = getOrThrowFromProcess("PROJECT_NAME");
const bundleTaskOptions: BundleTaskParameters = {
entryPoint: path.join(__dirname, "./scripts/main.ts"),
external: ["@minecraft/server"],
outfile: path.resolve(__dirname, "./dist/scripts/main.js"),
minifyWhitespace: false,
sourcemap: true,
outputSourcemapPath: path.resolve(__dirname, "./dist/debug"),
};
const copyTaskOptions: CopyTaskParameters = {
copyToBehaviorPacks: [`./behavior_packs/${projectName}`],
copyToScripts: ["./dist/scripts"],
copyToResourcePacks: [],
};
const mcaddonTaskOptions: ZipTaskParameters = {
...copyTaskOptions,
outputFile: `./dist/packages/${projectName}.mcaddon`,
};
// Lint
task("lint", coreLint(["scripts/**/*.ts"], argv().fix));
// Build
task("typescript", tscTask());
task("bundle", bundleTask(bundleTaskOptions));
task("build", series("typescript", "bundle"));
// Clean
task("clean-local", cleanTask(DEFAULT_CLEAN_DIRECTORIES));
task("clean-collateral", cleanCollateralTask(STANDARD_CLEAN_PATHS));
task("clean", parallel("clean-local", "clean-collateral"));
// Package
task("copyArtifacts", copyTask(copyTaskOptions));
task("package", series("clean-collateral", "copyArtifacts"));
// Local Deploy used for deploying local changes directly to output via the bundler. It does a full build and package first just in case.
task(
"local-deploy",
watchTask(
["scripts/**/*.ts", "behavior_packs/**/*.{json,lang,png}", "resource_packs/**/*.{json,lang,png}"],
series("clean-local", "build", "package")
)
);
// Mcaddon
task("createMcaddonFile", mcaddonTask(mcaddonTaskOptions));
task("mcaddon", series("clean-local", "build", "createMcaddonFile"));