How to use react-native with yarn? – Kryptonik

Bye #npm! Now you can speed up your #reactnative init with #yarnpkg

  • switch “npm install” by “yarn add”,
  • var proc = spawn(‘yarn’, [‘add’, ‘–verbose’, getInstallPackage(rnPackage)], {stdio: ‘inherit’});
  • Change the followings npm command to yarn in the #run and #runVerbose methods
  • var proc = spawn(‘npm’, [‘install’, ‘–verbose’, ‘–save’, ‘–save-exact’, getInstallPackage(rnPackage)], {stdio: ‘inherit’});
  • exec(‘yarn add ‘ + getInstallPackage(rnPackage), function(e, stdout, stderr) {

CAUTION: Make sure to keep the original one. It is quite sure that the react-native OSS team will include this capability in the core later. But like me, you couldn’t wait.

@kryptonikco: Bye #npm! Now you can speed up your #reactnative init with #yarnpkg

As soon as I heard about yarn, I was like: “Faster react-native init? Let’s do it!”.

So I went on and got those results:

react-native init (npm): 3″57s react-native init (yarn): 2″22s

Yay!

So here how you can do it:

Basically, you need to:

line 216

to

line 232

var proc = spawn(‘npm’, [‘install’, ‘–verbose’, ‘–save’, ‘–save-exact’, getInstallPackage(rnPackage)], {stdio: ‘inherit’});

to

var proc = spawn(‘yarn’, [‘add’, ‘–verbose’, getInstallPackage(rnPackage)], {stdio: ‘inherit’});

Now enjoy your

CAUTION: Make sure to keep the original one. It is quite sure that the react-native OSS team will include this capability in the core later. But like me, you couldn’t wait.

How to use react-native with yarn? – Kryptonik