Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): fix latest version check always displaying "0.1.0" #4724

Merged
merged 1 commit into from Oct 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 5 additions & 19 deletions packages/@vue/cli-ui/apollo-server/connectors/dependencies.js
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs')
const path = require('path')
const LRU = require('lru-cache')
const semver = require('semver')
const execa = require('execa')
const chalk = require('chalk')
// Connectors
const cwd = require('./cwd')
Expand All @@ -12,7 +11,7 @@ const logs = require('./logs')
// Context
const getContext = require('../context')
// Utils
const { isPlugin, hasYarn, resolveModule } = require('@vue/cli-shared-utils')
const { isPlugin, resolveModule } = require('@vue/cli-shared-utils')
const { progress: installProgress } = require('@vue/cli/lib/util/executeCommand')
const PackageManager = require('@vue/cli/lib/util/ProjectPackageManager')
const { resolveModuleRoot } = require('../util/resolve-path')
Expand Down Expand Up @@ -94,23 +93,10 @@ async function getMetadata (id, context) {
return metadata
}

if (hasYarn()) {
try {
const { stdout } = await execa('yarn', ['info', id, '--json'], {
cwd: cwd.get()
})
metadata = JSON.parse(stdout).data
} catch (e) {
// yarn info failed
}
}

if (!metadata) {
try {
metadata = await (new PackageManager({ context: cwd.get() })).getMetadata()
} catch (e) {
// No connection?
}
try {
metadata = await (new PackageManager({ context: cwd.get() })).getMetadata(id)
} catch (e) {
// No connection?
}

if (metadata) {
Expand Down