mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-22 04:28:10 +02:00
fix: install deps for new project via Yarn properly (#5490)
This commit is contained in:
parent
29e06d0677
commit
ebf81b6ef6
3 changed files with 19 additions and 5 deletions
13
packages/docusaurus-init/src/index.ts
Normal file → Executable file
13
packages/docusaurus-init/src/index.ts
Normal file → Executable file
|
@ -12,6 +12,7 @@ import prompts, {Choice} from 'prompts';
|
|||
import path from 'path';
|
||||
import shell from 'shelljs';
|
||||
import {kebabCase, sortBy} from 'lodash';
|
||||
import supportsColor from 'supports-color';
|
||||
|
||||
const RecommendedTemplate = 'classic';
|
||||
const TypeScriptTemplateSuffix = '-typescript';
|
||||
|
@ -239,11 +240,15 @@ ${chalk.cyan('Creating new Docusaurus project...')}
|
|||
console.log(`Installing dependencies with ${chalk.cyan(pkgManager)}...`);
|
||||
|
||||
try {
|
||||
// Use force coloring the output, since the command is invoked by shelljs, which is not the interactive shell
|
||||
shell.exec(
|
||||
`cd "${name}" && ${
|
||||
// Force coloring the output, because the command is invoked by shelljs, not in the interative shell
|
||||
useYarn ? 'FORCE_COLOR=true yarn' : 'npm install --color always'
|
||||
}`,
|
||||
`cd "${name}" && ${useYarn ? 'yarn' : 'npm install --color always'}`,
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
|
||||
},
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
console.log(chalk.red('Installation failed.'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue