CLI Overview and Command Reference

This is a Draft Version

The cargo-ux is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular Rust applications directly from a command shell.

Installing cargo-ux

Major versions of cargo-ux follow the supported major version of Angular Rust, but minor versions can be released separately.

Install the CLI using the cargo package manager:

cargo install cargo-ux

For details about changes between versions, and information about updating from previous releases, see the Releases tab on GitHub: https://github.com/angular/angular-cli/releases

Basic workflow

Invoke the tool on the command line through the cargo-ux executable. Online help is available on the command line. Enter the following to list commands or options for a given command (such as generate) with a short description.

cargo ux help
cargo ux generate --help

To create, build, and serve a new, basic Angular Rust project on a development server, go to the parent directory of your new workspace use the following commands:

cargo ux new my-first-project
cd my-first-project
cargo ux serve

In your browser, open http://localhost:4200/ to see the new app run. When you use the cargo ux serve command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.

When you run cargo ux new my-first-project a new folder, named my-first-project, will be created in the current working directory. Since you want to be able to create files inside that folder, make sure you have sufficient rights in the current working directory before running the command.

If the current working directory is not the right place for your project, you can change to a more appropriate directory by running cd first.

Workspaces and project files

The cargo ux new command creates an Angular Rust workspace folder and generates a new app skeleton. A workspace can contain multiple apps and libraries. The initial app created by the cargo ux new command is at the top level of the workspace. When you generate an additional app or library in a workspace, it goes into a projects/ subfolder.

A newly generated app contains the source files for a root module, with a root component and template. Each app has a src folder that contains the logic, data, and assets.

You can edit the generated files directly, or add to and modify them using CLI commands. Use the cargo ux generate command to add new files for additional components and services, and code for new pipes, directives, and so on. Commands such as add and generate, which create or operate on apps and libraries, must be executed from within a workspace or project folder.

See more about the Workspace file structure.

Workspace and project configuration

A single workspace configuration file, ux.yaml, is created at the top level of the workspace. This is where you can set per-project defaults for CLI command options, and specify configurations to use when the CLI builds a project for different targets.

The cargo ux config command lets you set and retrieve configuration values from the command line, or you can edit the ux.yaml file directly. Note that option names in the configuration file must use camelCase, while option names supplied to commands can use either camelCase or dash-case.

See more about Workspace Configuration.
See the complete schema for ux.yaml.

CLI command-language syntax

Command syntax is shown as follows:

cargo ux commandNameOrAlias requiredArg [optionalArg] [options]

  • Most commands, and some options, have aliases. Aliases are shown in the syntax statement for each command.

  • Option names are prefixed with a double dash (--). Option aliases are prefixed with a single dash (-). Arguments are not prefixed. For example:

cargo ux build my-app -c production
  • Typically, the name of a generated artifact can be given as an argument to the command or specified with the --name option.
  • Argument and option names can be given in either camelCase or dash-case. --myOptionName is equivalent to --my-option-name.

Boolean options

Boolean options have two forms: --this-option sets the flag to true, --no-this-option sets it to false. If neither option is supplied, the flag remains in its default state, as listed in the reference documentation.

Relative paths

Options that specify files can be given as absolute paths, or as paths relative to the current working directory, which is generally either the workspace or project root.

Schematics

The cargo ux generate and cargo ux add commands take as an argument the artifact or library to be generated or added to the current project. In addition to any general options, each artifact or library defines its own options in a schematic. Schematic options are supplied to the command in the same format as immediate command options.

Command Overview

CommandAliasDescription
addAdds support for an external library to your project.
analyticsConfigures the gathering of cargo-ux usage metrics. See https://angular-rust.github.io/cargo-ux/usage-analytics-gathering.
buildbCompiles an Angular Rust app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.
configRetrieves or sets Angular Rust configuration values in the ux.yaml file for the workspace.
deployInvokes the deploy builder for a specified project or for the default project in the workspace.
docdOpens the official Angular Rust documentation (angular-rust.github.io) in a browser, and searches for a given keyword.
e2eeBuilds and serves an Angular Rust app, then runs end-to-end tests using Protractor.
extract-i18ni18n-extract xi18nExtracts i18n messages from source code.
generategGenerates and/or modifies files based on a schematic.
helpLists available commands and their short descriptions.
lintlRuns linting tools on Angular Rust app code in a given project folder.
newnCreates a new workspace and an initial Angular Rust application.
runRuns an Architect target with an optional custom builder configuration defined in your project.
servesBuilds and serves your app, rebuilding on file changes.
testtRuns unit tests in a project.
updateUpdates your application and its dependencies.
versionvOutputs cargo-ux version.

