Skip to content

Commit 69d822c

Browse files
Use common strategy to decide whether to use yarn or npm.
1 parent 9670be6 commit 69d822c

File tree

1 file changed

+2
-11
lines changed
  • packages/react-scripts/scripts

1 file changed

+2
-11
lines changed

packages/react-scripts/scripts/init.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const spawn = require('react-dev-utils/crossSpawn');
2222
const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
2323
const os = require('os');
2424
const resolveFrom = require('resolve-from');
25+
const paths = require('../config/paths');
2526

2627
function isInGitRepository() {
2728
try {
@@ -75,15 +76,6 @@ function tryGitInit(appPath) {
7576
}
7677
}
7778

78-
function isYarnAvailable() {
79-
try {
80-
execSync('yarnpkg --version', { stdio: 'ignore' });
81-
return true;
82-
} catch (e) {
83-
return false;
84-
}
85-
}
86-
8779
module.exports = function(
8880
appPath,
8981
appName,
@@ -98,8 +90,7 @@ module.exports = function(
9890
'..'
9991
);
10092
const appPackage = require(path.join(appPath, 'package.json'));
101-
const useYarn =
102-
fs.existsSync(path.join(appPath, 'yarn.lock')) || isYarnAvailable();
93+
const useYarn = paths.useYarn;
10394

10495
// Copy over some of the devDependencies
10596
appPackage.dependencies = appPackage.dependencies || {};

0 commit comments

Comments
 (0)