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

feat: support custom package manager #4621

Merged
merged 5 commits into from Sep 30, 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
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