Gathering and Viewing Usage Analytics

This is a Draft Version

Users can opt in to share their cargo-ux usage data with Google Analytics, using the ng analytics CLI command. The data is also shared with the Angular Rust team, and used to improve the CLI.

The gathering of CLI analytics data is disabled by default, and must be enabled at the project level by individual users. It cannot be enabled at the project level for all users.

Data gathered in this way can be viewed on the Google Analytics site, but is not automatically visible on your own organization's Analytics site. As an administrator for an Angular Rust development group, you can configure your instance of cargo-ux to be able to see analytics data for your own team's usage of the cargo-ux. This configuration option is separate from and in addition to other usage analytics that your users may be sharing with Google.

Enable access to CLI usage data

To configure access to your own users' CLI usage data, use the ng config command to add a key to your global ux.yaml workspace configuration file. The key goes under cli.analyticsSharing at the top level of the file, outside the projects sections. The value of the key is your organization's tracking ID, as assigned by Google Analytics. This ID is a string that looks like UA-123456-12.

You can choose to use a descriptive string as the key value, or be assigned a random key when you run the CLI command. For example, the following command adds a configuration key named "tracking".

cargo ux config --global cli.analyticsSharing.tracking UA-123456-12

To turn off this feature, run the following command:

cargo ux config --global --remove cli.analyticsSharing

Per user tracking

You can add a custom user ID to the global configuration, in order to identify unique usage of commands and flags. If that user enables CLI analytics for their own project, your analytics display tracks and labels their individual usage.

cargo ux config --global cli.analyticsSharing.user SOME_USER_NAME

To generate a new random user ID, run the following command:

cargo ux config --global cli.analyticsSharing.user ""

cargo ux add

This is a Draft Version

Adds support for an external library to your project.

cargo ux add <collection> [options]

Description

Adds the cargo package for a published library to your workspace, and configures the project in the current working directory (or the default project if you are not in a project directory) to use that library, as specified by the library's schematic. For example, adding @angular/pwa configures your project for PWA support:

cargo ux add @angular/pwa

The default project is the value of defaultProject in ux.yaml.

Arguments

ArgumentDescriptionValue Type
collectionThe package to be added.string

Options

OptionDescriptionValue TypeDefault Value
--defaultsDisable interactive input prompts for options with a default.boolean
--helpShows a help message for this command in the console.true|false|jsonfalse
--interactiveEnable interactive input prompts.boolean
--registryThe registry to use.string
--verboseDisplay additional details about internal operations during execution.booleanfalse

cargo ux analytics

This is a Draft Version

Configures the gathering of cargo-ux usage metrics. See https://angular-rust.github.io/cargo-ux/usage-analytics-gathering.

cargo ux analytics <setting-or-project> <project-setting> [options]

Description

The value of settingOrProject is one of the following.

  • "on" : Enables analytics gathering and reporting for the user.
  • "off" : Disables analytics gathering and reporting for the user.
  • "ci" : Enables analytics and configures reporting for use with Continuous Integration, which uses a common CI user.
  • "prompt" : Prompts the user to set the status interactively.
  • "project" : Sets the default status for the project to the projectSetting value, which can be any of the other values. The projectSetting argument is ignored for all other values of settingOrProject.

Arguments

ArgumentDescriptionValue Type
setting-or-projectDirectly enables or disables all usage analytics for the user, or prompts the user to set the status interactively, or sets the default status for the project.on|off|ci|project|prompt
project-settingSets the default analytics enablement status for the project.on|off|prompt

Options

OptionDescriptionValue TypeDefault Value
--helpShows a help message for this command in the console.true|false|jsonfalse

cargo ux build

This is a Draft Version

Compiles an Angular Rust app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.

cargo ux build <project> [options]
cargo ux b <project> [options]

Description

The command can be used to build a project of type "application" or "library". When used to build a library, a different builder is invoked, configuration, and watch options are applied. All other options apply only to building applications.

The application builder uses the Ninja build tool, with default configuration options specified in the workspace configuration file (ux.yaml) or with a named alternative configuration. A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the --configuration="production" or the --prod option.

