@hyperfrontend/features/nx/generators/featurefeature
Nx feature generator. Scaffolds a hyperfrontend feature by delegating to the
SDK's headless hf init (config resolution, contract loading, entry wiring),
staging every write into the Nx tree so --dry-run previews without touching
the disk. It first ensures @hyperfrontend/features is declared in the root
package.json and returns a callback that installs — via the workspace's
@nx/devkit when present, a built-in installer otherwise — only when that
declaration was added. Registered via the package's generators.json.
Usage
nx generate @hyperfrontend/features:feature \
--name=clock --contract=./clock.contract.json --entry=./src/main.ts --directory=apps/clock
| Option | Required | Description |
|---|---|---|
name | yes | Feature name. |
contract | yes | Path to the contract file, relative to the target directory. |
entry | yes | Entry file the generated glue import is wired into. |
directory | no | Directory to scaffold into, relative to the workspace root. |
version | no | Feature version string. |
url | no | URL the generated shell loads the feature from. |
API Reference
ƒ Functions
Scaffold a hyperfrontend feature by delegating to the SDK's
First ensures
hf init. First ensures
@hyperfrontend/features is declared in the workspace root package.json (an existing declaration is left untouched), then forwards options to runInit in headless mode with the SDK's tree seams backed by the Nx tree — every scaffolding write stages into Nx's virtual tree, so nx g ... --dry-run previews the full change set without touching the disk. When the consumer workspace has @nx/devkit installed, staged files are formatted with it before Nx flushes them. The returned callback — run by Nx only after flushing real changes — installs dependencies only when the manifest was changed by this run.Parameters
| Name | Type | Description |
|---|---|---|
§tree | Tree | The Nx virtual file-system tree every write is staged into. |
§options | FeatureGeneratorSchema | Generator options forwarded to the SDK runner. |
Returns
Promise<GeneratorCallback>The post-flush callback that installs when the manifest changed.
Example
Scaffold a feature in a project directory
nx generate \@hyperfrontend/features:feature \
--name=clock --contract=./clock.contract.json --entry=./src/main.ts --directory=apps/clockScaffold a hyperfrontend feature by delegating to the SDK's
First ensures
hf init. First ensures
@hyperfrontend/features is declared in the workspace root package.json (an existing declaration is left untouched), then forwards options to runInit in headless mode with the SDK's tree seams backed by the Nx tree — every scaffolding write stages into Nx's virtual tree, so nx g ... --dry-run previews the full change set without touching the disk. When the consumer workspace has @nx/devkit installed, staged files are formatted with it before Nx flushes them. The returned callback — run by Nx only after flushing real changes — installs dependencies only when the manifest was changed by this run.Parameters
| Name | Type | Description |
|---|---|---|
§tree | Tree | The Nx virtual file-system tree every write is staged into. |
§options | FeatureGeneratorSchema | Generator options forwarded to the SDK runner. |
Returns
Promise<GeneratorCallback>The post-flush callback that installs when the manifest changed.
Example
Scaffold a feature in a project directory
nx generate \@hyperfrontend/features:feature \
--name=clock --contract=./clock.contract.json --entry=./src/main.ts --directory=apps/clock◈ Interfaces
Options for the
feature generator; mirrors schema.json.