mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(@vant/cli): support pnpm install (#9824)
This commit is contained in:
parent
8c7d301526
commit
105dda07d6
@ -1,6 +1,9 @@
|
|||||||
|
import fs from 'fs-extra';
|
||||||
import execa from 'execa';
|
import execa from 'execa';
|
||||||
|
import { join } from 'path';
|
||||||
import { consola } from './logger.js';
|
import { consola } from './logger.js';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
|
import { ROOT } from './constant.js';
|
||||||
|
|
||||||
let hasYarnCache: boolean;
|
let hasYarnCache: boolean;
|
||||||
|
|
||||||
@ -17,11 +20,16 @@ export function hasYarn() {
|
|||||||
return hasYarnCache;
|
return hasYarnCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isUsingPnpm() {
|
||||||
|
const pnpmLock = join(ROOT, 'pnpm-lock.yaml');
|
||||||
|
return fs.existsSync(pnpmLock);
|
||||||
|
}
|
||||||
|
|
||||||
export async function installDependencies() {
|
export async function installDependencies() {
|
||||||
consola.info('Install Dependencies\n');
|
consola.info('Install Dependencies\n');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const manager = hasYarn() ? 'yarn' : 'npm';
|
const manager = isUsingPnpm() ? 'pnpm' : hasYarn() ? 'yarn' : 'npm';
|
||||||
|
|
||||||
await execa(manager, ['install', '--prod=false'], {
|
await execa(manager, ['install', '--prod=false'], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user