Skip to content

Commit bd06cd4

Browse files
author
Guillaume Chau
committed
fix(plugins): local install
1 parent f8a0a63 commit bd06cd4

File tree

1 file changed

+17
-2
lines changed
  • packages/@vue/cli-ui/apollo-server/connectors

1 file changed

+17
-2
lines changed

packages/@vue/cli-ui/apollo-server/connectors/plugins.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,23 @@ function installLocal (context) {
371371
})
372372
currentPluginId = id
373373
installationStep = 'install'
374-
const idAndRange = `${id}@file:${folder}`
375-
await installPackage(cwd.get(), getCommand(cwd.get()), null, idAndRange)
374+
375+
// Update package.json
376+
{
377+
const pkgFile = path.resolve(cwd.get(), 'package.json')
378+
const pkg = await fs.readJson(pkgFile)
379+
if (!pkg.devDependencies) pkg.devDependencies = {}
380+
pkg.devDependencies[id] = `file:${folder}`
381+
await fs.writeJson(pkgFile, pkg, {
382+
spaces: 2
383+
})
384+
}
385+
386+
const from = path.resolve(cwd.get(), folder)
387+
const to = path.resolve(cwd.get(), 'node_modules', ...id.split('/'))
388+
console.log('copying from', from, 'to', to)
389+
await fs.copy(from, to)
390+
376391
await initPrompts(id, context)
377392
installationStep = 'config'
378393

0 commit comments

Comments
 (0)