Skip to content

Commit c50fecb

Browse files
committed
Use cross-spawn types instead of raw types from Node
Cleans up some of the fallout from #11684 which simplified some code but removed some type safety.
1 parent 7518645 commit c50fecb

3 files changed

Lines changed: 32 additions & 9 deletions

File tree

packages/create-docusaurus/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"tslib": "^2.6.0"
3232
},
3333
"devDependencies": {
34+
"@types/cross-spawn": "^6.0.6",
3435
"@types/supports-color": "^10.0.0"
3536
},
3637
"engines": {

packages/create-docusaurus/src/utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
// @ts-expect-error: no types, but same as spawn()
9-
import CrossSpawn from 'cross-spawn';
10-
import type {spawn, SpawnOptions} from 'node:child_process';
8+
import crossSpawn from 'cross-spawn';
9+
10+
// This is the same as node's child_process.SpawnOptions type, but extract from
11+
// cross-spawn directly to ensure direct compatibility.
12+
type SpawnOptions = NonNullable<Parameters<typeof crossSpawn>[2]>;
1113

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

1718
/**
1819
* Run a command, similar to execa(cmd,args) but simpler

yarn.lock

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,6 +4617,13 @@
46174617
dependencies:
46184618
"@types/node" "*"
46194619

4620+
"@types/cross-spawn@^6.0.6":
4621+
version "6.0.6"
4622+
resolved "https://registry.yarnpkg.com/@types/cross-spawn/-/cross-spawn-6.0.6.tgz#0163d0b79a6f85409e0decb8dcca17147f81fd22"
4623+
integrity sha512-fXRhhUkG4H3TQk5dBhQ7m/JDdSNHKwR2BBia62lhwEIq9xGiQKLxd6LymNhn47SjXhsUEPmxi+PKw2OkW4LLjA==
4624+
dependencies:
4625+
"@types/node" "*"
4626+
46204627
"@types/d3-array@*":
46214628
version "3.2.1"
46224629
resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.2.1.tgz#1f6658e3d2006c4fceac53fde464166859f8b8c5"
@@ -6247,7 +6254,16 @@ axe-core@^4.10.0:
62476254
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.10.2.tgz#85228e3e1d8b8532a27659b332e39b7fa0e022df"
62486255
integrity sha512-RE3mdQ7P3FRSe7eqCWoeQ/Z9QXrtniSjp1wUjt5nRC3WIpz5rSCve6o3fsZ2aCpJtrZjSZgjwXAoTO5k4tEI0w==
62496256

6250-
axios@1.14.0, axios@^1.0.0, axios@^1.15.2, axios@^1.5.0, axios@^1.7.7:
6257+
axios@1.14.0:
6258+
version "1.14.0"
6259+
resolved "https://registry.yarnpkg.com/axios/-/axios-1.14.0.tgz#7c29f4cf2ea91ef05018d5aa5399bf23ed3120eb"
6260+
integrity sha512-3Y8yrqLSwjuzpXuZ0oIYZ/XGgLwUIBU3uLvbcpb0pidD9ctpShJd43KSlEEkVQg6DS0G9NKyzOvBfUtDKEyHvQ==
6261+
dependencies:
6262+
follow-redirects "^1.15.11"
6263+
form-data "^4.0.5"
6264+
proxy-from-env "^2.1.0"
6265+
6266+
axios@^1.0.0, axios@^1.5.0, axios@^1.7.7:
62516267
version "1.15.2"
62526268
resolved "https://registry.yarnpkg.com/axios/-/axios-1.15.2.tgz#eb8fb6d30349abace6ade5b4cb4d9e8a0dc23e5b"
62536269
integrity sha512-wLrXxPtcrPTsNlJmKjkPnNPK2Ihe0hn0wGSaTEiHRPxwjvJwT3hKmXF4dpqxmPO9SoNb2FsYXj/xEo0gHN+D5A==
@@ -15534,10 +15550,15 @@ react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
1553415550
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
1553515551
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
1553615552

15537-
react-is@^17.0.1, react-is@^18.0.0, react-is@^19.2.0:
15538-
version "19.2.5"
15539-
resolved "https://registry.yarnpkg.com/react-is/-/react-is-19.2.5.tgz#7e7b54143e9313fed787b23fd4295d5a23872ad9"
15540-
integrity sha512-Dn0t8IQhCmeIT3wu+Apm1/YVsJXsGWi6k4sPdnBIdqMVtHtv0IGi6dcpNpNkNac0zB2uUAqNX3MHzN8c+z2rwQ==
15553+
react-is@^17.0.1:
15554+
version "17.0.2"
15555+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
15556+
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
15557+
15558+
react-is@^18.0.0:
15559+
version "18.3.1"
15560+
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
15561+
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==
1554115562

1554215563
react-json-view-lite@^2.3.0:
1554315564
version "2.5.0"

0 commit comments

Comments
 (0)