๐Ÿ“ฆ rparrett / undefended

๐Ÿ“„ Makefile.toml ยท 61 lines
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[env]
ENV_DIR = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { release = "release", "web-dist" = "web-dist" } }
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [
    "CARGO_TARGET_DIR",
] } }
CARGO_WASM_PATH = "${CARGO_TARGET_DIR}/wasm32-unknown-unknown/${ENV_DIR}/${CARGO_MAKE_CRATE_NAME}.wasm"
CARGO_MANIFEST_DIR = "${CARGO_MAKE_WORKING_DIRECTORY}"
PORT = 4000

[env.release]
CARGO_RELEASE_ARGS = "--release"

[env.web-dist]
CARGO_RELEASE_ARGS = "--profile web-dist"

[tasks.show-env]
command = "env"

[tasks.build]
args = [
    "build",
    "--target",
    "wasm32-unknown-unknown",
    "@@split(CARGO_RELEASE_ARGS, )",
]
command = "cargo"

[tasks.bindgen]
install_crate = { crate_name = "wasm-bindgen-cli", binary = "wasm-bindgen", test_arg = "--help" }
args = [
    "--out-dir",
    "wasm",
    "--out-name",
    "bevy_game",
    "--target",
    "web",
    "--no-typescript",
    "${CARGO_WASM_PATH}",
]
command = "wasm-bindgen"
dependencies = ["build"]

[tasks.static]
script = '''
cp -r assets wasm/
'''
dependencies = ["bindgen"]

[tasks.serve]
install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "--help" }
command = "microserver"
args = ["--port", "${PORT}", "--no-spa", "wasm/"]
dependencies = ["static"]

[tasks.bundle]
script = "rm -f wasm.zip && pushd wasm && zip -r -X ../wasm.zip . && popd"
dependencies = ["static"]

[tasks.test]
disabled = true