Skip to content

Commit

Permalink
feat(@angular/cli): deprecate --prod command line argument
Browse files Browse the repository at this point in the history
With this change we deprecated the `--prod` command line argument. This argument is confusing especially to new users, since users expect that this builds an application in production mode. This however, is only an alias for `--configuration="production"`
  • Loading branch information
alan-agius4 authored and filipesilva committed Mar 10, 2021
1 parent 5f8155d commit a5877bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/angular/cli/commands/build-long.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ When used to build a library, a different builder is invoked, and only the `ts-c
All other options apply only to building applications.

The application builder uses the [webpack](https://webpack.js.org/) build tool, with default configuration options specified in the workspace configuration file (`angular.json`) 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.
A "development" configuration is created by default when you use the CLI to create the project, and you can use that configuration by specifying the `--configuration development`.

The configuration options generally correspond to the command options.
You can override individual configuration defaults by specifying the corresponding options on the command line.
Expand Down
3 changes: 2 additions & 1 deletion packages/angular/cli/commands/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
"prod": {
"description": "Shorthand for \"--configuration=production\".\nSet the build configuration to the production target.\nBy 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.",
"type": "boolean"
"type": "boolean",
"x-deprecated": "Use `--configuration production` instead."
}
}
},
Expand Down
1 change: 1 addition & 0 deletions packages/angular/cli/models/architect-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export abstract class ArchitectCommand<
if (commandOptions.prod) {
// The --prod flag will always be the first configuration, available to be overwritten
// by following configurations.
this.logger.warn('Option "--prod" is deprecated: Use "--configuration production" instead.');
configuration = 'production';
}
if (commandOptions.configuration) {
Expand Down

0 comments on commit a5877bf

Please sign in to comment.