The configuration options generally correspond to the command options. You can override individual configuration defaults by specifying the corresponding options on the command line. The command can accept option names given in either dash-case or camelCase. Note that in the configuration file, you must specify names in camelCase.

Some additional options can only be set through the configuration file, either by direct editing or with the ng config command. These include assets, styles, and scripts objects that provide runtime-global resources to include in the project. Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.

For further details, see Workspace Configuration.

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to build. Can be an application or a library.string

Options

OptionDescriptionValue TypeDefault Value
--allowed-common-js-dependenciesA list of CommonJS packages that are allowed to be used without a build time warning.array
--aotBuild using Ahead of Time compilation.booleanfalse
--base-hrefBase url for the application being built.string
--build-optimizerEnables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option.booleanfalse
--common-chunkGenerate a seperate bundle containing code used across multiple bundles.booleantrue
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Setting this explicitly overrides the "--prod" flag. Aliases: -cstring
--cross-originDefine the crossorigin attribute setting of elements that provide CORS support.none|anonymous|use-credentialsnone
--delete-output-pathDelete the output path before building.booleantrue
--deploy-urlURL where files will be deployed.string
--extract-licensesExtract all licenses in a separate file.booleanfalse
--fork-type-checkerRun the type checker in a forked process.booleantrue
--helpShows a help message for this command in the console.true|false|jsonfalse
--i18n-missing-translationHow to handle missing translations for i18n.warning|error|ignorewarning
--indexConfigures the generation of the application's HTML index.string
--localizeTranslate the bundles in one or more locales.boolean
--mainThe full path for the main entry point to the app, relative to the current workspace.string
--named-chunksUse file name for lazy loaded chunks.booleantrue
--optimizationEnables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular-rust.github.io/guide/workspace-config#optimization-configuration.booleanfalse
--output-hashingDefine the output filename cache-busting hashing mode.none|all|media|bundlesnone
--output-pathThe full path for the new output directory, relative to the current workspace. By default, writes output to a folder named dist/ in the current project.string
--pollEnable and define the file watching poll time period in milliseconds.number
--polyfillsThe full path for the polyfills file, relative to the current workspace.string
--preserve-symlinksDo not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set.boolean
--prodShorthand for "--configuration=production". Set the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.boolean
--progressLog progress to the console while building.booleantrue
--resources-output-pathThe path where style resources will be placed, relative to outputPath.string
--service-workerGenerates a service worker config for production builds.booleanfalse
--show-circular-dependenciesShow circular dependency warnings on builds.booleantrue
--source-mapOutput source maps for scripts and styles. For more information, see https://angular-rust.github.io/guide/workspace-config#source-map-configuration.booleantrue
--stats-jsonGenerates a 'stats.json' file which can be analyzed later.booleanfalse
--subresource-integrityEnables the use of subresource integrity validation.booleanfalse
--vendor-chunkGenerate a seperate bundle containing only vendor libraries. This option should only used for development.booleantrue
--verboseAdds more details to output logging.booleanfalse
--watchRun build when files change.booleanfalse

cargo ux config

This is a Draft Version

Retrieves or sets Angular Rust configuration values in the ux.yaml file for the workspace.

cargo ux config <json-path> <value> [options]

Arguments

ArgumentDescriptionValue Type
json-pathThe configuration key to set or query, in JSON path format. For example: "a[3].foo.bar[2]". If no new value is provided, returns the current value of this key.string
valueIf provided, a new value for the given configuration key.string

Options

OptionDescriptionValue TypeDefault Value
--globalAccess the global configuration in the caller's home directory. Aliases: -gbooleanfalse
--helpShows a help message for this command in the console.true|false|jsonfalse

cargo ux deploy

This is a Draft Version

Invokes the deploy builder for a specified project or for the default project in the workspace.

cargo ux deploy <project> [options]

Description

The command takes an optional project name, as specified in the projects section of the ux.yaml workspace configuration file. When a project name is not supplied, executes the deploy builder for the default project.

To use the cargo ux deploy command, use cargo ux add to add a package that implements deployment capabilities to your favorite platform. Adding the package automatically updates your workspace configuration, adding a deployment CLI builder. For example:

"projects": {
  "my-project": {
    ...
    "architect": {
      ...
      "deploy": {
        "builder": "@angular/fire:deploy",
        "options": {}
      }
    }
  }
}

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to deploy.string

Options

