FastWave2.0/Makefile.toml

358 lines
9.4 KiB
Makefile
Raw Permalink Normal View History

2024-05-27 19:24:46 +00:00
[config]
default_to_workspace = false
min_version = "0.35.13"
unstable_features = ["CTRL_C_HANDLING"]
skip_core_tasks = true
[config.modify_core_tasks]
private = true
namespace = "default"
####### MAIN TASKS #######
[tasks.install]
description = "Install all dependencies. It's NoOp if all deps are already installed."
dependencies = [
"install_wasm_target",
"install_tauri",
"install_mzoon",
"init_pixi_canvas",
"init_tauri_glue",
2024-09-30 18:46:29 +00:00
"init_excalidraw_canvas",
2024-05-27 19:24:46 +00:00
]
[tasks.start]
description = "Run & watch Typescript and Rust in the debug mode"
dependencies = ["store_current_process_id"]
run_task = { fork = true, parallel = true, name = [
"tauri_dev_with_cleanup",
"watch_pixi_canvas",
"watch_tauri_glue",
2024-09-30 18:46:29 +00:00
"watch_excalidraw_canvas",
2024-05-27 19:24:46 +00:00
]}
[tasks.start_browser]
description = "Run without Tauri in the browser & watch Typescript and Rust in the debug mode"
dependencies = ["store_current_process_id"]
run_task = { fork = true, parallel = true, name = [
"mzoon_start_with_cleanup",
"watch_pixi_canvas",
"watch_tauri_glue",
2024-09-30 18:46:29 +00:00
"watch_excalidraw_canvas",
]}
[tasks.start_browser_release]
description = "Run without Tauri in the browser & watch Typescript and Rust in the release mode"
dependencies = ["store_current_process_id"]
run_task = { fork = true, parallel = true, name = [
"mzoon_start_release_with_cleanup",
"watch_pixi_canvas",
"watch_tauri_glue",
2024-09-30 18:46:29 +00:00
"watch_excalidraw_canvas",
]}
2024-05-27 19:24:46 +00:00
[tasks.bundle]
description = "Compile in the release mode and create installation packages"
dependencies = ["tauri_build", "show_release_paths"]
# @TODO Write task `bundle_browser` once we know whether we need only the frontend
# or also the backend side (Moon server).
# (Don't forget to add the task to the main README.md)
2024-05-27 19:24:46 +00:00
# @TODO: Format also Typescript and CSS
[tasks.format]
description = "Format code"
command = "cargo"
args = ["fmt", "--all"]
###### USEFUL TASKS ######
[tasks.tauri]
description = "Run locally installed tauri"
command = "tauri/bin/cargo-tauri"
args = ["${@}"]
[tasks.mzoon_for_tauri]
description = "Run locally installed mzoon with env var FASTWAVE_PLATFORM=TAURI"
extend = "mzoon_without_env_var_fastwave_platform"
env = { FASTWAVE_PLATFORM = "TAURI" }
2024-05-27 19:24:46 +00:00
[tasks.mzoon]
description = "Run locally installed mzoon with env var FASTWAVE_PLATFORM=BROWSER"
extend = "mzoon_without_env_var_fastwave_platform"
env = { FASTWAVE_PLATFORM = "BROWSER" }
2024-05-27 19:24:46 +00:00
# [tasks.mzoon]
# description = "Run mzoon from a cloned MoonZoon repo"
# command = "cargo"
# args = ["run", "--manifest-path", "../MoonZoon/crates/mzoon/Cargo.toml", "${@}"]
###### HELPER TASKS ######
[tasks.mzoon_without_env_var_fastwave_platform]
description = "Run locally installed mzoo"
command = "mzoon/bin/mzoon"
args = ["${@}"]
2024-05-27 19:24:46 +00:00
[tasks.store_current_process_id]
description = ""
script_runner = "@duckscript"
script = '''
current_process_id = pid
echo Current process id: ${current_process_id}
set_env STORED_PROCESS_ID ${current_process_id}
'''
[tasks.tauri_dev]
description = "Run `tauri dev`"
extend = "tauri"
args = ["dev"]
[tasks.mzoon_start]
description = "Run `mzoon start`"
extend = "mzoon"
args = ["start"]
[tasks.mzoon_start_release]
description = "Run `mzoon start --release`"
extend = "mzoon"
args = ["start", "--release"]
2024-05-27 19:24:46 +00:00
[tasks.tauri_dev_with_cleanup]
description = "Run forked `tauri dev` with cleanup"
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["tauri_dev"] }
[tasks.mzoon_start_with_cleanup]
description = "Run forked `mzoon start` with cleanup"
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["mzoon_start"] }
2024-05-27 19:24:46 +00:00
[tasks.mzoon_start_release_with_cleanup]
description = "Run forked `mzoon start` with cleanup"
run_task = { fork = true, cleanup_task = "kill_watchers", name = ["mzoon_start_release"] }
[tasks.kill_watchers]
2024-05-27 19:24:46 +00:00
description = "Kill the cargo-make/makers process and all its children / forked processes"
script_runner = "@duckscript"
script = '''
os = os_family
if equals ${os} windows
output = exec taskkill /PID ${STORED_PROCESS_ID} /T /F
else
output = exec kill -INT -${STORED_PROCESS_ID}
end
'''
[tasks.tauri_build]
description = "Run `tauri build`"
extend = "tauri"
args = ["build"]
[tasks.show_release_paths]
description = "Show where to find build artifacts"
script_runner = "@duckscript"
script = '''
echo "- See `target/release/` with built `FastWave(.exe)`"
echo "- See `target/release/bundle/` with installation packages"
'''
[tasks.install_wasm_target]
description = "Install Rust target `wasm32-unknown-unknown`"
command = "rustup"
args = ["target", "add", "wasm32-unknown-unknown"]
[tasks.install_tauri]
description = "Install Tauri CLI (tauri) locally"
command = "cargo"
args = [
"install",
2024-12-04 14:15:26 +00:00
"tauri-cli@=2.1.0",
2024-05-27 19:24:46 +00:00
"--locked",
"--root",
"tauri",
]
[tasks.install_mzoon]
description = "Install MoonZoon CLI (mzoon) locally"
command = "cargo"
args = [
"install",
"mzoon",
"--git",
"https://github.com/MoonZoon/MoonZoon",
"--locked",
"--rev",
"fc73b0d90bf39be72e70fdcab4f319ea5b8e6cfc",
"--root",
"mzoon",
]
## pixi_canvas ##
[tasks.init_pixi_canvas]
description = "Initialize `frontend/typescript/pixi_canvas`"
cwd = "frontend/typescript/pixi_canvas"
command = "npm"
args = ["install"]
[tasks.init_pixi_canvas.windows]
command = "npm.cmd"
[tasks.watch_pixi_canvas]
description = "Build and typescheck Typescript on change"
run_task = { fork = true, parallel = true, name = [
"watch_build_pixi_canvas",
"watch_typecheck_pixi_canvas",
]}
[tasks.watch_build_pixi_canvas]
description = "Compile `frontend/typescript/pixi_canvas` on change"
cwd = "frontend/typescript/pixi_canvas"
command = "node_modules/.bin/esbuild"
2024-10-13 10:22:12 +00:00
args = [
"pixi_canvas.ts",
"--bundle",
"--outfile=../bundles/pixi_canvas.js",
"--format=esm",
"--minify",
"--watch"
]
2024-05-27 19:24:46 +00:00
[tasks.watch_build_pixi_canvas.windows]
command = "node_modules/.bin/esbuild.cmd"
[tasks.watch_typecheck_pixi_canvas]
description = "Typecheck `frontend/typescript/pixi_canvas` on change"
cwd = "frontend/typescript/pixi_canvas"
command = "node_modules/.bin/tsc"
args = [
"pixi_canvas.ts",
"--watch",
"--noEmit",
"--preserveWatchOutput",
"--strict",
"--target", "esnext",
"--module", "esnext",
"--moduleResolution", "bundler",
]
[tasks.watch_typecheck_pixi_canvas.windows]
command = "node_modules/.bin/tsc.cmd"
## tauri_glue ##
[tasks.init_tauri_glue]
description = "Initialize `frontend/typescript/tauri_glue`"
cwd = "frontend/typescript/tauri_glue"
command = "npm"
args = ["install"]
[tasks.init_tauri_glue.windows]
command = "npm.cmd"
[tasks.watch_tauri_glue]
description = "Build and typescheck Typescript on change"
run_task = { fork = true, parallel = true, name = [
"watch_build_tauri_glue",
"watch_typecheck_tauri_glue",
]}
[tasks.watch_build_tauri_glue]
description = "Compile `frontend/typescript/tauri_glue` on change"
cwd = "frontend/typescript/tauri_glue"
command = "node_modules/.bin/esbuild"
2024-10-13 10:22:12 +00:00
args = [
"tauri_glue.ts",
"--bundle",
"--outfile=../bundles/tauri_glue.js",
"--format=esm",
"--minify",
"--watch"
]
2024-05-27 19:24:46 +00:00
[tasks.watch_build_tauri_glue.windows]
command = "node_modules/.bin/esbuild.cmd"
[tasks.watch_typecheck_tauri_glue]
description = "Typecheck `frontend/typescript/tauri_glue` on change"
cwd = "frontend/typescript/tauri_glue"
command = "node_modules/.bin/tsc"
args = [
"tauri_glue.ts",
"--watch",
"--noEmit",
"--preserveWatchOutput",
"--strict",
"--target", "esnext",
"--module", "esnext",
"--moduleResolution", "bundler",
]
[tasks.watch_typecheck_tauri_glue.windows]
command = "node_modules/.bin/tsc.cmd"
2024-09-30 18:46:29 +00:00
## excalidraw_canvas ##
2024-09-26 10:45:17 +00:00
2024-09-30 18:46:29 +00:00
[tasks.init_excalidraw_canvas]
description = "Initialize `frontend/typescript/excalidraw_canvas`"
2024-10-01 09:11:13 +00:00
dependencies = [
"init_excalidraw_canvas_npm_install",
"init_excalidraw_canvas_en_json",
]
[tasks.init_excalidraw_canvas_npm_install]
description = "Partly initialize `frontend/typescript/excalidraw_canvas`"
2024-09-30 18:46:29 +00:00
cwd = "frontend/typescript/excalidraw_canvas"
2024-09-26 10:45:17 +00:00
command = "npm"
args = ["install"]
2024-10-01 09:11:13 +00:00
[tasks.init_excalidraw_canvas_npm_install.windows]
2024-09-26 10:45:17 +00:00
command = "npm.cmd"
2024-10-01 09:11:13 +00:00
[tasks.init_excalidraw_canvas_en_json]
description = "Partly initialize `frontend/typescript/excalidraw_canvas`"
cwd = "frontend/typescript/excalidraw_canvas"
command = "cp"
args = ["-r", "locales", "node_modules/@excalidraw/excalidraw/types/"]
2024-09-30 18:46:29 +00:00
[tasks.watch_excalidraw_canvas]
2024-09-26 10:45:17 +00:00
description = "Build and typescheck Typescript on change"
run_task = { fork = true, parallel = true, name = [
2024-09-30 18:46:29 +00:00
"watch_build_excalidraw_canvas",
"watch_typecheck_excalidraw_canvas",
2024-09-26 10:45:17 +00:00
]}
2024-09-30 18:46:29 +00:00
[tasks.watch_build_excalidraw_canvas]
description = "Compile `frontend/typescript/excalidraw_canvas` on change"
cwd = "frontend/typescript/excalidraw_canvas"
2024-09-26 10:45:17 +00:00
command = "node_modules/.bin/esbuild"
2024-10-13 10:22:12 +00:00
args = [
"excalidraw_canvas.tsx",
"--bundle",
"--outfile=../bundles/excalidraw_canvas.js",
"--format=esm",
"--minify",
"--watch",
]
2024-09-26 10:45:17 +00:00
2024-09-30 18:46:29 +00:00
[tasks.watch_build_excalidraw_canvas.windows]
2024-09-26 10:45:17 +00:00
command = "node_modules/.bin/esbuild.cmd"
2024-09-30 18:46:29 +00:00
[tasks.watch_typecheck_excalidraw_canvas]
description = "Typecheck `frontend/typescript/excalidraw_canvas` on change"
cwd = "frontend/typescript/excalidraw_canvas"
2024-09-26 10:45:17 +00:00
command = "node_modules/.bin/tsc"
args = [
2024-10-08 17:26:46 +00:00
"excalidraw_canvas.tsx",
"--jsx", "react",
2024-09-26 10:45:17 +00:00
"--watch",
"--noEmit",
"--preserveWatchOutput",
"--strict",
"--target", "esnext",
"--module", "esnext",
"--moduleResolution", "bundler",
]
2024-09-30 18:46:29 +00:00
[tasks.watch_typecheck_excalidraw_canvas.windows]
2024-09-26 10:45:17 +00:00
command = "node_modules/.bin/tsc.cmd"