Skip to content

Commit

Permalink
Only change gitignore if we create a flowconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rricard committed Dec 8, 2016
1 parent be43c83 commit 46829e3
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/react-dev-utils/FlowTypecheckPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ function writeFileIfDoesNotExist(path, data) {
if (err) {
return reject(err);
}
resolve(data);
resolve(true);
});
} else {
resolve(data);
resolve(false);
}
});
});
Expand All @@ -75,7 +75,7 @@ function writeInFileIfNotPresent(path, contentToAssert, contentToAppend) {
if (err) {
return reject(err);
}
resolve(contentToAppend);
resolve(true);
});
} else {
fs.readFile(path, (err, existingContent) => {
Expand All @@ -87,10 +87,10 @@ function writeInFileIfNotPresent(path, contentToAssert, contentToAppend) {
if (err) {
return reject(err);
}
resolve(contentToAppend);
resolve(true);
});
} else {
resolve(contentToAppend);
resolve(false);
}
});
}
Expand Down Expand Up @@ -126,8 +126,11 @@ function initializeFlow(projectPath, flowconfig, otherFlowTypedDefs) {
)) :
true
),
writeFileIfDoesNotExist(flowconfigPath, flowconfig.join('\n')),
writeInFileIfNotPresent(gitignorePath, 'flow-typed', 'flow-typed'),
writeFileIfDoesNotExist(flowconfigPath, flowconfig.join('\n'))
.then(wroteFlowconfig => wroteFlowconfig ?
writeInFileIfNotPresent(gitignorePath, 'flow-typed', 'flow-typed/npm') :
false
),
execOneTime(
flowTypedPath,
['install', '--overwrite', '--flowVersion=' + localVersion],
Expand Down

0 comments on commit 46829e3

Please sign in to comment.