Skip to content

Latest commit

 

History

History
102 lines (77 loc) · 2.92 KB

cli.md

File metadata and controls

102 lines (77 loc) · 2.92 KB

CLI - mzoon


mzoon is a MoonZoon CLI tool.

_

You'll be able to install mzoon with Cargo:

cargo install --locked mzoon

and faster installation methods with pre-compiled binaries will follow.

  • Notes:
    • You can use the demo as a template for your new project for now.
    • Why --locked?

Commands

1. new

  • Example: mzoon new my_project
  • Creates a new directory with a new MoonZoon project.
  • Optional parameters:
    1. --here / -h
      • Example: mzoon new my_project --here
      • Creates the project in the current directory.
  • Question: Do you think a code tour would be useful for you?
  • Note: Not implemented yet, use MoonZoon/demo as a starting project.

2. start

  • Example: mzoon start
  • Compiles the app in the debug mode and then starts the Moon's server.
  • Both Moon and Zoon apps are automatically recompiled on a file change.
  • The Moon app auto-reloads the Zoon app on a change.
  • Optional parameters:
    1. --release / -r
      • Example: mzoon start --release
      • Compiles in the release mode and compresses frontend files.
    2. --open / -o
      • Example: mzoon start --open
      • Opens the Zoon's URL in a new browser tab (e.g. localhost:8080)

3. build

  • Example: mzoon build
  • Compiles the app in the debug mode.
  • Optional parameters:
    1. --release / -r
      • Example: mzoon build --release
      • Compiles in the release mode and compresses frontend files.

MoonZoon.toml

  • The configuration file located in the app root directory.
port = 8080
# port = 8443
https = false
cache_busting = true # add UUID to file names - e.g. `frontend_bg_[uuid].wasm`
backend_log_level = "warn" # "error" / "warn" / "info" / "debug" / "trace"

[redirect] # useful for HTTP -> HTTPS redirect
port = 8081
enabled = false

[watch]
frontend = [
    "frontend/Cargo.toml",
    "frontend/src",
]
backend = [
    "backend/Cargo.toml",
    "backend/src",
]

FAQ

  1. "What about other commands like deploy and test?"

    • Other commands will be added later.
    • You can use standard cargo test for testing the backend side.
    • mzoon build automatically installs wasm-pack in the frontend directory. So you can use wasm-pack directly for testing.
  2. "How can I change the port number or enable HTTPS?"

    • For development: Update settings in MoonZoon.toml (see MoonZoon.toml above or /examples/counter/MoonZoon.toml)

    • For production: Set environment variables (see /crates/moon/src/config.rs)

  3. "Some commands or parameters mentioned above don't work!"

    • They are probably not implemented yet.
  4. "What is a new project file structure?"