OptionDescriptionValue TypeDefault Value
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Aliases: -cstring
--helpShows a help message for this command in the console.true|false|jsonfalse

cargo ux doc

This is a Draft Version

Opens the official Angular Rust documentation (angular-rust.github.io) in a browser, and searches for a given keyword.

cargo ux doc <keyword> [options]
cargo ux d <keyword> [options]

Arguments

ArgumentDescriptionValue Type
keywordThe keyword to search for, as provided in the search bar in angular-rust.github.io.string

Options

OptionDescriptionValue TypeDefault Value
--helpShows a help message for this command in the console.true|false|jsonfalse
--searchSearch all of angular-rust.github.io. Otherwise, searches only API reference documentation. Aliases: -sbooleanfalse
--versionContains the version of Angular Rust to use for the documentation. If not provided, the command uses your current Angular Rust core version.number

cargo ux e2e

This is a Draft Version

Builds and serves an Angular Rust app, then runs end-to-end tests using Protractor.

cargo ux e2e <project> [options]
cargo ux e <project> [options]

Description

Must be executed from within a workspace directory. When a project name is not supplied, it will execute for all projects.

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to build. Can be an application or a library.string

Options

OptionDescriptionValue TypeDefault Value
--base-urlBase URL for protractor to connect to.string
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Setting this explicitly overrides the "--prod" flag. Aliases: -cstring
--dev-server-targetA dev-server builder target to run tests against in the format of project:target[:configuration]. You can also pass in more than one configuration name as a comma-separated list. Example: project:target:production,staging.string
--grepExecute specs whose names match the pattern, which is internally compiled to a RegExp.string
--helpShows a help message for this command in the console.true|false|jsonfalse
--hostHost to listen on.string
--invert-grepInvert the selection specified by the 'grep' option.boolean
--portThe port to use to serve the application.number
--prodShorthand for "--configuration=production". Set the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.boolean
--protractor-configThe name of the Protractor configuration file.string
--specsOverride specs in the protractor config.array
--suiteOverride suite in the protractor config.string
--webdriver-updateTry to update webdriver.booleantrue

cargo ux extract-i18n

This is a Draft Version

Extracts i18n messages from source code.

cargo ux extract-i18n <project> [options]
cargo ux i18n-extract <project> [options]
cargo ux xi18n <project> [options]

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to build. Can be an application or a library.string

Options

OptionDescriptionValue TypeDefault Value
--browser-targetA browser builder target to extract i18n messages in the format of project:target[:configuration]. You can also pass in more than one configuration name as a comma-separated list. Example: project:target:production,staging.string
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Setting this explicitly overrides the "--prod" flag. Aliases: -cstring
--formatOutput format for the generated file.xmb|xlf|xlif|xliff|xlf2|xliff2|json|arbxlf
--helpShows a help message for this command in the console.true|false|jsonfalse
--ivyUse Ivy compiler to extract translations. The default for Ivy applications.boolean
--out-fileName of the file to output.string
--output-pathPath where output will be placed.string
--prodShorthand for "--configuration=production". Set the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.boolean
--progressLog progress to the console.booleantrue

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

cargo ux help

This is a Draft Version

Lists available commands and their short descriptions.

cargo ux help [options]

Description

For help with individual commands, use the --help or -h option with the command.

For example,

cargo ux help serve

Options

OptionDescriptionValue TypeDefault Value
--helpShows a help message for this command in the console.true|false|jsonfalse

cargo ux lint

This is a Draft Version

Runs linting tools on Angular Rust app code in a given project folder.

cargo ux lint <project> [options]
cargo ux l <project> [options]

Description

Takes the name of the project, as specified in the projects section of the ux.yaml workspace configuration file. When a project name is not supplied, it will execute for all projects.

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to lint.string

Options

OptionDescriptionValue TypeDefault Value
--configurationThe linting configuration to use. Aliases: -cstring
--excludeFiles to exclude from linting.array
--filesFiles to include in linting.array
--fixFixes linting errors (may overwrite linted files).booleanfalse
--forceSucceeds even if there was linting errors.booleanfalse
--formatOutput format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist).stringstylish
--helpShows a help message for this command in the console.true|false|jsonfalse
--silentShow output text.booleanfalse
--type-checkControls the type check for linting.booleanfalse

cargo ux new

This is a Draft Version

Creates a new workspace and an initial Angular Rust application.

cargo ux new <name> [options]
cargo ux n <name> [options]

Description

