Skip to content

Commit

Permalink
feat: support custom package manager (#4621)
Browse files Browse the repository at this point in the history
Closes #4483

* feat: support custom package manager

* feat: refine warning msg for unknown package manager

* feat: refine blank lines

* feat: refine warning msg for unknown package manager

* feat: refine warning msg for unknown package manager
  • Loading branch information
zyy7259 authored and sodatea committed Sep 30, 2019
1 parent ed2b888 commit 8869a01
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@vue/cli/lib/util/ProjectPackageManager.js
Expand Up @@ -5,6 +5,7 @@ const execa = require('execa')
const minimist = require('minimist')
const semver = require('semver')
const LRU = require('lru-cache')
const chalk = require('chalk')

const {
hasYarn,
Expand All @@ -13,6 +14,7 @@ const {
hasProjectPnpm
} = require('@vue/cli-shared-utils/lib/env')
const { isOfficialPlugin, resolvePluginId } = require('@vue/cli-shared-utils/lib/pluginResolution')
const { log, warn } = require('@vue/cli-shared-utils/lib/logger')

const { loadOptions } = require('../options')
const getPackageJson = require('./getPackageJson')
Expand Down Expand Up @@ -76,7 +78,13 @@ class PackageManager {
}

if (!SUPPORTED_PACKAGE_MANAGERS.includes(this.bin)) {
throw new Error(`Unknown package manager: ${this.bin}`)
log()
warn(
`The package manager ${chalk.red(this.bin)} is ${chalk.red('not officially supported')}.\n` +
`It will be treated like ${chalk.cyan('npm')}, but compatibility issues may occur.\n` +
`See if you can use ${chalk.cyan('--registry')} instead.`
)
PACKAGE_MANAGER_CONFIG[this.bin] = PACKAGE_MANAGER_CONFIG.npm
}
}

Expand Down

0 comments on commit 8869a01

Please sign in to comment.