closes#5161
The root cause of such issues:
`vue-jscodeshift-adapter` requires `vue-template-compiler`.
`vue-template-compiler` tries to require the `vue` package and check
its version on startup.
Normally, there's no `vue` package in the dependency tree of `@vue/cli`,
so this check will just skip.
But if the user has installed some other global package that depend on
`vue`, and hoists it to the root `node_modules`, `vue-template-compiler`
would successfully require it and check against that `vue` version,
which sometimes may be outdated, thus failing the bootstrap process.
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"
```
* chore: switch to leven
* chore: update lock file
* chore: iterate through all the available commands and find closest match
* chore: update yarn.lock
* fix: lint
* chore: find the best possible match
* 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
* fix(cors): only allow localhost
* fix: use host so it's configurable
* fix: use cors options object
* feat: use a custom graphql-server instead of the one from apollo plugin
exports the httpServer instance
* fix: add CORS validation in the http upgrade request
Co-authored-by: Haoqun Jiang <haoqunjiang@gmail.com>
* 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
* refactor: extract deps & config logic to separate files
* feat: implement a migrator to upgrade to eslint 6
* fix: add required deps for eslint v4
* test: move migrator tests to each standalone plugins
* refactor: use spread operator instead of Object.assign
* feat: scaffold projects with eslint 6
* style: eslint fix
* refactor: do not use hard-coded ecmaVersion, use babel-eslint for now
* fix: upgrade to @vue/eslint-config-standard
* style: continue fix lint errors
* chore: upgrade to eslint-plugin-vue@^6.1.2
* refactor: use `ecmaVersion: 2020` for dynamic import syntax support
* test: fix baseESLintConfig
* chore: also update yarn.lock to fix CI caches
* chore: update lockfile again, fix babel regressions
* test: nightwatch tests should fail if lint errors occur
* chore: update the lockfile (again), fixing a bug in airbnb config