Creates and initializes a new Angular Rust application that is the default project for a new workspace.

Provides interactive prompts for optional configuration, such as adding routing support. All prompts can safely be allowed to default.

  • The new workspace folder is given the specified project name, and contains configuration files at the top level.

  • By default, the files for a new initial application (with the same name as the workspace) are placed in the src/ subfolder. Corresponding end-to-end tests are placed in the e2e/ subfolder.

  • The new application's configuration appears in the projects section of the ux.yaml workspace configuration file, under its project name.

  • Subsequent applications that you generate in the workspace reside in the projects/ subfolder.

If you plan to have multiple applications in the workspace, you can create an empty workspace by setting the --createApplication option to false. You can then use cargo ux generate application to create an initial application. This allows a workspace name different from the initial app name, and ensures that all applications reside in the /projects subfolder, matching the structure of the configuration file.

Arguments

Argument | Description Value Type name | The name of the new workspace and initial project. | string

Options

OptionDescriptionValue TypeDefault Value
--collectionA collection of schematics to use in generating the initial application. Aliases: -cstring
--commitInitial git repository commit information.booleantrue
--create-applicationCreate a new initial application project in the 'src' folder of the new workspace. When false, creates an empty workspace with no initial application. You can then use the generate application command so that all applications are created in the projects folder.booleantrue
--defaultsDisable interactive input prompts for options with a default.boolean
--directoryThe directory name to create the workspace in.string
--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
--inline-styleInclude styles inline in the component file. By default, an external styles file is created and referenced in the component file. Aliases: -sboolean
--inline-templateInclude template inline in the component file. By default, an external template file is created and referenced in the component file. Aliases: -tboolean
--interactiveEnable interactive input prompts.boolean
--legacy-browsersAdd support for legacy browsers like Internet Explorer using differential loading.booleanfalse
--minimalCreate a workspace without any testing frameworks. (Use for learning purposes only.)booleanfalse
--new-project-rootThe path where new projects will be created, relative to the new workspace root.stringprojects
--prefixThe prefix to apply to generated selectors for the initial project. Aliases: -pstringapp
--routingGenerate a routing module for the initial project.boolean
--skip-gitDo not initialize a git repository. Aliases: -gbooleanfalse
--skip-installDo not install dependency packages.booleanfalse
--skip-testsDo not generate "spec.rs" test files for the new project. Aliases: -Sbooleanfalse
--strictCreates a workspace with stricter type checking and stricter bundle budgets settings. This setting helps improve maintainability and catch bugs ahead of time. For more information, see https://angular-rust.github.io/guide/strict-modebooleanfalse
--verboseAdd more details to output logging. Aliases: -vbooleanfalse
--view-encapsulationThe view encapsulation strategy to use in the initial project.Emulated|None|ShadowDom

cargo ux run

This is a Draft Version

Runs an Architect target with an optional custom builder configuration defined in your project.

cargo ux run <target> [options]

Description

Architect is the tool that the CLI uses to perform complex tasks such as compilation, according to provided configurations. The CLI commands run Architect targets such as build, serve, test, and lint. Each named target has a default configuration, specified by an "options" object, and an optional set of named alternate configurations in the "configurations" object.

For example, the "serve" target for a newly generated app has a predefined alternate configuration named "production".

You can define new targets and their configuration options in the "architect" section of the ux.yaml file. If you do so, you can run them from the command line using the ng run command. Execute the command using the following format.

cargo ux run project:target[:configuration]

Arguments

ArgumentDescriptionValue Type
targetThe Architect target to run.string

Options

OptionDescriptionValue TypeDefault Value
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Aliases: -cstring
--helpShows a help message for this command in the console.true|false|jsonfalse

cargo ux serve

This is a Draft Version

Builds and serves your app, rebuilding on file changes.

cargo ux serve <project> [options]
cargo ux s <project> [options]

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to build. Can be an application or a library.string

Options

