From b35a8d3e1ee1ea4e67381a3b308c655e4ca1e546 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Mon, 21 Oct 2019 20:29:25 +0800 Subject: [PATCH] fix(ui): fix latest version check without yarn (#4724) Fixes #4710 --- .../apollo-server/connectors/dependencies.js | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/@vue/cli-ui/apollo-server/connectors/dependencies.js b/packages/@vue/cli-ui/apollo-server/connectors/dependencies.js index 63421484de..83900f1853 100644 --- a/packages/@vue/cli-ui/apollo-server/connectors/dependencies.js +++ b/packages/@vue/cli-ui/apollo-server/connectors/dependencies.js @@ -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') @@ -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') @@ -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) {