Skip to content

Commit d18d865

Browse files
committed
fix: use cross-platform which command
1 parent e5e16e1 commit d18d865

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"is-git-dirty": "^1.0.0",
5252
"json5": "^2.1.3",
5353
"validate-npm-package-name": "^3.0.0",
54+
"which": "^2.0.2",
5455
"yargs": "^15.3.1"
5556
},
5657
"optionalDependencies": {
@@ -72,6 +73,7 @@
7273
"@types/inquirer": "^6.5.0",
7374
"@types/json5": "^0.0.30",
7475
"@types/validate-npm-package-name": "^3.0.0",
76+
"@types/which": "^1.3.2",
7577
"@types/yargs": "^15.0.4",
7678
"commitlint": "^8.3.5",
7779
"eslint": "^7.0.0",

src/targets/typescript.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import chalk from 'chalk';
22
import path from 'path';
33
import fs from 'fs-extra';
4+
import which from 'which';
45
import spawn from 'cross-spawn';
56
import del from 'del';
67
import JSON5 from 'json5';
@@ -84,7 +85,7 @@ export default async function build({
8485
(platform() === 'win32' ? '.cmd' : '');
8586

8687
if (!(await fs.pathExists(tsc))) {
87-
tsc = spawn.sync('which', ['tsc']).stdout.toString().trim();
88+
tsc = await which('tsc');
8889

8990
report.warn(
9091
`Using a global version of ${chalk.blue(

yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,11 @@
13881388
resolved "https://registry.yarnpkg.com/@types/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#0bc835adc7d6f41cf96a59b591fe8699468f6fab"
13891389
integrity sha512-iFNNIrEaJH1lbPiyX+O/QyxSbKxrTjdNBVZGckt+iEL9So0hdZNBL68sOfHnt2txuUD8UJXvmKv/1DkgkebgUg==
13901390

1391+
"@types/which@^1.3.2":
1392+
version "1.3.2"
1393+
resolved "https://registry.yarnpkg.com/@types/which/-/which-1.3.2.tgz#9c246fc0c93ded311c8512df2891fb41f6227fdf"
1394+
integrity sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==
1395+
13911396
"@types/yargs-parser@*":
13921397
version "15.0.0"
13931398
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d"
@@ -6269,7 +6274,7 @@ which@^1.2.9:
62696274
dependencies:
62706275
isexe "^2.0.0"
62716276

6272-
which@^2.0.1:
6277+
which@^2.0.1, which@^2.0.2:
62736278
version "2.0.2"
62746279
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
62756280
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==

0 commit comments

Comments
 (0)