feat(v2): skip dependency install on docusaurus init (#3986)

* fix: #3450

Signed-off-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

* test: fix failing test

Signed-off-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Kumar Aditya 2021-01-04 20:47:06 +05:30 committed by GitHub
parent 869e118e4f
commit 0bb5e547b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 10 deletions

View file

@ -43,6 +43,7 @@ export default async function init(
reqTemplate?: string,
cliOptions: Partial<{
useNpm: boolean;
skipInstall: boolean;
}> = {},
): Promise<void> {
const useYarn = !cliOptions.useNpm ? hasYarn() : false;
@ -155,14 +156,15 @@ export default async function init(
}
const pkgManager = useYarn ? 'yarn' : 'npm';
if (!cliOptions.skipInstall) {
console.log(`Installing dependencies with: ${chalk.cyan(pkgManager)}`);
console.log(`Installing dependencies with: ${chalk.cyan(pkgManager)}`);
try {
shell.exec(`cd "${name}" && ${useYarn ? 'yarn' : 'npm install'}`);
} catch (err) {
console.log(chalk.red('Installation failed'));
throw err;
try {
shell.exec(`cd "${name}" && ${useYarn ? 'yarn' : 'npm install'}`);
} catch (err) {
console.log(chalk.red('Installation failed'));
throw err;
}
}
console.log();