OptionDescriptionValue TypeDefault Value
--allowed-hostsList of hosts that are allowed to access the dev server.array
--browser-targetA browser builder target to serve in the format of project:target[:configuration]. You can also pass in more than one configuration name as a comma-separated list. Example: project:target:production,staging.string
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Setting this explicitly overrides the "--prod" flag. Aliases: -cstring
--disable-host-checkDon't verify connected clients are part of allowed hosts.booleanfalse
--helpShows a help message for this command in the console.true|false|jsonfalse
--hmrEnable hot module replacement.booleanfalse
--hostHost to listen on.stringlocalhost
--live-reloadWhether to reload the page on change, using live-reload.booleantrue
--openOpens the url in default browser. Aliases: -obooleanfalse
--pollEnable and define the file watching poll time period in milliseconds.number
--portPort to listen on.number4200
--prodShorthand for "--configuration=production". Set the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.boolean
--proxy-configProxy configuration file.string
--public-hostThe URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies.string
--serve-pathThe pathname where the app will be served.string
--sslServe using HTTPS.booleanfalse
--ssl-certSSL certificate to use for serving HTTPS.string
--ssl-keySSL key to use for serving HTTPS.string
--verboseAdds more details to output logging.boolean
--watchRebuild on change.booleantrue

cargo ux test

This is a Draft Version

Runs unit tests in a project.

cargo ux test <project> [options]
cargo ux t <project> [options]

Description

Takes the name of the project, as specified in the projects section of the ux.yaml workspace configuration file. When a project name is not supplied, it will execute for all projects.

Arguments

ArgumentDescriptionValue Type
projectThe name of the project to build. Can be an application or a library.string

Options

OptionDescriptionValue TypeDefault Value
--browsersOverride which browsers tests are run against.string
--code-coverageOutput a code coverage report.booleanfalse
--code-coverage-excludeGlobs to exclude from code coverage.array
--configurationOne or more named builder configurations as a comma-separated list as specified in the "configurations" section of ux.yaml. The builder uses the named configurations to run the given target. For more information, see https://angular-rust.github.io/guide/workspace-config#alternate-build-configurations. Setting this explicitly overrides the "--prod" flag. Aliases: -cstring
--helpShows a help message for this command in the console.true|false|jsonfalse
--includeGlobs of files to include, relative to workspace or project root. There are 2 special cases: - when a path to directory is provided, all spec files ending ".spec. @(ts|tsx)" will be included - when a path to a file is provided, and a matching spec file exists it will be included insteadarray
--karma-configThe name of the Karma configuration file.string
--mainThe name of the main entry-point file.string
--pollEnable and define the file watching poll time period in milliseconds.number
--polyfillsThe name of the polyfills file.string
--preserve-symlinksDo not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set.boolean
--prodShorthand for "--configuration=production". Set the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.boolean
--progressLog progress to the console while building.booleantrue
--reportersKarma reporters to use. Directly passed to the karma runner.array
--source-mapOutput source maps for scripts and styles. For more information, see https://angular-rust.github.io/guide/workspace-config#source-map-configuration.booleantrue
--watchRun build when files change.boolean

cargo ux update

This is a Draft Version

Updates your application and its dependencies.

cargo ux update [options]

Description

Perform a basic update to the current stable release of the core framework and CLI by running the following command.

cargo ux update @angular/cli @angular/core

To update to the next beta or pre-release version, use the --next option.

To update from one major version to another, use the format

cargo ux update @angular/cli@^<major_version> @angular/core@^<major_version>

We recommend that you always update to the latest patch version, as it contains fixes we released since the initial major release. For example, use the following command to take the latest 10.x.x version and use that to update.

cargo ux update @angular/cli@^10 @angular/core@^10

For detailed information and guidance on updating your application, see the interactive Angular Rust Update Guide.

Options

OptionDescriptionValue TypeDefault Value
--allow-dirtyWhether to allow updating when the repository contains modified or untracked files.boolean
--create-commitsCreate source control commits for updates and migrations. Aliases: -Cbooleanfalse
--forceIf false, will error out if installed packages are incompatible with the update.booleanfalse
--fromVersion from which to migrate from. Only available with a single package being updated, and only on migration only.string
--helpShows a help message for this command in the console.true|false|jsonfalse
--migrate-onlyOnly perform a migration, do not update the installed version.boolean
--nextUse the prerelease version, including beta and RCs.booleanfalse
--packagesThe names of package(s) to update.array
--toVersion up to which to apply migrations. Only available with a single package being updated, and only on migrations only. Requires from to be specified. Default to the installed version detected.string
--verboseDisplay additional details about internal operations during execution.booleanfalse

cargo ux version

This is a Draft Version

Outputs cargo-ux version.

cargo ux version [options]
cargo ux v [options]

Options

OptionDescriptionValue TypeDefault Value
--helpShows a help message for this command in the console.true|false|jsonfalse