Skip to content

Commit

Permalink
fix(ui): fix latest version check without yarn (#4724)
Browse files Browse the repository at this point in the history
Fixes #4710
  • Loading branch information
sodatea committed Oct 21, 2019
1 parent 2cdb50c commit b35a8d3
Showing 1 changed file with 5 additions and 19 deletions.
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

0 comments on commit b35a8d3

Please sign in to comment.