cargo ux generate

This is a Draft Version

Generates and/or modifies files based on a schematic.

cargo ux generate <schematic> [options]
cargo ux g <schematic> [options]

Arguments

ArgumentDescriptionValue Type
schematicThe schematic or collection:schematic to generate.
This option can take one of the following sub-commands: app-shell, application, class, component, directive, enum, guard, interceptor, interface, library , module, pipe , resolver, service, service-worker, web-workerstring

Options

OptionDescriptionValue TypeDefault Value
--defaultsDisable interactive input prompts for options with a default.boolean
--dry-runRun through and reports activity without writing out results. Aliases: -dbooleanfalse
--forceForce overwriting of existing files. Aliases: -fbooleanfalse
--helpShows a help message for this command in the console.true|false|jsonfalse
--interactiveEnable interactive input prompts.boolean

Schematic commands

app-shell

cargo ux generate app-shell [options]
cargo ux g app-shell [options]

Generates an app shell for running a server-side version of an app.

Options

OptionDescriptionValue TypeDefault Value
--app-dirThe name of the application directory.stringapp
--app-idThe app ID to use in withServerTransition().stringserverApp
--client-projectThe name of the related client app.string
--mainThe name of the main entry-point file.stringmain.server.rs
--root-module-class-nameThe name of the root module class.stringAppServerModule
--root-module-file-nameThe name of the root module filestringapp.server.module.rs
--routeRoute path used to produce the app shell.stringshell

application

cargo ux generate application <name> [options]
cargo ux g application <name> [options]

Generates a new basic app definition in the "projects" subfolder of the workspace.

Arguments

ArgumentDescriptionValue Type
nameThe name of the new app.string

Options

OptionDescriptionValue TypeDefault Value
--inline-styleInclude styles inline in the root component.rs file. Only CSS styles can be included inline. Default is false, meaning that an external styles file is created and referenced in the root component.rs file. Aliases: -sboolean
--inline-templateInclude template inline in the root component.rs file. Default is false, meaning that an external template file is created and referenced in the root component.rs file. Aliases: -tboolean
--legacy-browsersAdd support for legacy browsers like Internet Explorer using differential loading.booleanfalse
--minimalCreate a bare-bones project without any testing frameworks. (Use for learning purposes only.)booleanfalse
--prefixA prefix to apply to generated selectors. Aliases: -pstringapp
--routingCreate a routing module.booleanfalse
--skip-installSkip installing dependency packages.booleanfalse
--skip-package-jsonDo not add dependencies to the "package.yaml" file.booleanfalse
--skip-testsDo not create "spec.rs" test files for the application. Aliases: -Sbooleanfalse
--strictCreates an application with stricter bundle budgets settings.booleanfalse
--view-encapsulationThe view encapsulation strategy to use in the new app.Emulated|None|\ShadowDom

class

cargo ux generate class <name> [options]
cargo ux g class <name> [options]

Creates a new generic class definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the new class.string

Options

OptionDescriptionValue TypeDefault Value
--projectThe name of the project.string
--skip-testsDo not create "spec.rs" test files for the new class.booleanfalse
--typeAdds a developer-defined type to the filename, in the format "name.type.rs".string

component

cargo ux generate component <name> [options]
cargo ux g component <name> [options]

Creates a new generic component definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the component.string

Options

OptionDescriptionValue TypeDefault Value
--change-detectionThe change detection strategy to use in the new component. Aliases: -cDefault|OnPushDefault
--display-blockSpecifies if the style will contain :host { display: block; }. Aliases: -bbooleanfalse
--exportThe declaring module exports this component.booleanfalse
--flatCreate the new files at the top level of the current project.booleanfalse
--inline-styleInclude styles inline in the component.rs file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.rs file. Aliases: -sbooleanfalse
--inline-templateInclude template inline in the component.rs file. By default, an external template file is created and referenced in the component.rs file. Aliases: -tbooleanfalse
--moduleThe declaring module. Aliases: -mstring
--prefixThe prefix to apply to the generated component selector. Aliases: -pstring
--projectThe name of the project.string
--selectorThe HTML selector to use for this component.string
--skip-importDo not import this component into the owning module.booleanfalse
--skip-selectorSpecifies if the component should have a selector or not.booleanfalse
--skip-testsDo not create "spec.rs" test files for the new component.booleanfalse
--typeAdds a developer-defined type to the filename, in the format "name.type.rs".stringComponent
--view-encapsulationThe view encapsulation strategy to use in the new component. Aliases: -vEmulated|None|ShadowDom

directive

cargo ux generate directive <name> [options]
cargo ux g directive <name> [options]

Creates a new generic directive definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the new directive.string

Options

OptionDescriptionValue TypeDefault Value
--exportThe declaring module exports this directive.booleanfalse
--flatWhen true (the default), creates the new files at the top level of the current project.booleantrue
--moduleThe declaring module. Aliases: -mstring
--prefixA prefix to apply to generated selectors. Aliases: -pstring
--projectThe name of the project.string
--selectorThe HTML selector to use for this directive.string
--skip-importDo not import this directive into the owning module.booleanfalse
--skip-testsDo not create "spec.rs" test files for the new class.booleanfalse

