Add the caretaker configuration to set up being able to run both the carataker
check and the handoff commands.
The caretaker handoff command will operate using the angular-cli-caretaker group
which has already been seeded with the current information.
When running protractor, previously we didn't close the dev-server correctly when there was an error which caused the process to keep running following https://github.com/angular/angular-cli/pull/23166
This can be useful to debug slow builds.
Example of output
```
LOG from build-angular.JavaScriptOptimizerPlugin
<t> optimize asset: runtime.ad5c30339e926c89.js: 221.959564 ms
<t> optimize asset: polyfills.ec3ffae5bac27204.js: 1071.080092 ms
<t> optimize asset: main.aa8a15155ca2133f.js: 3391.588635 ms
<t> optimize js assets: 3483.799739 ms
LOG from build-angular.CssOptimizerPlugin
<t> optimize asset: styles.d251c5bf54715558.css: 26.569907 ms
<t> optimize css assets: 34.441737 ms
```
```
LOG from build-angular.JavaScriptOptimizerPlugin
<i> polyfills.ec3ffae5bac27204.js restored from cache.
<i> runtime.ad5c30339e926c89.js restored from cache.
<t> optimize asset: main.69fb55a243b46bfa.js: 2618.5191210000003 ms
<t> optimize js assets: 2721.226144 ms
LOG from build-angular.CssOptimizerPlugin
<i> styles.d251c5bf54715558.css restored from cache.
<t> optimize css assets: 12.149169 ms
```
Several tests that perform package actions during the test have been updated to
function correctly when used with npm. npm 7+ performs additional resolution
on peer dependencies which can result in failures during testing.
The following tests have been updated:
* `build/material` - This test contained an actual error in that it was installing the `latest`
version of `@angular/material-moment-adapter` when testing prereleases even though
it should have been installing the `next` tag instead.
* `build/styles/tailwind-v2` - This test had to be reordered due to npm 7+ keeping the
installed `tailwindcss` peer dependency in a non-hoisted location even after the project
level package was uninstalled. The ordering also uncovered a Webpack cache key creation defect
wherein the cache key does not account for the presence of `tailwindcss`. Until this
is corrected, the test temporarily disables caching.
* `commands/add/version-specifier` - This test intentionally attempts to install package
versions that do not meet peer dependency requirements to ensure that the `ng add` command
correctly notifies the user. To allow for this to occur, the npm `force` option is used
to prevent the package install aspects of the command from failing.
If the user does not have a global install of the Angular CLI, the autocompletion prompt is skipped and `ng completion` emits a warning. The reasoning for this is that `source <(ng completion script)` won't work without `ng` on the `$PATH`, which is only really viable with a global install. Local executions like `git clone ... && npm install && npm start` or ephemeral executions like `npx @angular/cli` don't benefit from autocompletion and unnecessarily impede users.
A global install of the Angular CLI is detected by running `which -a ng`, which appears to be a cross-platform means of listing all `ng` commands on the `$PATH`. We then look over all binaries in the list and exclude anything which is a directo child of a `node_modules/.bin/` directory. These include local executions and `npx`, so the only remaining locations should be global installs (`/usr/bin/ng`, NVM, etc.).
The tests are a little awkward since `ng` is installed globally by helper functions before tests start. These tests uninstall the global CLI and install a local, project-specific version to verify behavior, before restoring the global version. Hypothetically this could be emulated by manipulating the `$PATH` variable, but `which` needs to be available (so we can't clobber the whole `$PATH`) and `node` exists in the same directory as the global `ng` command (so we can't remove that directory anyways). There's also no good way of testing the case where `which` fails to run.
Closes#23135.
This explains how to set up autocompletion with the Angular CLI:
1. Via the automated prompt on first execution.
2. Via `ng completion`.
3. Manually via appending `source <(ng completion script)` to the user's `~/.bashrc` file.
It also specifically calls out supported and unsupported platforms as well as the requirement for a global install of the Angular CLI.
For v14, the update command migration execution logic was incorrectly exiting after
the success of the first package's migrations. This prevented any other updated
packages from executing migrations automatically. The success check is now a failure
check and will allow the migration execution process to continue to execute migrations
until complete or a failure occurs.
When the `--search` option is passed to `ng doc`, it should open a URL
that does a search across the whole website (instead of the default
behavior of limiting the search to API docs).
Fix the `ng doc` command to implement the iteded behavior (previously,
it did the opposite).
The `misc/npm-7` E2E test previously assumed the initial version of npm was 6.x and
would then always install 6.x after the test was complete. With newer Node.js versions
this assumption is no longer true. The test now records the initial version present
prior to starting the test and restores that recorded version at completion.
Node.js 16.10 is currently the minimum version of v16 supported by the Angular CLI
and is now used when executing the Angular snapshot E2E test suite to ensure
that the latest snapshots of Angular continue to function at this Node.js version.
Node.js v16 is the version currently used to develop the Angular CLI.
The npm 7+ workaround of installing npm 6 is also removed to more closely track
the behavior of Node.js 16.10 as well as any other Node.js version used during
testing.
Relative schematics referenced in `angular.json` `schematicCollections` and `defaultCollection` were always resolved from the current working directory, which is not correct and caused the collection not to be resolved when the this is different from the location of the workspace config.
Closes#23136
Stephen and Igor are no longer the leads for DevRel and Angular respectively. Updated to use generic language so this doesn't fall out of date as easily.
After https://github.com/angular/angular/pull/45885, testability now needs to be explicitly added to `bootstrapApplication()`.
(cherry picked from commit 329a2a3798c1d5e60a7c6b165e9da2b9040c223b)
Locally-built APF v14 libraries should be resolved properly. Webpack
currently does not resolve them (in e.g. `dist/`) because the local
distribution folders are not marked as module roots, causing Webpack
to never hit the `module`/`raw-module` resolution hooks and therefore
skipping package exports resolution and breaking secondary entry-points
from being resolved properly (when bundling).
We fix this by also attempting to resolve path mappings as modules,
allowing for Webpacks `resolve-in-package` hooks to be activated. These
hooks support the `exports` field and therefore APF v14 secondary
entry-points which are not necessarily inside a Webpack resolve
`modules:` root (but e.g. in `dist/`)