Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/create-docusaurus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"tslib": "^2.6.0"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/supports-color": "^10.0.0"
},
"engines": {
Expand Down
9 changes: 5 additions & 4 deletions packages/create-docusaurus/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
* LICENSE file in the root directory of this source tree.
*/

// @ts-expect-error: no types, but same as spawn()
import CrossSpawn from 'cross-spawn';
import type {spawn, SpawnOptions} from 'node:child_process';
import crossSpawn from 'cross-spawn';

// This is the same as node's child_process.SpawnOptions type, but extract from
// cross-spawn directly to ensure direct compatibility.
Comment on lines +10 to +11
type SpawnOptions = NonNullable<Parameters<typeof crossSpawn>[2]>;

// We use cross-spawn instead of spawn because of Windows compatibility issues.
// For example, "yarn" doesn't work on Windows, it requires "yarn.cmd"
// Tools like execa() use cross-spawn under the hood, and "resolve" the command
const crossSpawn: typeof spawn = CrossSpawn;

/**
* Run a command, similar to execa(cmd,args) but simpler
Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4617,6 +4617,13 @@
dependencies:
"@types/node" "*"

"@types/cross-spawn@^6.0.6":
version "6.0.6"
resolved "https://registry.yarnpkg.com/@types/cross-spawn/-/cross-spawn-6.0.6.tgz#0163d0b79a6f85409e0decb8dcca17147f81fd22"
integrity sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA==
dependencies:
"@types/node" "*"

"@types/d3-array@*":
version "3.2.1"
resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.2.1.tgz#1f6658e3d2006c4fceac53fde464166859f8b8c5"
Expand Down
Loading