enum

cargo ux generate enum <name> [options]
cargo ux g enum <name> [options]

Generates a new, generic enum definition for the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the enum.string

Options

OptionDescriptionValue TypeDefault Value
--projectThe name of the project in which to create the enum. Default is the configured default project for the workspace.string

guard

cargo ux generate guard <name> [options]
cargo ux g guard <name> [options]

Generates a new, generic route guard definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the new route guard.string

Options

OptionDescriptionValue TypeDefault Value
--flatWhen true (the default), creates the new files at the top level of the current project.booleantrue
--implementsSpecifies which interfaces to implement.array
--projectThe name of the project.string
--skip-testsDo not create "spec.rs" test files for the new guard.booleanfalse

interceptor

cargo ux generate interceptor <name> [options]
cargo ux g interceptor <name> [options]

Creates a new, generic interceptor definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the interceptor.string

Options

OptionDescriptionValue TypeDefault Value
--flatWhen true (the default), creates files at the top level of the project.booleantrue
--projectThe name of the project.string
--skip-testsDo not create "spec.rs" test files for the new interceptor.booleanfalse

interface

cargo ux generate interface <name> <type> [options]
cargo ux g interface <name> <type> [options]

Creates a new generic interface definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the interface.string
typeAdds a developer-defined type to the filename, in the format "name.type.rs".string

Options

OptionDescriptionValue TypeDefault Value
--prefixA prefix to apply to generated selectors.string
--projectThe name of the project.string

library

cargo ux generate library <name> [options]
cargo ux g library <name> [options]

Creates a new generic library project in the current workspace.

Arguments

ArgumentDescriptionValue Type
nameThe name of the library.string

Options

OptionDescriptionValue TypeDefault Value
--entry-fileThe path at which to create the library's public API file, relative to the workspace root.stringpublic-api
--prefixA prefix to apply to generated selectors. Aliases: -pstringlib
--skip-installDo not install dependency packages.booleanfalse
--skip-package-yamlDo not add dependencies to the "package.yaml" file.booleanfalse

module

cargo ux generate module <name> [options]
cargo ux g module <name> [options]

Creates a new generic module definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the module.string

Options

OptionDescriptionValue TypeDefault Value
--flatCreate the new files at the top level of the current project root.booleanfalse
--moduleThe declaring module. Aliases: -mstring
--projectThe name of the project.string
--routeThe route path for a lazy-loaded module. When supplied, creates a component in the new module, and adds the route to that component in the Routes array declared in the module provided in the --module option.string
--routingCreate a routing module.booleanfalse
--routing-scopeThe scope for the new routing module.Child|RootChild

pipe

cargo ux generate pipe <name> [options]
cargo ux g pipe <name> [options]

Creates a new generic pipe definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the pipe.string

Options

OptionDescriptionValue TypeDefault Value
--exportThe declaring module exports this pipe.booleanfalse
--flatWhen true (the default) creates files at the top level of the project.booleantrue
--moduleThe declaring module. Aliases: -mstring
--projectThe name of the project.string
--skip-importDo not import this pipe into the owning module.booleanfalse
--skip-testsDo not create "spec.rs" test files for the new pipe.booleanfalse

resolver

cargo ux generate resolver <name> [options]
cargo ux g resolver <name> [options]

Generates a new, generic resolver definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the new resolver.string

Options

OptionDescriptionValue TypeDefault Value
--flatWhen true (the default), creates the new files at the top level of the current project.booleantrue
--projectThe name of the project.string
--skip-testsDo not create "spec.rs" test files for the new resolver.booleanfalse

service

cargo ux generate service <name> [options]
cargo ux g service <name> [options]

Creates a new, generic service definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the service.string

Options

OptionDescriptionValue TypeDefault Value
--flatWhen true (the default), creates files at the top level of the project.booleantrue
--projectThe name of the project.string
--skip-testsDo not create "spec.rs" test files for the new service.booleanfalse

service-worker

cargo ux generate service-worker [options]
cargo ux g service-worker [options]

Pass this schematic to the "run" command to create a service worker

Options

OptionDescriptionValue TypeDefault Value
--configurationThe configuration to apply service worker to.stringproduction
--projectThe name of the project.string
--targetThe target to apply service worker to.stringbuild

web-worker

cargo ux generate web-worker <name> [options]
cargo ux g web-worker <name> [options]

Creates a new generic web worker definition in the given or default project.

Arguments

ArgumentDescriptionValue Type
nameThe name of the worker.string

Options

OptionDescriptionValue TypeDefault Value
--projectThe name of the project.string
--snippetAdd a worker creation snippet in a sibling file of the same name.booleantrue
--targetThe target to apply web worker to.stringbuild