Skip to content

Commit bfa0576

Browse files
fsonbrentvatne
authored andcommitted
Fix yarnpkg alias usage in the init script (#329)
Despite what the comment said we were printing "Installing dependencies using yarnpkg..." yet installing them using `yarn`. Turn it the other way around and print "Installing dependencies using yarn..." but use the `yarnpkg` alias so we can avoid issues like facebook/create-react-app#1257 (Hadoop has a `yarn` command!)
1 parent 7af1283 commit bfa0576

File tree

1 file changed

+4
-4
lines changed
  • react-native-scripts/src/scripts

1 file changed

+4
-4
lines changed

react-native-scripts/src/scripts/init.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ https://github.com/npm/npm/issues/16991
113113
let args = [];
114114

115115
if (useYarn) {
116-
command = 'yarnpkg';
116+
command = 'yarn';
117117
} else {
118118
command = 'npm';
119119
args = ['install', '--save'];
@@ -126,9 +126,9 @@ https://github.com/npm/npm/issues/16991
126126
log(`Installing dependencies using ${command}...`);
127127
log(); // why is this here
128128

129-
if (command === 'yarnpkg') {
130-
// it's weird to print a yarn alias that no one uses
131-
command = 'yarn';
129+
if (command === 'yarn') {
130+
// Use the more unique `yarnpkg` alias to avoid naming conflicts with other tools.
131+
command = 'yarnpkg';
132132
}
133133

134134
const proc = spawn(command, args, { stdio: 'inherit' });

0 commit comments

Comments
 (0)