Avoid empty `node_modules` when the user has set `NODE_ENV` to
`production` in the shell environment.
In the long run we should have a more comprehensive preflight check
for execution environment though.
When username and password are configured in the .npmrc for the
respective scope, use basic auth when getting package metadata from the
npm registry.
Closes#6206
This should fix the remaining issue reported in #5411.
In particular, if the user configured a dedicated npm registry for a
specific scope, this setting was previously disregarded by vue-cli.
Thus it was impossible to use vue upgrade if the packages were not also
published to the official npm registry.
Currently, if we use `api.extendPackage({foo: null}, {prune: true})` the dependency is removed but a warning is logged as the range is invalid:
```
WARN invalid version range for dependency "foo":
- null injected by generator "my-plugin"
```
* fix: should infer package manager from config if there's no lockfile in the project
* fixup! fix: should infer package manager from config if there's no lockfile in the project
Currently, 3 options are implemented:
- options.prune (defaults to `false`) - Remove null or undefined
fields from the object after merging.
- options.merge (defaults to `true`) deep-merge nested fields, note
that dependency fields are always deep merged regardless of this option.
- options.warnIncompatibleVersions (defaults to `true`) Output warning
if two dependency version ranges don't intersect.
Closes#4779
* feat: lock minor versions when creating projects / adding plugins
closes#5012
* refactor: also calculate latestMinor version
* feat: support add packages with tilde version range
* refactor: make the `runCommand` invocations more concise
* refactor: use the `getVersions` utility function to get latestMinor
* feat: when adding plugins, use tilde range by default
* fix: allow empty args
* refactor(migrator): rename `installed` to `baseVersion`
* feat: `vue upgrade --from` option and a new `vue migrate` command
* fix: fix support for `vuePlugins.resolveFrom` option
* chore: add a fixme comment
* fix: use loadModule instead of manually calculating the package.json path
This also fixes support for monorepo.
(TODO: tests)
* fix: treat `resolveFrom` as `context`, fixing edge cases
* fix: use read-pkg instead of loadModule, avoid messing up require cache
* fix: getInstalledVersion still requires `loadModule` to support monorepo