Skip to main content

Module new_module

Module new_module 

Source
Expand description

whisker new-module <name> — scaffold a Whisker module crate.

Creates a directory matching the supplied crate name with a complete module skeleton: Cargo.toml (carrying the [package.metadata.whisker] discovery marker), Package.swift, build.gradle.kts, src/lib.rs, and the platform sources under ios/ and android/ (Expo-style layout). The skeleton compiles standalone — the consumer just runs cargo build and adds the crate as a dep to their Whisker app.

Naming convention: input is the cargo crate name (kebab-case, whisker-foo). The PascalCase tag (Foo), the module class (FooModule), and (for view-bearing modules) the view class (FooView) are derived. Lynx registers a view-bearing module’s element under <crate-name>:<tag> (whisker-foo:Foo).

Modules are authored with the ModuleDefinition DSL: a class subclasses Module and overrides definition(). Subclassing the base IS the registration trigger — the per-platform codegen (SwiftPM build plugin / KSP) finds every concrete Module subclass and emits the Lynx registration. Phase M (Issue #59) dropped the previously-companion @WhiskerModule marker annotation.

This is a minimal scaffolder — it copies a small set of inline templates and substitutes a handful of variables. For a richer template story (multiple module types, custom dirs, …) the whisker new-module subcommand can grow later without breaking the contract documented in docs/module-author-guide.md.

Structs§

NewModuleArgs
whisker new-module CLI arguments.

Enums§

ModuleShape

Functions§

run