Summary: The controller you requested could not be found.
Reviewed By: gabelevi
Differential Revision: D9390604
fbshipit-source-id: 68ba89ba197f74322e4c85c3bfc1f334fb740852
Summary:
Most of the changes associated with this commit will not be visible on GitHub, as they concern files in the internal Facebook monorepo. The bulk of this change is the addition of a new test that runs on the internal test infrastructure. The actual script used by the test has various references to the internal test infra, but a copy is produced below with some changes that should allow it to run on open source should anyone be interested in testing this outside of Facebook.
The test has the main goal of catching common sources of FB-to-GitHub breakages, such as the OSS Flow config falling out of date (we use a different flow config than what is synced out in .flowconfig, and hence internally we rename this file to .github.flowconfig). It also checks that the packager can run on a brand new project, among other things.
```
set -e
THIS_DIR=$(pwd)
REACT_NATIVE_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
REACT_NATIVE_APP_TEMP_DIR=$(mktemp -d /tmp/react-native-XXXXXXXX)
OFFLINE_MIRROR=$(yarn config get yarn-offline-mirror)
function describe {
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
}
function cleanup {
set +e
rm -rf "$REACT_NATIVE_TEMP_DIR"
rm -rf "$REACT_NATIVE_APP_TEMP_DIR"
rm "$OFFLINE_MIRROR/react-native-v1000.0.0.tgz"
set -e
}
trap cleanup EXIT
describe "Creating temporary react-native-github clone"
cp -R "react-native" "$REACT_NATIVE_TEMP_DIR"
pushd "$REACT_NATIVE_TEMP_DIR/react-native" >/dev/null
echo yarn-offline-mirror="$OFFLINE_MIRROR" > .npmrc
describe "Installing react-native node_modules from offline cache"
yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1
describe "Running a Flow check"
mv .github.flowconfig .flowconfig
./node_modules/.bin/flow check
describe "Running a basic packager test"
touch .watchmanconfig
node local-cli/cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
describe "Creating package for e2e test"
yarn pack
REACT_NATIVE_PACKAGE="$(pwd)/react-native-v1000.0.0.tgz"
REACT_VERSION=$(node -p -e "require('./package.json').peerDependencies['react']")
REACT_NATIVE_HASH=$(shasum "$REACT_NATIVE_PACKAGE" | awk '{print $1;}')
REACT_NATIVE_DEPS=$(node -p -e "const deps=require('./package.json').dependencies; ' ' + Object.keys(deps).map(dep => dep + ' \"' + deps[dep] +'\"').join('\n ')")
popd >/dev/null
describe "Installing temporary RN app"
mkdir "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest"
pushd "$REACT_NATIVE_APP_TEMP_DIR/PackagerTest" >/dev/null
cp "$REACT_NATIVE_PACKAGE" ./
cp "$REACT_NATIVE_PACKAGE" "$OFFLINE_MIRROR"
cp "$REACT_NATIVE_TEMP_DIR/react-native/.npmrc" ./
cp "$REACT_NATIVE_TEMP_DIR/react-native/yarn.lock" ./
cat <<LOCKFILE >> yarn.lock
react-native@1000.0.0:
version "1000.0.0"
resolved react-native-v1000.0.0.tgz#$REACT_NATIVE_HASH
dependencies:
$REACT_NATIVE_DEPS
LOCKFILE
cat > package.json <<- EndOfFile
{
"name": "packager-test",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "$REACT_VERSION",
"react-native": "1000.0.0"
}
}
EndOfFile
yarn install --mutex network --offline --frozen-lockfile --ignore-engines --ignore-scripts 2>&1
sed -e s/"HelloWorld"/PackagerTest/g "react-native/local-cli/templates/HelloWorld/app.json" > app.json
cp "react-native/local-cli/templates/HelloWorld/_buckconfig" .buckconfig
cp "react-native/local-cli/templates/HelloWorld/_flowconfig" .flowconfig
cp "react-native/local-cli/templates/HelloWorld/_watchmanconfig" .watchmanconfig
cp "react-native/local-cli/templates/HelloWorld/App.js" App.js
cp "react-native/local-cli/templates/HelloWorld/index.js" index.js
describe "Running a Flow check on a new RN app"
flow check
describe "Verifying packager can produce JS bundle for a new RN app on both platforms"
node ./node_modules/react-native/local-cli/cli.js bundle --platform ios --dev true --entry-file index.js --bundle-output ios-bundle.js
test -e ios-bundle.js
rm ios-bundle.js
node ./node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --entry-file index.js --bundle-output android-bundle.js
test -e android-bundle.js
rm android-bundle.js
popd >/dev/null
```
Reviewed By: arcanis
Differential Revision: D9129463
fbshipit-source-id: a91eeaa150ae6623ee67bd758bc8a98bb31e57b8
Summary:
Adds a .github.flowconfig.android.
Also, adds the optional _ios and _android to the sites.
Reviewed By: TheSavior
Differential Revision: D9189935
fbshipit-source-id: 5274701b9425525337d5c4684ce4ffee841fef52
Summary: The controller you requested could not be found.
Reviewed By: pakoito
Differential Revision: D9174188
fbshipit-source-id: 4ec9ef5b6f802964a83b6bc0bd29db7f47b37c21
Summary:
Follow up to a9792ac4c8. I assume it's enabled for fb flow config so we can avoid future breakages if someone decide to use this syntax.
Pull Request resolved: https://github.com/facebook/react-native/pull/20516
Differential Revision: D9169244
Pulled By: TheSavior
fbshipit-source-id: 3736d2aed65a0cb4392c175f7d652594cf6a1518
Summary:
There's a couple of Flow errors in open source, following D9081343:
```
yarn run v1.6.0
$ flow check
Error --------------------------------------------------------------------- Libraries/Components/Switch/Switch.js:139:31
Experimental optional chaining (`?.`) usage. Optional chaining is an active early-stage feature proposal that may
change. You may opt in to using it anyway by putting `esproposal.optional_chaining=enable` into the `[options]` section
of your `.flowconfig`.
139| let _trackColorForFalse = trackColor?.false;
^^^^^^^^^^^^^^^^^
Error --------------------------------------------------------------------- Libraries/Components/Switch/Switch.js:140:30
Experimental optional chaining (`?.`) usage. Optional chaining is an active early-stage feature proposal that may
change. You may opt in to using it anyway by putting `esproposal.optional_chaining=enable` into the `[options]` section
of your `.flowconfig`.
140| let _trackColorForTrue = trackColor?.true;
^^^^^^^^^^^^^^^^
```
See https://circleci.com/gh/facebook/react-native/48701
We have a different Flow config for open source, .github.flowconfig, that needs to be updated to ensure Flow passes in oss.
Reviewed By: TheSavior
Differential Revision: D9141134
fbshipit-source-id: 7b546ef4c9a91bdd66472242f38a6fc8bcf86364
Summary: No new errors in this version. Just removed a bunch of unused suppressions
Reviewed By: TheSavior
Differential Revision: D8754160
fbshipit-source-id: 2f02240b6d65edecba5d9ed603c7703462547a7f
Summary:
We enforce this config locally in fbsource, lets ensure our flow strict files are run the same way in the github repo.
@public
Reviewed By: sahrens
Differential Revision: D8530133
fbshipit-source-id: 18528992ad6490826431359d5d8c6acd6710a8ae
Summary:
In this repo we have to require from fbjs/lib/invariant and issues occur when we require directly from invariant/warning. Flow doesn't complain about those requires right now because we have a transitive dependency on invariant and warning causing them to happen to be at the root of node_modules.
This change blacklists requiring directly from invariant and warning using Flow. janicduplessis opened a pull request to do this with ESLint back in 2017: https://github.com/facebook/react-native/pull/13014
Closes https://github.com/facebook/react-native/pull/19634
Reviewed By: hramos
Differential Revision: D8343060
Pulled By: TheSavior
fbshipit-source-id: 9cfc7915b2fb68a567355fc2f5edc4dfcd46f4af
Summary:
This PR removes the need for having the `providesModule` tags in all the modules in the repository.
It configures Flow, Jest and Metro to get the module names from the filenames (`Libraries/Animated/src/nodes/AnimatedInterpolation.js` => `AnimatedInterpolation`)
* Checked the Flow configuration by running flow on the project root (no errors):
```
yarn flow
```
* Checked the Jest configuration by running the tests with a clean cache:
```
yarn jest --clearCache && yarn test
```
* Checked the Metro configuration by starting the server with a clean cache and requesting some bundles:
```
yarn run start --reset-cache
curl 'localhost:8081/IntegrationTests/AccessibilityManagerTest.bundle?platform=android'
curl 'localhost:8081/Libraries/Alert/Alert.bundle?platform=ios'
```
[INTERNAL] [FEATURE] [All] - Removed providesModule from all modules and configured tools.
Closes https://github.com/facebook/react-native/pull/18995
Reviewed By: mjesun
Differential Revision: D7729509
Pulled By: rubennorte
fbshipit-source-id: 892f760a05ce1fddb088ff0cd2e97e521fb8e825
Summary:
Fixes the Flow failure due to an undefined Ast type.
Before:
```
$ npm run flow -- check
> react-native@1000.0.0 flow /Users/hramos/git/react-native
> flow "check"
Error: local-cli/__tests__/fs-mock-test.js:27
27: beforeEach(() => {
^^^^^^^^^^ beforeEach. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:53
53: expect(content).toEqual('beep');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:88
88: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:100
100: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: node_modules/metro/src/Bundler/util.js.flow:46
46: ): Ast {
^^^ Ast. Could not resolve name
Error: node_modules/metro/src/ModuleGraph/worker/collect-dependencies.js.flow:283
283: const xp = (module.exports = (ast: Ast) =>
^^^ Ast. Could not resolve name
Error: node_modules/metro/src/assetTransformer.js.flow:29
29: ): Promise<{ast: Ast}> {
^^^ Ast. Could not resolve name
```
After
```
$ npm run flow -- check
> react-native@1000.0.0 flow /Users/hramos/git/react-native
> flow "check"
Error: local-cli/__tests__/fs-mock-test.js:27
27: beforeEach(() => {
^^^^^^^^^^ beforeEach. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:53
53: expect(content).toEqual('beep');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:88
88: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
Error: local-cli/__tests__/fs-mock-test.js:100
100: expect(content).toEqual('hello, world!');
^^^^^^ expect. Could not resolve name
```
[ GENERAL ] [ BUGFIX] [ .flowconfig ] - Have Flow ignore Metro node_nodules
Closes https://github.com/facebook/react-native/pull/17187
Differential Revision: D6572303
Pulled By: hramos
fbshipit-source-id: aa256b9725970fcc2a6da6578c83e7c0875e3cfd
Summary:
Metro Bundler ships with `react_native_fb` flow annotations whereas our repo is set to ignore `react_native_oss` flow issues.
For now, a hot fix is to make our repo ignore both.
Detailed discussion happens here: 87cfc05ea6 (commitcomment-24884835)
Those changes have been applied to `0.50.0-rc.0` in order to make it green.
Closes https://github.com/facebook/react-native/pull/16310
Differential Revision: D6031378
Pulled By: hramos
fbshipit-source-id: 491d866bb35bd6c30a27dbc04586b15144a8efb2
Summary:
Testing Danger support in CI. Continuation of #14964, which Circle stopped building.
Update your node modules first: `npm install`
`npm run danger pr https://github.com/facebook/react-native/pull/14951`
Verify output. This PR should trigger a WIP warning, as well as a package.json warning:
```
> react-native@1000.0.0 danger /Users/hramos/git/react-native
> node ./node_modules/.bin/danger "pr" "https://github.com/facebook/react-native/pull/14951"
{
fails: [],
warnings: [
{
message: "👷 Work In Progress - <i>Do not merge yet.</i>"
},
{
message: "🔒 Changes were made to package.json - <i>This will require a manual import. Once approved, a Facebook employee should import the PR, then run `yarn add` for any new packages.</i>"
}
],
messages: [],
markdowns: ["This PR requires attention from the facebook/react-native team."]
}
```
`npm run danger pr https://github.com/facebook/react-native/pull/14946`
Verify output. This PR should trigger a warning against the lack of a test plan (note that the PR does have a test plan, but it does not title it as such):
```
{
fails: [],
warnings: [
{
message: "📋 Test Plan - <i>This PR appears to be missing a Test Plan</i>"
}
],
messages: [],
markdowns: []
}
```
`npm run danger pr https://github.com/facebook/react-native/pull/13186`
Should warn against a missing test plan:
```
{
fails: [],
warnings: [
{
message: "📋 Test Plan - <i>This PR appears to be missing a Test Plan.</i>"
}
],
messages: [],
markdowns: ["📄 Thanks for your contribution to the docs!"]
}
```
If the author is able to issue bot commands, we reasonably assume that this is coming from an established core contributor. Their PRs will be flagged for expedited review:
`npm run danger pr https://github.com/facebook/react-native/pull/14895`
```
{
fails: [],
warnings: [
{
message: "📋 Test Plan - <i>This PR appears to be missing a Test Plan.</i>"
}
],
messages: [],
markdowns: ["This PR has been submitted by a core contributor. Notifying facebook/react-native."]
}
```
Closes https://github.com/facebook/react-native/pull/15061
Differential Revision: D5436605
Pulled By: hramos
fbshipit-source-id: 4ba9e812387d8a69893dab537af9b6cd108753cf