command.js 415 B

1234567891011121314
  1. const {
  2. hasYarn,
  3. hasProjectYarn,
  4. hasPnpm3OrLater,
  5. hasProjectPnpm
  6. } = require('@vue/cli-shared-utils')
  7. const { loadOptions } = require('@vue/cli/lib/options')
  8. exports.getCommand = function (cwd = undefined) {
  9. if (!cwd) {
  10. return loadOptions().packageManager || (hasYarn() ? 'yarn' : hasPnpm3OrLater() ? 'pnpm' : 'npm')
  11. }
  12. return hasProjectYarn(cwd) ? 'yarn' : hasProjectPnpm(cwd) ? 'pnpm' : 'npm'
  13. }