-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Extract CLI out #22174
Extract CLI out #22174
Conversation
Note: Android tests seem to be failing anyway - I am ignoring them locally on my machine too. Will report back once I find out. It's likely because this is super fresh PR based on latest master. |
|
CLI is now updated to the latest commit. I am going to work on it tomorrow. I need to set up proper CI tests for the CLI itself and make sure all the Flow/Unit tests are passing w/o issues. We are moving in the right direction. |
package.json
Outdated
@@ -191,6 +191,7 @@ | |||
"prop-types": "^15.5.8", | |||
"react-clone-referenced-element": "^1.0.1", | |||
"react-devtools-core": "^3.4.0", | |||
"react-native-local-cli": "^0.57.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.
Do you expect that the CLI and react-native will continue to be versioned together?
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.
To be defined. Did it really quick to demonstrate it on the CI. Since I don't plan on releasing CLI exactly at the time of the new React Native release (in fact, I would like to do it more often to fix critical issues faster and ship new improvements), it will be really hard to keep up the same number and not to cause confusion.
I guess we can start with 1.0.0
when the migration is over and the PR is ready.
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 agree with having separate versioning, but this means that the new repo must have a table of compatibility of some sort
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.
Don't think it's needed at the beginning since React Native contains a dependency on CLI for now. It is similar to the way we handle Metro - it also doesn't have compatibility table on React Native.
However, I do think keeping a peerDependency
is going to be the right choice to make it easier to sync CLI and React Native versions together.
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.
FYI I already published 1.0.0-alpha.0
version and updated this PR.
Libraries/Image/assetPathUtils.js
Outdated
* FIXME: using number to represent discrete scale numbers is fragile in essence because of | ||
* floating point numbers imprecision. | ||
*/ | ||
function getAndroidAssetSuffix(scale: number): string { |
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.
This file is now duplicated between React Native and React Native CLI. Shall we consider making it a separate package, e.g. react-native-cli-path-utils
and publish to npm
?
CC: @TheSavior
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 feel that to keep RN and the CLI separated but having them both using these utils the separate package option is a valid solution
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.
Yeah. For now, I think we can ship the copy and figure out this as a next PR. Problem with this one is that I need to update local-cli
folder every time something changes which is very hard. Hopefully, we can get this reviewed ASAP.
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.
Note that this file is for more than just images, so it does need to be in RN, to be used by other asset types.
Update: There's one last issue I need to fix related to Metro Bundler. Once that happens, this will be ready for review. I am hoping to do it by today. |
This pull request is ready to be reviewed. I have tested it by: Migration strategy:
For every new release, we are going to verify that CLI works (by running step "c" from the above, which is exactly the same workflow we used to have) and if there are no issues, the To Metro team: This is non-breaking and transparent change to users unless they were requiring files from The sooner we merge it, the easier it will be for us to keep up with changes that happen to CLI itself and React Native. |
Note: We don't have to ship it in next RC. This commit can be easily excluded if it causes any concerns. It can also be easily cherry-picked to the next version. |
Note: Once the PR is merged, I will work on:
|
Tests are green. Please ignore Appveyor error - I don't know why it happens. |
require('../setupBabel')(); | ||
|
||
var cliEntry = require('./cliEntry'); | ||
var cli = require('react-native-local-cli'); |
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): why change the name of the variable ?
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 ended up overwriting this file with a local copy I created upfront. Not intentional, I can revert if needed.
@@ -22,7 +22,7 @@ import type {PackagerAsset} from 'AssetRegistry'; | |||
const PixelRatio = require('PixelRatio'); | |||
const Platform = require('Platform'); | |||
|
|||
const assetPathUtils = require('../../local-cli/bundle/assetPathUtils'); |
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.
assetPathUtils are not limited to images. They also impact all other types of assets.
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.
Right, but my understanding is that the "impact" is more present in the local-cli
context where the utils are used to generate a path to any type of asset.
On the React Native side of things, this file is only used in Image
module. Anyway, this shouldn't be an issue now that the local-cli
folder will not be removed. I am going to revert this change and w can leave this to be refactored at some point.
@@ -10,7 +10,7 @@ | |||
|
|||
'use strict'; | |||
|
|||
import type {PackagerAsset} from '../../Libraries/Image/AssetRegistry'; |
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.
Not sure if moving this utility and making it specific to Image makes sense. This is for all assets. Maybe this should be a separate util.
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.
Again, not an issue that we leave local-cli
. However, this is only used in Image
module on the React Native side.
Closing in favor of #22337. We have decided to not remove |
Summary: Continuation of #22174 with an exception that `local-cli` folder is left in React Native repository to keep Facebook internal and React Native calls still working. Separate strategy should be developed to remove all uses of `local-cli` in favor of dedicated utilities. Pull Request resolved: #22337 Reviewed By: TheSavior Differential Revision: D13172898 Pulled By: cpojer fbshipit-source-id: 0217867f9944648307475ebe629eb729da7bfaaf
Summary: Continuation of facebook/react-native#22174 with an exception that `local-cli` folder is left in React Native repository to keep Facebook internal and React Native calls still working. Separate strategy should be developed to remove all uses of `local-cli` in favor of dedicated utilities. Pull Request resolved: facebook/react-native#22337 Reviewed By: TheSavior Differential Revision: D13172898 Pulled By: cpojer fbshipit-source-id: 0217867f9944648307475ebe629eb729da7bfaaf
@grabbou excuse my ignorance, but I see that local-cli has been removed in favor of react-native-local-cli which is published on npm but I cannot find the source anywhere? Is it in source control somewhere? |
@JAStanton you can find the repo here -> https://github.com/react-native-community/react-native-cli And the original proposal -> react-native-community/discussions-and-proposals#13 |
Thank you!
…On Thu, Dec 13, 2018 at 1:31 AM Lorenzo Sciandra ***@***.***> wrote:
@JAStanton <https://github.com/JAStanton> you can find the repo here ->
https://github.com/react-native-community/react-native-cli
And the original proposal ->
react-native-community/discussions-and-proposals#13
<react-native-community/discussions-and-proposals#13>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22174 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAnYtJZ1uZedmzKVqnn0_9ABi8CmZGxDks5u4h5-gaJpZM4YQakz>
.
|
Summary: This sync includes the following changes: - **[95d762e40](facebook/react@95d762e40 )**: Remove duplicate test //<Andrew Clark>// - **[d4d1dc085](facebook/react@d4d1dc085 )**: Reorder VARIANT feature flags ([#22266](facebook/react#22266)) //<Dan Abramov>// - **[2f156eafb](facebook/react@2f156eafb )**: Adjust consoleManagedByDevToolsDuringStrictMode feature flag ([#22253](facebook/react#22253)) //<Dan Abramov>// - **[cfd819332](facebook/react@cfd819332 )**: Add useSyncExternalStore to react-debug-tools ([#22240](facebook/react#22240)) //<Andrew Clark>// - **[8e80592a3](facebook/react@8e80592a3 )**: Remove state queue from useSyncExternalStore ([#22265](facebook/react#22265)) //<Andrew Clark>// - **[06f98c168](facebook/react@06f98c168 )**: Implement useSyncExternalStore in Fiber ([#22239](facebook/react#22239)) //<Andrew Clark>// - **[77912d9a0](facebook/react@77912d9a0 )**: Wire up the native API for useSyncExternalStore ([#22237](facebook/react#22237)) //<Andrew Clark>// - **[031abd24b](facebook/react@031abd24b )**: Add warning and test for useSyncExternalStore when getSnapshot isn't cached ([#22262](facebook/react#22262)) //<salazarm>// - **[b8884de24](facebook/react@b8884de24 )**: break up import keyword to avoid being accidentally parsed as dynamic import statement in external code ([#21918](facebook/react#21918)) //<Jianhua Zheng>// - **[6d6bba5bf](facebook/react@6d6bba5bf )**: Fix typo in ReactUpdatePriority-test.js ([#21958](facebook/react#21958)) //<Ikko Ashimine>// - **[0c0d1ddae](facebook/react@0c0d1ddae )**: feat(eslint-plugin-react-hooks): support ESLint 8.x ([#22248](facebook/react#22248)) //<Michaël De Boey>// - **[1314299c7](facebook/react@1314299c7 )**: Initial shim of useSyncExternalStore ([#22211](facebook/react#22211)) //<Andrew Clark>// - **[fc40f02ad](facebook/react@fc40f02ad )**: Add consoleManagedByDevToolsDuringStrictMode feature flag in React Reconciler ([#22196](facebook/react#22196)) //<Luna Ruan>// - **[46a0f050a](facebook/react@46a0f050a )**: Set up use-sync-external-store package ([#22202](facebook/react#22202)) //<Andrew Clark>// - **[8723e772b](facebook/react@8723e772b )**: Fix a string interpolation typo in ReactHooks test ([#22174](facebook/react#22174)) //<Matt Hargett>// - **[60a30cf32](facebook/react@60a30cf32 )**: Console Logging for StrictMode Double Rendering ([#22030](facebook/react#22030)) //<Luna Ruan>// - **[76bbad3e3](facebook/react@76bbad3e3 )**: Add maxYieldMs feature flag in Scheduler ([#22165](facebook/react#22165)) //<Ricky>// - **[b0b53ae2c](facebook/react@b0b53ae2c )**: Add feature flags for scheduler experiments ([#22105](facebook/react#22105)) //<Ricky>// Changelog: [General][Changed] - React Native sync for revisions bd5bf55...95d762e jest_e2e[run_all_tests] Reviewed By: mdvacca Differential Revision: D30809906 fbshipit-source-id: 131cfdf91e15f67fa59a5d925467e538ee89fe10
Removes CLI and uses
react-native-local-cli
instead. Opening this PR to make sure tests are green and that all requires tolocal-cli
are either removed or replaced with a new version.Right now, the
react-native-local-cli
is synced withlocal-cli
folder present in 0.57.0 of React Native. I will work on upgrading that shortly as we tried to make minimal changes to the CLI before it actually gets extracted.Next steps:
react-native init
works and new projects work w/o issueslocal-cli
are replaced