This change will display an error message if using npm 7 (or versions earlier than 6). This is a temporarily change while npm 7 usability concerns are addressed.
This change ensures that migration collections defined in a package's `ng-update` metadata are resolved from the containing package. This avoids issues that may arise from package manager hoisting behavior which can result in the wrong migration collection being chosen. The `--migrate-only` option already contained this resolution logic and now the full update contains it as well.
This change adds logic to redirect module resolution requests for Angular schematics to ensure that the correct versions of core schematic related packages are used. This also ensures that the runtime version of the schematics package matches the version used inside the schematic and that object instances passed into the schematic are compatible.
The current set of core schematic related packages are `@angular-devkit/*` and `@schematics/angular`. Only first-party Angular schematics are currently affected by this change.
It's confusing and redundant to use `When true` and `when false` in descriptions for a CLI arguments because specifying false/true is redundant in a command line argument flag and in most cases users will not do it.
Example:
`--foo=true` is the same as `--foo`
`--foo=false` is the same as `--no-foo`
For `ng update --migrateOnly ...` the update implementation checks for transitive
dependencies and tries to parse the containing directory as JSON. This PR
fixes this by providing the correct path to the package.json.
`ng i18n-extract` and `ng xi18n` has been deprecated in favor of `ng extract-i18n` to have a better intuitive naming and match the architect key in `angular.json`.
When attempting to add a package via the add command, packages that have been marked as deprecated will no longer be installed when the deprecated package's peer dependencies match the project's dependencies.
With this change we fix two analytics collection bugs:
- We now collect the usage of options defined in the workspace config (angular.json).
- We now also collect values set via schematic prompts.
Closes: #17900
This change reduces the amount of schematic runtime setup code by leveraging the new options for the root path and schema validation in the NodeWorkflow class.
Previously, the workspace configuration file was found and loaded by individual commands potentially multiple times. This change moves the initial workspace location discovery and loading of the workspace to the CLI startup. It also provides the workspace to each command so that the commands can reuse the already loaded and parsed workspace configuration.
'--all' functionality has been removed from `ng update` as updating multiple packages at once is not recommended. To update the depencencies in your workspace 'package.json' use the update command of your package manager.
Closes#15278Closes#13095Closes#12261Closes#12243Closes#18813
These addresses;
- When a large number of migration are executed, it's hard to differentiate between the title and description.
- Fix alignments of logs
This change removes all direct usage of the `node_modules` directory from the version command. This provides improved support for yarn PnP as well as prevents a crash when a workspace does not have a `node_modules` directory.
Fixes#10474
This commit makes a few minor changes to enable syncing the CLI repository
into google3.
1. mark pkg_tar and pkg_npm as external
2. remove dependencies (marked as comment) which are stale in google3
3. remove TS files generated from JSON schema in BUILD files since these
files are compiled and added to the g3 codebase at sync time
4. Some minor typing changes
5. Remove duplicate licenses
6. mark dependencies which are not available in g3 as external
7. Immediately type the result of JSON.parse() as required by g3 linter.
Otherwise, the type defaults to `any`.
BREAKING CHANGE:
Removed deprecated `typescriptMismatch` warning option. Users will be migrated off this option automatically. Users wishing to disable TypeScript version checks should use the Angular compiler option `disableTypeScriptVersionCheck`, see https://angular.io/guide/angular-compiler-options#disabletypescriptversioncheck for more information.
When an error occurs during ng update we currently discard the stack trace which in some cases made it hard to identify the cause of the error.
Now, we print the stack trace to a log file similarly to unhandled exceptions.
Example of CMD output;
```cmd
** Executing migrations of package '@angular/core' **
> Static flag migration.
Removes the `static` flag from dynamic queries.
As of Angular 9, the "static" flag defaults to false and is no longer required for your view and content queries.
Read more about this here: https://v9.angular.io/guide/migration-dynamic-flag
× Migration failed: x
See "C:\Users\alag\AppData\Local\Temp\ng-NgmC1G\angular-errors.log" for further details.
```
Example of log file contents:
```txt
[error] Error: x
at UpdateCommand.executeSchematic (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:98:19)
at UpdateCommand.executePackageMigrations (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:167:39)
at UpdateCommand.executeMigrations (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:161:21)
at UpdateCommand.run (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:394:38)
at async UpdateCommand.validateAndRun (C:\git\angular-cli\test\node_modules\@angular\cli\models\command.js:134:28)
at async Object.runCommand (C:\git\angular-cli\test\node_modules\@angular\cli\models\command-runner.js:201:24)
at async default_1 (C:\git\angular-cli\test\node_modules\@angular\cli\lib\cli\index.js:62:31)
```