Skip to content

Commit

Permalink
Fix yarnpkg alias usage in the init script (#329)
Browse files Browse the repository at this point in the history
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!)
  • Loading branch information
fson authored and brentvatne committed Jul 27, 2017
1 parent 7af1283 commit bfa0576
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions react-native-scripts/src/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ https://github.com/npm/npm/issues/16991
let args = [];

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

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

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

0 comments on commit bfa0576

Please sign in to comment.