Unlike `require.resolve`, the `resolve` package `paths` is only used as a fallback when the package is not resolved from the `basedir`,
Previously this resulted in the temporary version of CLI being resolved here which resulted in `ng update` incorrectly stating that there are no updates.
With this change the CLI offers a way for a package authors to specify if during `ng add` the package should be saved as a `dependencies`, `devDependencies` or not saved at all.
Such config needs to be specified in `package.json`
Example:
```json
"ng-add": {
"save": false
}
```
Possible values are;
- false - Don't add the package to `package.json`
- true - Add the package to the `dependencies`
- `dependencies` - Add the package to the `dependencies`
- `devDependencies` - Add the package to the `devDependencies`
Closes#12003 , closes#15764 and closes#13237
This adds extensive option checking and error handling with the goal to catch user errors as early in the process as possible. Bad option combinations and/or values will result in actionable information and stop the process before network access and processing occurs.