mix dala.new (dala_new v0.0.3)

Copy Markdown View Source

Creates a new Dala project with Android and iOS boilerplate.

  mix dala.new APP_NAME [--liveview] [--ios | --android] [--no-install] [--dest DIR] [--local]

## Platform selection

By default the generator emits boilerplate for both Android and iOS. Pass one of the platform flags to scope it to a single platform:

  mix dala.new my_app --ios        # iOS only — no android/ directory generated
  mix dala.new my_app --android    # Android only — no ios/ directory generated
  mix dala.new my_app              # both (default)

--no-ios and --no-android are equivalent inverse forms (kept for back-compat). mix dala.install, mix dala.deploy, and mix dala.doctor detect the project's platform set from on-disk layout, so a single-platform project skips the absent platform's setup automatically.

Options

  • --liveview — generate a Phoenix LiveView app wrapped in a Dala WebView.
                   mix dala.new my_app --liveview      generate a Phoenix LiveView app wrapped in a Dala WebView.
                                            Calls `mix phx.new` to scaffold a Phoenix project, then
                                            adds the Dala native boilerplate and LiveView bridge patches
                                            (DalaHook in app.js, dala-bridge element in root.html.heex,
                                            DalaScreen, dala.exs with liveview_port). Requires
                                            `phx_new` archive to be installed (`mix archive.install hex phx_new`).
  • --ios — generate iOS boilerplate only (skip android/)
  • --android — generate Android boilerplate only (skip ios/)
  • --no-ios — alias for --android (skip iOS boilerplate)
  • --no-android — alias for --ios (skip Android boilerplate)
  • --no-install — skip running mix deps.get after generation
  • --dest DIR — create project in DIR (default: current directory)
  • --local — use path: deps pointing to local dala/dala_dev repos
                       instead of hex version constraints. **For Dala framework
                       contributors only**  not intended for app developers.
                       Paths resolved from `DALA_DIR` / `DALA_DEV_DIR` env vars,
                       falling back to `./dala` / `./dala_dev`, then `../dala` /
                       `../dala_dev`. Also pre-fills `dala.exs` with real paths
                       so `mix dala.install` skips path configuration prompts.

What gets generated (native mode, default)

APP_NAME/
  mix.exs
  lib/APP_NAME/app.ex
  lib/APP_NAME/home_screen.ex
  android/
    settings.gradle
    build.gradle
    app/
      build.gradle
      src/main/
        AndroidManifest.xml
        java/com/dala/APP_NAME/MainActivity.kt
        java/com/dala/APP_NAME/DalaBridge.kt
        java/com/dala/APP_NAME/DalaNode.kt
        java/com/dala/APP_NAME/DalaScannerActivity.kt
    gradle.properties
  ios/
    beam_main.m
    Info.plist

What gets generated (--liveview mode)

Everything mix phx.new APP_NAME --no-install generates, plus:

APP_NAME/
  lib/APP_NAME/dala_screen.ex      # Dala.Screen wrapping the Phoenix WebView
  dala.exs                          # Dala config with liveview_port: 4000
  android/                         # same Android boilerplate as native mode
  ios/                             # same iOS boilerplate as native mode

Patches applied to the Phoenix project:

  • assets/js/app.js — DalaHook definition + registration
  • lib/APP_NAME_web/.../root.html.heex — dala-bridge hidden div
  • lib/APP_NAME/application.ex — Dala.App child in supervision tree
  • mix.exs — dala / dala_dev deps added

After generation, run:

cd APP_NAME
mix dala.install    # icon generation + any first-run setup