-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into backButtonTestID
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// @ts-check | ||
var path = require('./path'); | ||
var fs = require("fs"); | ||
var {logn, debugn, infon} = require("./log"); | ||
|
||
class PodfileLinker { | ||
constructor() { | ||
this.podfilePath = path.podFile; | ||
} | ||
|
||
link() { | ||
if (this.podfilePath) { | ||
logn("Updating Podfile...") | ||
var podfileContent = fs.readFileSync(this.podfilePath, "utf8"); | ||
|
||
podfileContent = this._removeRNNPodLink(podfileContent); | ||
|
||
fs.writeFileSync(this.podfilePath, podfileContent); | ||
infon("Podfile updated successfully!\n") | ||
} | ||
} | ||
|
||
/** | ||
* Removes the RNN pod added by react-native link script. | ||
*/ | ||
_removeRNNPodLink(contents) { | ||
const rnnPodLink = contents.match(/\s+.*pod 'ReactNativeNavigation'.+react-native-navigation'/) | ||
|
||
if (!rnnPodLink) { | ||
debugn(" RNN Pod has not been added to Podfile") | ||
return contents | ||
} | ||
|
||
debugn(" Removing RNN Pod from Podfile") | ||
return contents.replace(rnnPodLink, "") | ||
} | ||
} | ||
|
||
module.exports = PodfileLinker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// @ts-check | ||
var AppDelegateLinker = require("./appDelegateLinker"); | ||
var PodfileLinker = require('./podfileLinker'); | ||
|
||
module.exports = () => { | ||
console.log("Running iOS postlink script\n"); | ||
new AppDelegateLinker().link(); | ||
new PodfileLinker().link(); | ||
} |