-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Yarn for Install/Uninstall CLI if available #11174
Conversation
local-cli/util/yarn.js
Outdated
@@ -8,6 +8,7 @@ | |||
*/ | |||
'use strict'; | |||
|
|||
const execSync = require('child_process').execSync; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Probably not required since it's not used in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more detail,
- As I understand,
init/init
usesyarn.getYarnVersionIfAvailable()
to get version and it will returnnull
fromcatch
block due toexecSync is not defined
This will walk you through creating a new React Native project in /Users/n3tr/Code/RN/AwesomeApp
Using yarn v0.16.1
Installing react-native... # via yarn
Setting up new React Native app in /Users/n3tr/Code/RN/AwesomeApp
Installing React... # via npm: from npm install output (init/init.js:80)
Installing Jest...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w00t, good catch!
local-cli/install/install.js
Outdated
yarn.getYarnVersionIfAvailable() && | ||
yarn.isGlobalCliUsingYarn(projectDir); | ||
|
||
var res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: You could use let
here.
local-cli/install/install.js
Outdated
@@ -10,7 +11,17 @@ log.heading = 'rnpm-install'; | |||
function install(args, config) { | |||
const name = args[0]; | |||
|
|||
var res = spawnSync('npm', ['install', name, '--save'], spawnOpts); | |||
const projectDir = config.getProjectRoots()[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is config.getProjectRoots()
guaranteed to return an array with at least one element? What if it doesn't, or what if it starts returning undefined
under some circumstances in the future? Better check for it just to be safe.
Is this the standard way we use to get the current project dir everywhere else in the CLI, or are there other ways that might be more reliable? Is it possible that people override getProjectRoots
in their config to return something else than the folder you'd actually want to use here in the isGlobalCliUsingYarn
check? The projectDir
here should always be something like ~/MyApp
, the same folder where package.json lives, correct?
Just asking some basic questions, I'm not familiar with how the config works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct.
config.getProjectRoots()
can be overridden by user in rn-cli.config.js
which can return anything.
I just read through the cli code. I think we can simply use process.cwd()
to get projectDir
since react-native-cli/index.js
already has prevented us from running react-native <commend>
outside project directory (contains ./node_modules/react-native/cli.js
), What you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If process.cwd()
works and it's what the rest of the CLI uses I think it sounds good.
This is awesome, thank you so much for doing it! Commented with just some small nit and questions. |
local-cli/install/install.js
Outdated
if (isYarnAvailable) { | ||
res = spawnSync('yarn', ['add', name], spawnOpts); | ||
} else { | ||
res = spawnSync('npm', ['install', name, '--save'], spawnOpts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we like including that piece of functionality in many places? Wouldn't it be easier to just have a spawnSync
util, called callYarnOrNpm
that abstracts that? There are few other places where its going to be needed and so I'd like to keep it as minimal as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking as well but still have some questions:
- How to handle the different command of
yarn [add]
andnpm [install --save]
? - Should it accept an option to allows to force use the
npm
client (like inreact-native-cli/index
)?
What if I make a function call look like:
callYarnOrNpm('add some-package', 'install some-package --save', options);
and let it decides which command will be executed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manager.add('some-package') // translates to `yarn add some-package` with yarn & `npm install some-package --save` with npm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and init manager with
const manager = new Manager({engine: isYarnInstalled ? 'yarn' : 'npm'});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then move this ^ to the separated file and export an instance of the manager.
Btw, great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm thinking too much, I will try to make it simple and improve later depends on further use case. 🤒
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you for a really nice feedback ❤️. I think I can help addressing this one:
4 - RARE CASE: Caller want to stick with npm
like react-native-cli/index which allows user can init project with --npm flag and it's happen only before react-native have been installed - it doesn't use local-cli during its process. btw I don't think we need to support --npm flag in local-cli right now.
I think it won't be complicated to check if the current repo has been scaffolded using --npm
flag or not. It can be added to the manager's constructor, right next to the check if user have yarn
installed. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to create manager
class and export its instance? IMO, wouldn't it be simpler to just exports a plain object with functions?
module.exports = {
add: add,
remove: remove
}
and I'm not sure what's the filename will be used for manager
? is PackageManager
good enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackageManager
is absolutely fine! The reason why I want to export an instance is that you don't want to check which package manager user is using every time. But at the same moment I'm not sure if we use any command more than once during the CLI run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, I just checked that we don't have any places where we call packageManager 2 or more times, so I'm fine with a plain object 😉
Requesting changes because of config.getProjectRoots()[0].
Requesting changes because of Thanks for the review @Kureev! @n3tr, @Kureev I just noticed there is this line in install.js:
Should it be replaced by something else, e.g. calling into Rnpm is now part of the CLI and I think 'rnpm link' is going to fail for most people as they don't have rnpm installed? Sorry about the delay reviewing this! |
@mkonicek the latest commits no longer use I have tested by remove
It doesn't throw any errors and also doesn't link any dependencies which isn't what we expected. I'll look into it sometime this week. |
Maybe I'm wrong, but res = spawnSync('rnpm', ['link', name], spawnOpts); About throwing an error: |
@Kureev I think you're correct. I've updated the code to res = spawnSync('react-native', ['link', name], spawnOpts); also update › react-native install react-native-image-picker@latest
yarn add v0.16.1
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 📃 Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency
└─ react-native-image-picker@0.24.1
✨ Done in 3.54s.
rnpm-install info Linking react-native-image-picker android dependency
rnpm-install info Android module react-native-image-picker has been successfully linked
rnpm-install info Linking react-native-image-picker ios dependency
rnpm-install info iOS module react-native-image-picker has been successfully linked
rnpm-install info Module react-native-image-picker@latest has been successfully installed & linked |
Awesome! You rock! Do you have anything else blocking this PR? |
@Kureev No, It looks good to me. 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Something went wrong when importing this pull request. Please cc someone from the team at fb to help with importing this. |
I think this branch should be rebased |
- Use yarn if available - Fix lint warning
- PackageManager.add(‘some-package’)
- Support install some-package@version
705b989
to
f7c072b
Compare
@Kureev rebased :) |
@bestander has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@mkonicek has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes facebook#11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Summary: Make `react-native install` and `uninstall` cli to use yarn if available (fixes #11122) **Test plan Yarn** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeApp 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **Test plan NPM** 1. Publish to Sinopia: https://github.com/facebook/react-native/tree/master/react-native-cli 2. react-native init AwesomeAppNPM --npm 3. react-native install react-native-fit-image 4. react-native uninstall react-native-fit-image **output (yarn.lock)** ``` > react-native install react-native-fit-image yarn add v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... success Saved lockfile. success Saved 1 new dependency └─ react-native-fit-image@1.4.6 ✨ Done in 4.11s. rnpm-install info Module react-native-fit-image has been successfully Closes facebook/react-native#11174 Differential Revision: D4441872 fbshipit-source-id: 05bd30e1ad14bdbe861259c88e1f18df77cfa54f
Make
react-native install
anduninstall
cli to use yarn if available (fixes #11122)Test plan Yarn
Test plan NPM
output (yarn.lock)
output (without yarn.lock)