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
Command | Alias | Description |
---|---|---|
add | Adds support for an external library to your project. | |
analytics | Configures the gathering of cargo-ux usage metrics. See https://angular-rust.github.io/cargo-ux/usage-analytics-gathering. | |
build | b | Compiles an Angular Rust app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory. |
config | Retrieves or sets Angular Rust configuration values in the ux.yaml file for the workspace. | |
deploy | Invokes the deploy builder for a specified project or for the default project in the workspace. | |
doc | d | Opens the official Angular Rust documentation (angular-rust.github.io) in a browser, and searches for a given keyword. |
e2e | e | Builds and serves an Angular Rust app, then runs end-to-end tests using Protractor. |
extract-i18n | i18n-extract xi18n | Extracts i18n messages from source code. |
generate | g | Generates and/or modifies files based on a schematic. |
help | Lists available commands and their short descriptions. | |
lint | l | Runs linting tools on Angular Rust app code in a given project folder. |
new | n | Creates a new workspace and an initial Angular Rust application. |
run | Runs an Architect target with an optional custom builder configuration defined in your project. | |
serve | s | Builds and serves your app, rebuilding on file changes. |
test | t | Runs unit tests in a project. |
update | Updates your application and its dependencies. | |
version | v | Outputs 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
Argument | Description | Value Type |
---|---|---|
collection | The package to be added. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--defaults | Disable interactive input prompts for options with a default. | boolean | |
--help | Shows a help message for this command in the console. | true|false|json | false |
--interactive | Enable interactive input prompts. | boolean | |
--registry | The registry to use. | string | |
--verbose | Display additional details about internal operations during execution. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
setting-or-project | Directly 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-setting | Sets the default analytics enablement status for the project. | on|off|prompt |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--help | Shows a help message for this command in the console. | true|false|json | false |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to build. Can be an application or a library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--allowed-common-js-dependencies | A list of CommonJS packages that are allowed to be used without a build time warning. | array | |
--aot | Build using Ahead of Time compilation. | boolean | false |
--base-href | Base url for the application being built. | string | |
--build-optimizer | Enables '@angular-devkit/build-optimizer' optimizations when using the 'aot' option. | boolean | false |
--common-chunk | Generate a seperate bundle containing code used across multiple bundles. | boolean | true |
--configuration | One 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: -c | string | |
--cross-origin | Define the crossorigin attribute setting of elements that provide CORS support. | none|anonymous|use-credentials | none |
--delete-output-path | Delete the output path before building. | boolean | true |
--deploy-url | URL where files will be deployed. | string | |
--extract-licenses | Extract all licenses in a separate file. | boolean | false |
--fork-type-checker | Run the type checker in a forked process. | boolean | true |
--help | Shows a help message for this command in the console. | true|false|json | false |
--i18n-missing-translation | How to handle missing translations for i18n. | warning|error|ignore | warning |
--index | Configures the generation of the application's HTML index. | string | |
--localize | Translate the bundles in one or more locales. | boolean | |
--main | The full path for the main entry point to the app, relative to the current workspace. | string | |
--named-chunks | Use file name for lazy loaded chunks. | boolean | true |
--optimization | Enables 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. | boolean | false |
--output-hashing | Define the output filename cache-busting hashing mode. | none|all|media|bundles | none |
--output-path | The 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 | |
--poll | Enable and define the file watching poll time period in milliseconds. | number | |
--polyfills | The full path for the polyfills file, relative to the current workspace. | string | |
--preserve-symlinks | Do not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set. | boolean | |
--prod | Shorthand 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 | |
--progress | Log progress to the console while building. | boolean | true |
--resources-output-path | The path where style resources will be placed, relative to outputPath. | string | |
--service-worker | Generates a service worker config for production builds. | boolean | false |
--show-circular-dependencies | Show circular dependency warnings on builds. | boolean | true |
--source-map | Output source maps for scripts and styles. For more information, see https://angular-rust.github.io/guide/workspace-config#source-map-configuration. | boolean | true |
--stats-json | Generates a 'stats.json' file which can be analyzed later. | boolean | false |
--subresource-integrity | Enables the use of subresource integrity validation. | boolean | false |
--vendor-chunk | Generate a seperate bundle containing only vendor libraries. This option should only used for development. | boolean | true |
--verbose | Adds more details to output logging. | boolean | false |
--watch | Run build when files change. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
json-path | The 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 |
value | If provided, a new value for the given configuration key. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--global | Access the global configuration in the caller's home directory. Aliases: -g | boolean | false |
--help | Shows a help message for this command in the console. | true|false|json | false |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to deploy. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--configuration | One 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: -c | string | |
--help | Shows a help message for this command in the console. | true|false|json | false |
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
Argument | Description | Value Type |
---|---|---|
keyword | The keyword to search for, as provided in the search bar in angular-rust.github.io. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--help | Shows a help message for this command in the console. | true|false|json | false |
--search | Search all of angular-rust.github.io. Otherwise, searches only API reference documentation. Aliases: -s | boolean | false |
--version | Contains 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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to build. Can be an application or a library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--base-url | Base URL for protractor to connect to. | string | |
--configuration | One 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: -c | string | |
--dev-server-target | A 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 | |
--grep | Execute specs whose names match the pattern, which is internally compiled to a RegExp. | string | |
--help | Shows a help message for this command in the console. | true|false|json | false |
--host | Host to listen on. | string | |
--invert-grep | Invert the selection specified by the 'grep' option. | boolean | |
--port | The port to use to serve the application. | number | |
--prod | Shorthand 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-config | The name of the Protractor configuration file. | string | |
--specs | Override specs in the protractor config. | array | |
--suite | Override suite in the protractor config. | string | |
--webdriver-update | Try to update webdriver. | boolean | true |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to build. Can be an application or a library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--browser-target | A 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 | |
--configuration | One 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: -c | string | |
--format | Output format for the generated file. | xmb|xlf|xlif|xliff|xlf2|xliff2|json|arb | xlf |
--help | Shows a help message for this command in the console. | true|false|json | false |
--ivy | Use Ivy compiler to extract translations. The default for Ivy applications. | boolean | |
--out-file | Name of the file to output. | string | |
--output-path | Path where output will be placed. | string | |
--prod | Shorthand 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 | |
--progress | Log progress to the console. | boolean | true |
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
Argument | Description | Value Type |
---|---|---|
schematic | The 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-worker | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--defaults | Disable interactive input prompts for options with a default. | boolean | |
--dry-run | Run through and reports activity without writing out results. Aliases: -d | boolean | false |
--force | Force overwriting of existing files. Aliases: -f | boolean | false |
--help | Shows a help message for this command in the console. | true|false|json | false |
--interactive | Enable 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
Option | Description | Value Type | Default Value |
---|---|---|---|
--app-dir | The name of the application directory. | string | app |
--app-id | The app ID to use in withServerTransition(). | string | serverApp |
--client-project | The name of the related client app. | string | |
--main | The name of the main entry-point file. | string | main.server.rs |
--root-module-class-name | The name of the root module class. | string | AppServerModule |
--root-module-file-name | The name of the root module file | string | app.server.module.rs |
--route | Route path used to produce the app shell. | string | shell |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the new app. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--inline-style | Include 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: -s | boolean | |
--inline-template | Include 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: -t | boolean | |
--legacy-browsers | Add support for legacy browsers like Internet Explorer using differential loading. | boolean | false |
--minimal | Create a bare-bones project without any testing frameworks. (Use for learning purposes only.) | boolean | false |
--prefix | A prefix to apply to generated selectors. Aliases: -p | string | app |
--routing | Create a routing module. | boolean | false |
--skip-install | Skip installing dependency packages. | boolean | false |
--skip-package-json | Do not add dependencies to the "package.yaml" file. | boolean | false |
--skip-tests | Do not create "spec.rs" test files for the application. Aliases: -S | boolean | false |
--strict | Creates an application with stricter bundle budgets settings. | boolean | false |
--view-encapsulation | The 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
Argument | Description | Value Type |
---|---|---|
name | The name of the new class. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--project | The name of the project. | string | |
--skip-tests | Do not create "spec.rs" test files for the new class. | boolean | false |
--type | Adds 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
Argument | Description | Value Type |
---|---|---|
name | The name of the component. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--change-detection | The change detection strategy to use in the new component. Aliases: -c | Default|OnPush | Default |
--display-block | Specifies if the style will contain :host { display: block; }. Aliases: -b | boolean | false |
--export | The declaring module exports this component. | boolean | false |
--flat | Create the new files at the top level of the current project. | boolean | false |
--inline-style | Include 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: -s | boolean | false |
--inline-template | Include template inline in the component.rs file. By default, an external template file is created and referenced in the component.rs file. Aliases: -t | boolean | false |
--module | The declaring module. Aliases: -m | string | |
--prefix | The prefix to apply to the generated component selector. Aliases: -p | string | |
--project | The name of the project. | string | |
--selector | The HTML selector to use for this component. | string | |
--skip-import | Do not import this component into the owning module. | boolean | false |
--skip-selector | Specifies if the component should have a selector or not. | boolean | false |
--skip-tests | Do not create "spec.rs" test files for the new component. | boolean | false |
--type | Adds a developer-defined type to the filename, in the format "name.type.rs". | string | Component |
--view-encapsulation | The view encapsulation strategy to use in the new component. Aliases: -v | Emulated|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
Argument | Description | Value Type |
---|---|---|
name | The name of the new directive. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--export | The declaring module exports this directive. | boolean | false |
--flat | When true (the default), creates the new files at the top level of the current project. | boolean | true |
--module | The declaring module. Aliases: -m | string | |
--prefix | A prefix to apply to generated selectors. Aliases: -p | string | |
--project | The name of the project. | string | |
--selector | The HTML selector to use for this directive. | string | |
--skip-import | Do not import this directive into the owning module. | boolean | false |
--skip-tests | Do not create "spec.rs" test files for the new class. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the enum. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--project | The 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
Argument | Description | Value Type |
---|---|---|
name | The name of the new route guard. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--flat | When true (the default), creates the new files at the top level of the current project. | boolean | true |
--implements | Specifies which interfaces to implement. | array | |
--project | The name of the project. | string | |
--skip-tests | Do not create "spec.rs" test files for the new guard. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the interceptor. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--flat | When true (the default), creates files at the top level of the project. | boolean | true |
--project | The name of the project. | string | |
--skip-tests | Do not create "spec.rs" test files for the new interceptor. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the interface. | string |
type | Adds a developer-defined type to the filename, in the format "name.type.rs". | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--prefix | A prefix to apply to generated selectors. | string | |
--project | The 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
Argument | Description | Value Type |
---|---|---|
name | The name of the library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--entry-file | The path at which to create the library's public API file, relative to the workspace root. | string | public-api |
--prefix | A prefix to apply to generated selectors. Aliases: -p | string | lib |
--skip-install | Do not install dependency packages. | boolean | false |
--skip-package-yaml | Do not add dependencies to the "package.yaml" file. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the module. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--flat | Create the new files at the top level of the current project root. | boolean | false |
--module | The declaring module. Aliases: -m | string | |
--project | The name of the project. | string | |
--route | The 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 | |
--routing | Create a routing module. | boolean | false |
--routing-scope | The scope for the new routing module. | Child|Root | Child |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the pipe. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--export | The declaring module exports this pipe. | boolean | false |
--flat | When true (the default) creates files at the top level of the project. | boolean | true |
--module | The declaring module. Aliases: -m | string | |
--project | The name of the project. | string | |
--skip-import | Do not import this pipe into the owning module. | boolean | false |
--skip-tests | Do not create "spec.rs" test files for the new pipe. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the new resolver. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--flat | When true (the default), creates the new files at the top level of the current project. | boolean | true |
--project | The name of the project. | string | |
--skip-tests | Do not create "spec.rs" test files for the new resolver. | boolean | false |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the service. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--flat | When true (the default), creates files at the top level of the project. | boolean | true |
--project | The name of the project. | string | |
--skip-tests | Do not create "spec.rs" test files for the new service. | boolean | false |
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
Option | Description | Value Type | Default Value |
---|---|---|---|
--configuration | The configuration to apply service worker to. | string | production |
--project | The name of the project. | string | |
--target | The target to apply service worker to. | string | build |
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
Argument | Description | Value Type |
---|---|---|
name | The name of the worker. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--project | The name of the project. | string | |
--snippet | Add a worker creation snippet in a sibling file of the same name. | boolean | true |
--target | The target to apply web worker to. | string | build |
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
Option | Description | Value Type | Default Value |
---|---|---|---|
--help | Shows a help message for this command in the console. | true|false|json | false |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to lint. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--configuration | The linting configuration to use. Aliases: -c | string | |
--exclude | Files to exclude from linting. | array | |
--files | Files to include in linting. | array | |
--fix | Fixes linting errors (may overwrite linted files). | boolean | false |
--force | Succeeds even if there was linting errors. | boolean | false |
--format | Output format (prose, json, stylish, verbose, pmd, msbuild, checkstyle, vso, fileslist). | string | stylish |
--help | Shows a help message for this command in the console. | true|false|json | false |
--silent | Show output text. | boolean | false |
--type-check | Controls the type check for linting. | boolean | false |
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
Option | Description | Value Type | Default Value |
---|---|---|---|
--collection | A collection of schematics to use in generating the initial application. Aliases: -c | string | |
--commit | Initial git repository commit information. | boolean | true |
--create-application | Create 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. | boolean | true |
--defaults | Disable interactive input prompts for options with a default. | boolean | |
--directory | The directory name to create the workspace in. | string | |
--dry-run | Run through and reports activity without writing out results. Aliases: -d | boolean | false |
--force | Force overwriting of existing files. Aliases: -f | boolean | false |
--help | Shows a help message for this command in the console. | true|false|json | false |
--inline-style | Include styles inline in the component file. By default, an external styles file is created and referenced in the component file. Aliases: -s | boolean | |
--inline-template | Include template inline in the component file. By default, an external template file is created and referenced in the component file. Aliases: -t | boolean | |
--interactive | Enable interactive input prompts. | boolean | |
--legacy-browsers | Add support for legacy browsers like Internet Explorer using differential loading. | boolean | false |
--minimal | Create a workspace without any testing frameworks. (Use for learning purposes only.) | boolean | false |
--new-project-root | The path where new projects will be created, relative to the new workspace root. | string | projects |
--prefix | The prefix to apply to generated selectors for the initial project. Aliases: -p | string | app |
--routing | Generate a routing module for the initial project. | boolean | |
--skip-git | Do not initialize a git repository. Aliases: -g | boolean | false |
--skip-install | Do not install dependency packages. | boolean | false |
--skip-tests | Do not generate "spec.rs" test files for the new project. Aliases: -S | boolean | false |
--strict | Creates 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-mode | boolean | false |
--verbose | Add more details to output logging. Aliases: -v | boolean | false |
--view-encapsulation | The 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
Argument | Description | Value Type |
---|---|---|
target | The Architect target to run. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--configuration | One 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: -c | string | |
--help | Shows a help message for this command in the console. | true|false|json | false |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to build. Can be an application or a library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--allowed-hosts | List of hosts that are allowed to access the dev server. | array | |
--browser-target | A 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 | |
--configuration | One 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: -c | string | |
--disable-host-check | Don't verify connected clients are part of allowed hosts. | boolean | false |
--help | Shows a help message for this command in the console. | true|false|json | false |
--hmr | Enable hot module replacement. | boolean | false |
--host | Host to listen on. | string | localhost |
--live-reload | Whether to reload the page on change, using live-reload. | boolean | true |
--open | Opens the url in default browser. Aliases: -o | boolean | false |
--poll | Enable and define the file watching poll time period in milliseconds. | number | |
--port | Port to listen on. | number | 4200 |
--prod | Shorthand 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-config | Proxy configuration file. | string | |
--public-host | The 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-path | The pathname where the app will be served. | string | |
--ssl | Serve using HTTPS. | boolean | false |
--ssl-cert | SSL certificate to use for serving HTTPS. | string | |
--ssl-key | SSL key to use for serving HTTPS. | string | |
--verbose | Adds more details to output logging. | boolean | |
--watch | Rebuild on change. | boolean | true |
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
Argument | Description | Value Type |
---|---|---|
project | The name of the project to build. Can be an application or a library. | string |
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--browsers | Override which browsers tests are run against. | string | |
--code-coverage | Output a code coverage report. | boolean | false |
--code-coverage-exclude | Globs to exclude from code coverage. | array | |
--configuration | One 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: -c | string | |
--help | Shows a help message for this command in the console. | true|false|json | false |
--include | Globs 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 instead | array | |
--karma-config | The name of the Karma configuration file. | string | |
--main | The name of the main entry-point file. | string | |
--poll | Enable and define the file watching poll time period in milliseconds. | number | |
--polyfills | The name of the polyfills file. | string | |
--preserve-symlinks | Do not use the real path when resolving modules. If unset then will default to true if NodeJS option --preserve-symlinks is set. | boolean | |
--prod | Shorthand 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 | |
--progress | Log progress to the console while building. | boolean | true |
--reporters | Karma reporters to use. Directly passed to the karma runner. | array | |
--source-map | Output source maps for scripts and styles. For more information, see https://angular-rust.github.io/guide/workspace-config#source-map-configuration. | boolean | true |
--watch | Run 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
Option | Description | Value Type | Default Value |
---|---|---|---|
--allow-dirty | Whether to allow updating when the repository contains modified or untracked files. | boolean | |
--create-commits | Create source control commits for updates and migrations. Aliases: -C | boolean | false |
--force | If false, will error out if installed packages are incompatible with the update. | boolean | false |
--from | Version from which to migrate from. Only available with a single package being updated, and only on migration only. | string | |
--help | Shows a help message for this command in the console. | true|false|json | false |
--migrate-only | Only perform a migration, do not update the installed version. | boolean | |
--next | Use the prerelease version, including beta and RCs. | boolean | false |
--packages | The names of package(s) to update. | array | |
--to | Version 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 | |
--verbose | Display additional details about internal operations during execution. | boolean | false |
cargo ux version
This is a Draft Version
Outputs cargo-ux version.
cargo ux version [options]
cargo ux v [options]
Options
Option | Description | Value Type | Default Value |
---|---|---|---|
--help | Shows a help message for this command in the console. | true|false|json | false |