move patching of RN packager into a separate command 'enable-source-maps'
- patching the packager in 'upgrade' command is a bit too intrusive, this can be done optionally only when source maps are actually needed.
This commit is contained in:
parent
b274e92275
commit
c4113aea85
13
README.md
13
README.md
|
@ -33,7 +33,7 @@ Contributions are welcome.
|
||||||
- Simultaneous development of iOS and Android apps is supported
|
- Simultaneous development of iOS and Android apps is supported
|
||||||
- You can reload app any time, no problem.
|
- You can reload app any time, no problem.
|
||||||
- Custom react-native components are supported (with re-natal use-component <name>)
|
- Custom react-native components are supported (with re-natal use-component <name>)
|
||||||
- Source maps are available when you "Debug in Chrome"
|
- Source maps are available when you "Debug in Chrome" (with re-natal enable-source-maps)
|
||||||
- Optimizations :simple is used to compile "production" index.ios.js and index.android.js
|
- Optimizations :simple is used to compile "production" index.ios.js and index.android.js
|
||||||
- [Unified way of using static images of rn 0.14+](https://facebook.github.io/react-native/docs/images.html) works
|
- [Unified way of using static images of rn 0.14+](https://facebook.github.io/react-native/docs/images.html) works
|
||||||
- Works on Linux and Windows (Android only)
|
- Works on Linux and Windows (Android only)
|
||||||
|
@ -272,13 +272,16 @@ To upgrade React Native to newer version please follow the official
|
||||||
[Upgrading](https://facebook.github.io/react-native/docs/upgrading.html) guide of React Native.
|
[Upgrading](https://facebook.github.io/react-native/docs/upgrading.html) guide of React Native.
|
||||||
Re-Natal makes almost no changes to the files generated by react-native so the official guide should be valid.
|
Re-Natal makes almost no changes to the files generated by react-native so the official guide should be valid.
|
||||||
|
|
||||||
### Changes Re-Natal does to original RN application
|
### Enabling source maps when debugging in chrome
|
||||||
It would be perfect not to do any changes there, but...
|
To make source maps available in "Debug in Chrome" mode re-natal patches
|
||||||
* To make source maps available in "Debug in Chrome" mode re-natal patches
|
|
||||||
the react native packager to serve \*.map files from file system and generate only index.\*.map file.
|
the react native packager to serve \*.map files from file system and generate only index.\*.map file.
|
||||||
To achieve this [this line](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/Server/index.js#L408)
|
To achieve this [this line](https://github.com/facebook/react-native/blob/master/packager/react-packager/src/Server/index.js#L413)
|
||||||
of file "node_modules/react-native/packager/react-packager/src/Server/index.js" is modified to match only index.\*.map
|
of file "node_modules/react-native/packager/react-packager/src/Server/index.js" is modified to match only index.\*.map
|
||||||
|
|
||||||
|
To do this run: `re-natal enable-source-maps` and restart packager.
|
||||||
|
|
||||||
|
You can undo this any time by deleting `node_modules` and running `re-natal deps`
|
||||||
|
|
||||||
## Example Apps
|
## Example Apps
|
||||||
* [Luno](https://github.com/alwx/luno-react-native) is a demo mobile application written in ClojureScript.
|
* [Luno](https://github.com/alwx/luno-react-native) is a demo mobile application written in ClojureScript.
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,7 @@ updateGitIgnore = () ->
|
||||||
fs.appendFileSync(".gitignore", "\n# Figwheel\n#\nfigwheel_server.log")
|
fs.appendFileSync(".gitignore", "\n# Figwheel\n#\nfigwheel_server.log")
|
||||||
|
|
||||||
patchReactNativePackager = () ->
|
patchReactNativePackager = () ->
|
||||||
|
ckDeps.sync {install: true, verbose: false}
|
||||||
log "Patching react-native packager to serve *.map files"
|
log "Patching react-native packager to serve *.map files"
|
||||||
edit "node_modules/react-native/packager/react-packager/src/Server/index.js",
|
edit "node_modules/react-native/packager/react-packager/src/Server/index.js",
|
||||||
[[/match.*\.map\$\/\)/m, "match(/index\\..*\\.map$/)"]]
|
[[/match.*\.map\$\/\)/m, "match(/index\\..*\\.map$/)"]]
|
||||||
|
@ -428,10 +429,6 @@ doUpgrade = (config) ->
|
||||||
projNameHyph = projName.replace(camelRx, '$1-$2').toLowerCase()
|
projNameHyph = projName.replace(camelRx, '$1-$2').toLowerCase()
|
||||||
projNameUs = toUnderscored projName
|
projNameUs = toUnderscored projName
|
||||||
|
|
||||||
ckDeps.sync {install: true, verbose: false}
|
|
||||||
|
|
||||||
patchReactNativePackager()
|
|
||||||
|
|
||||||
copyDevEnvironmentFiles(projNameHyph, projName, "localhost")
|
copyDevEnvironmentFiles(projNameHyph, projName, "localhost")
|
||||||
copyProdEnvironmentFiles(projNameHyph, projName)
|
copyProdEnvironmentFiles(projNameHyph, projName)
|
||||||
log 'upgraded files in env/'
|
log 'upgraded files in env/'
|
||||||
|
@ -517,6 +514,11 @@ cli.command 'use-component <name>'
|
||||||
.action (name) ->
|
.action (name) ->
|
||||||
useComponent(name)
|
useComponent(name)
|
||||||
|
|
||||||
|
cli.command 'enable-source-maps'
|
||||||
|
.description 'patches RN packager to server *.map files from filesystem, so that chrome can download them.'
|
||||||
|
.action () ->
|
||||||
|
patchReactNativePackager()
|
||||||
|
|
||||||
cli.command 'copy-figwheel-bridge'
|
cli.command 'copy-figwheel-bridge'
|
||||||
.description 'copy figwheel-bridge.js into project'
|
.description 'copy figwheel-bridge.js into project'
|
||||||
.action () ->
|
.action () ->
|
||||||
|
|
Loading…
Reference in New Issue