Skip to content

Commit 676f034

Browse files
fsonbrentvatne
authored andcommitted
Fix Yarn usage instructions (#342)
Print `yarn` in instructions instead of `yarnpkg`
1 parent 3b3fbea commit 676f034

File tree

1 file changed

+9
-13
lines changed
  • react-native-scripts/src/scripts

1 file changed

+9
-13
lines changed

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

+9-13
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 = 'yarn';
116+
command = 'yarnpkg';
117117
} else {
118118
command = 'npm';
119119
args = ['install', '--save'];
@@ -123,14 +123,10 @@ https://github.com/npm/npm/issues/16991
123123
}
124124
}
125125

126-
log(`Installing dependencies using ${command}...`);
126+
const npmOrYarn = useYarn ? 'yarn' : 'npm';
127+
log(`Installing dependencies using ${npmOrYarn}...`);
127128
log(); // why is this here
128129

129-
if (command === 'yarn') {
130-
// Use the more unique `yarnpkg` alias to avoid naming conflicts with other tools.
131-
command = 'yarnpkg';
132-
}
133-
134130
const proc = spawn(command, args, { stdio: 'inherit' });
135131
proc.on('close', code => {
136132
if (code !== 0) {
@@ -153,30 +149,30 @@ https://github.com/npm/npm/issues/16991
153149
Success! Created ${appName} at ${appPath}
154150
Inside that directory, you can run several commands:
155151
156-
${chalk.cyan(command + ' start')}
152+
${chalk.cyan(npmOrYarn + ' start')}
157153
Starts the development server so you can open your app in the Expo
158154
app on your phone.
159155
160-
${chalk.cyan(command + ' run ios')}
156+
${chalk.cyan(npmOrYarn + ' run ios')}
161157
(Mac only, requires Xcode)
162158
Starts the development server and loads your app in an iOS simulator.
163159
164-
${chalk.cyan(command + ' run android')}
160+
${chalk.cyan(npmOrYarn + ' run android')}
165161
(Requires Android build tools)
166162
Starts the development server and loads your app on a connected Android
167163
device or emulator.
168164
169-
${chalk.cyan(command + ' test')}
165+
${chalk.cyan(npmOrYarn + ' test')}
170166
Starts the test runner.
171167
172-
${chalk.cyan(command + ' run eject')}
168+
${chalk.cyan(npmOrYarn + ' run eject')}
173169
Removes this tool and copies build dependencies, configuration files
174170
and scripts into the app directory. If you do this, you can’t go back!
175171
176172
We suggest that you begin by typing:
177173
178174
${chalk.cyan('cd ' + cdpath)}
179-
${chalk.cyan(command + ' start')}`
175+
${chalk.cyan(npmOrYarn + ' start')}`
180176
);
181177

182178
if (readmeExists) {

0 commit comments

Comments
 (0)