Skip to content

Commit

Permalink
flowconfig adds flow/ folder
Browse files Browse the repository at this point in the history
Summary:This change adds the `flow/` folder to the generated `.flowconfig` in new/upgraded projects. The absence of this folder was causing flow bugs to appear in projects consuming react-native that weren't visible in react-native itself. By including the same definition in consuming projects these errors disappear. Fixes facebook#6428.

**Test plan (required)**

Tested `react-native upgrade` with this change and ensured that the generated `.flowconfig` works and didn't throw flow errors.
Closes facebook#6430

Differential Revision: D3071701

fb-gh-sync-id: f28f4d8f7e63669386766b6f226144adeda32c85
shipit-source-id: f28f4d8f7e63669386766b6f226144adeda32c85
  • Loading branch information
corbt authored and Facebook Github Bot 3 committed Mar 21, 2016
1 parent 61483aa commit 322f210
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion local-cli/generator-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function copyAndReplace(src, dest, replacements) {
} else {
var content = fs.readFileSync(src, 'utf8');
Object.keys(replacements).forEach(function(regex) {
content = content.replace(new RegExp(regex, 'g'), replacements[regex]);
content = content.replace(new RegExp(regex, 'gm'), replacements[regex]);
});
fs.writeFileSync(dest, content);
}
Expand Down
5 changes: 4 additions & 1 deletion local-cli/generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ module.exports = yeoman.generators.NamedBase.extend({
utils.copyAndReplace(
this.templatePath('../../../.flowconfig'),
this.destinationPath('.flowconfig'),
{ 'Libraries\/react-native\/react-native-interface.js' : 'node_modules/react-native/Libraries/react-native/react-native-interface.js' }
{
'Libraries\/react-native\/react-native-interface.js' : 'node_modules/react-native/Libraries/react-native/react-native-interface.js',
'^flow/$' : 'node_modules/react-native/flow\nflow/'
}
);

this.fs.copy(
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"PATENTS",
"README.md",
"jestSupport",
".flowconfig"
".flowconfig",
"flow"
],
"scripts": {
"test": "NODE_ENV=test jest",
Expand Down

0 comments on commit 322f210

Please sign in to comment.