[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", "init_excalidraw_canvas", ] [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", "watch_excalidraw_canvas", ]} [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", "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", "watch_excalidraw_canvas", ]} [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) # @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" } [tasks.mzoon] description = "Run locally installed mzoon with env var FASTWAVE_PLATFORM=BROWSER" extend = "mzoon_without_env_var_fastwave_platform" env = { FASTWAVE_PLATFORM = "BROWSER" } # [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 = ["${@}"] [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"] [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"] } [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] 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", "tauri-cli@=2.0.0-beta.17", "--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" args = ["pixi_canvas.ts", "--bundle", "--outfile=../bundles/pixi_canvas.js", "--format=esm", "--watch"] [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" args = ["tauri_glue.ts", "--bundle", "--outfile=../bundles/tauri_glue.js", "--format=esm", "--watch"] [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" ## excalidraw_canvas ## [tasks.init_excalidraw_canvas] description = "Initialize `frontend/typescript/excalidraw_canvas`" cwd = "frontend/typescript/excalidraw_canvas" command = "npm" args = ["install"] [tasks.init_excalidraw_canvas.windows] command = "npm.cmd" [tasks.watch_excalidraw_canvas] description = "Build and typescheck Typescript on change" run_task = { fork = true, parallel = true, name = [ "watch_build_excalidraw_canvas", "watch_typecheck_excalidraw_canvas", ]} [tasks.watch_build_excalidraw_canvas] description = "Compile `frontend/typescript/excalidraw_canvas` on change" cwd = "frontend/typescript/excalidraw_canvas" command = "node_modules/.bin/esbuild" args = ["excalidraw_canvas.ts", "--bundle", "--outfile=../bundles/excalidraw_canvas.js", "--format=esm", "--watch"] [tasks.watch_build_excalidraw_canvas.windows] command = "node_modules/.bin/esbuild.cmd" [tasks.watch_typecheck_excalidraw_canvas] description = "Typecheck `frontend/typescript/excalidraw_canvas` on change" cwd = "frontend/typescript/excalidraw_canvas" command = "node_modules/.bin/tsc" args = [ "excalidraw_canvas.ts", "--watch", "--noEmit", "--preserveWatchOutput", "--strict", "--target", "esnext", "--module", "esnext", "--moduleResolution", "bundler", ] [tasks.watch_typecheck_excalidraw_canvas.windows] command = "node_modules/.bin/tsc.cmd"