Skip to content

Commit dec3bcb

Browse files
authored
fix(create-docusaurus): fix CLI and remove shelljs escapeShellArg util (#10958)
1 parent 2976dfe commit dec3bcb

File tree

4 files changed

+6
-45
lines changed

4 files changed

+6
-45
lines changed

packages/create-docusaurus/src/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {logger} from '@docusaurus/logger';
1313
import execa from 'execa';
1414
import prompts, {type Choice} from 'prompts';
1515
import supportsColor from 'supports-color';
16-
import {escapeShellArg, askPreferredLanguage} from '@docusaurus/utils';
16+
17+
// TODO remove dependency on large @docusaurus/utils
18+
// would be better to have a new smaller @docusaurus/utils-cli package
19+
import {askPreferredLanguage} from '@docusaurus/utils';
1720

1821
type LanguagesOptions = {
1922
javascript?: boolean;
@@ -530,10 +533,7 @@ export default async function init(
530533

531534
if (source.type === 'git') {
532535
const gitCommand = await getGitCommand(source.strategy);
533-
const gitCloneCommand = `${gitCommand} ${escapeShellArg(
534-
source.url,
535-
)} ${escapeShellArg(dest)}`;
536-
if (execa.command(gitCloneCommand).exitCode !== 0) {
536+
if ((await execa(gitCommand, [source.url, dest])).exitCode !== 0) {
537537
logger.error`Cloning Git template failed!`;
538538
process.exit(1);
539539
}
@@ -598,8 +598,7 @@ export default async function init(
598598
{
599599
env: {
600600
...process.env,
601-
// Force coloring the output, since the command is invoked by
602-
// shelljs, which is not an interactive shell
601+
// Force coloring the output
603602
...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
604603
},
605604
},

packages/docusaurus-utils/src/__tests__/shellUtils.test.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/docusaurus-utils/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export {
107107
getWebpackLoaderCompilerName,
108108
type WebpackCompilerName,
109109
} from './webpackUtils';
110-
export {escapeShellArg} from './shellUtils';
111110
export {loadFreshModule} from './moduleUtils';
112111
export {
113112
getDataFilePath,

packages/docusaurus-utils/src/shellUtils.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)