commit
e81dbe31f3
|
@ -19,7 +19,7 @@ For more ClojureScript React Native resources visit [cljsrn.org](http://cljsrn.o
|
|||
Contributions are very welcome.
|
||||
|
||||
## Status
|
||||
- Uses [React Native] v0.48.4
|
||||
- Uses [React Native] v0.49.3
|
||||
- Reusable codebase between iOS and Android
|
||||
- Figwheel used for REPL and live coding
|
||||
- Works in iOS (real device and simulator)
|
||||
|
|
|
@ -34,8 +34,8 @@ ipAddressRx = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/i
|
|||
debugHostRx = /host]\s+\?:\s+@".*";/g
|
||||
namespaceRx = /\(ns\s+([A-Za-z0-9.-]+)/g
|
||||
jsRequireRx = /js\/require "(.+)"/g
|
||||
rnVersion = '0.48.4'
|
||||
rnWinVersion = '0.48.0-rc.4'
|
||||
rnVersion = '0.49.3'
|
||||
rnWinVersion = '0.49.0-rc.2'
|
||||
rnPackagerPort = 8081
|
||||
process.title = 're-natal'
|
||||
buildProfiles =
|
||||
|
@ -486,6 +486,37 @@ updateProjectClj = (platform) ->
|
|||
[buildProfiles.advanced.profilesRx, builds.advanced]
|
||||
]
|
||||
|
||||
generateReactNativeProject = (projName) ->
|
||||
exec "node -e \"require('react-native/local-cli/cli').init('.', '#{projName}')\""
|
||||
fs.unlinkSync 'App.js'
|
||||
fs.unlinkSync 'app.json'
|
||||
fs.unlinkSync 'index.js'
|
||||
|
||||
appDelegatePath = "ios/#{projName}/AppDelegate.m"
|
||||
edit appDelegatePath, [[/jsBundleURLForBundleRoot:@"index"/g, "jsBundleURLForBundleRoot:@\"index.ios\""]]
|
||||
|
||||
buildGradlePath = "android/app/build.gradle"
|
||||
edit buildGradlePath, [[/project\.ext\.react\s+=\s+\[\s+.*\s+]/g, ""]]
|
||||
|
||||
mainApplicationPath = "android/app/src/main/java/com/#{projName.toLowerCase()}/MainApplication.java"
|
||||
edit mainApplicationPath, [[/@Override\s+.*getJSMainModuleName.*\s+.*\s+}/g, ""]]
|
||||
|
||||
generateWindowsProject = (projName) ->
|
||||
log 'Creating React Native windows project.'
|
||||
exec "node -e \"require('react-native-windows/local-cli/generate-windows')('.', '#{projName}', '#{projName}')\""
|
||||
fs.unlinkSync 'App.windows.js'
|
||||
|
||||
appReactPagePath = "windows/#{projName}/MainPage.cs"
|
||||
edit appReactPagePath, [[/public.*JavaScriptMainModuleName(.*\s+){4}return\s+"index";(\s+.*){2}/g, ""]]
|
||||
|
||||
generateWpfProject = (projName) ->
|
||||
log 'Creating React Native WPF project.'
|
||||
exec "node -e \"require('react-native-windows/local-cli/generate-wpf')('.', '#{projName}', '#{projName}')\""
|
||||
fs.unlinkSync 'App.windows.js'
|
||||
|
||||
appReactPagePath = "wpf/#{projName}/AppReactPage.cs"
|
||||
edit appReactPagePath, [[/public.*JavaScriptMainModuleName.*;/g, "public override string JavaScriptMainModuleName => \"index.wpf\";"]]
|
||||
|
||||
init = (interfaceName, projName, platforms) ->
|
||||
if projName.toLowerCase() is 'react' or !projName.match validNameRx
|
||||
logErr 'Invalid project name. Use an alphanumeric CamelCase name.'
|
||||
|
@ -544,21 +575,14 @@ init = (interfaceName, projName, platforms) ->
|
|||
installDeps()
|
||||
|
||||
fs.unlinkSync '.gitignore'
|
||||
exec "node -e
|
||||
\"require('react-native/local-cli/cli').init('.', '#{projName}')\"
|
||||
"
|
||||
|
||||
generateReactNativeProject(projName)
|
||||
|
||||
if 'windows' in platforms
|
||||
log 'Creating React Native UWP project.'
|
||||
exec "node -e
|
||||
\"require('react-native-windows/local-cli/generate-windows')('.', '#{projName}', '#{projName}')\"
|
||||
"
|
||||
generateWindowsProject(projName)
|
||||
|
||||
if 'wpf' in platforms
|
||||
log 'Creating React Native WPF project.'
|
||||
exec "node -e
|
||||
\"require('react-native-windows/local-cli/generate-wpf')('.', '#{projName}', '#{projName}')\"
|
||||
"
|
||||
generateWpfProject(projName)
|
||||
|
||||
updateGitIgnore(platforms)
|
||||
|
||||
|
@ -634,16 +658,10 @@ addPlatform = (platform) ->
|
|||
installDeps()
|
||||
|
||||
if platform is 'windows'
|
||||
log 'Creating React Native UWP project.'
|
||||
exec "node -e
|
||||
\"require('react-native-windows/local-cli/generate-windows')('.', '#{projName}', '#{projName}')\"
|
||||
"
|
||||
generateWindowsProject(projName)
|
||||
|
||||
if platform is 'wpf'
|
||||
log 'Creating React Native WPF project.'
|
||||
exec "node -e
|
||||
\"require('react-native-windows/local-cli/generate-wpf')('.', '#{projName}', '#{projName}')\"
|
||||
"
|
||||
generateWpfProject(projName)
|
||||
|
||||
fs.appendFileSync(".gitignore", "\n\nindex.#{platform}.js\n")
|
||||
|
||||
|
@ -967,9 +985,9 @@ cli.command 'require-all'
|
|||
inferComponents()
|
||||
|
||||
cli.command 'enable-source-maps'
|
||||
.description 'patches RN packager to server *.map files from filesystem, so that chrome can download them.'
|
||||
.action () ->
|
||||
patchReactNativePackager()
|
||||
.description 'patches RN packager to server *.map files from filesystem, so that chrome can download them.'
|
||||
.action () ->
|
||||
patchReactNativePackager()
|
||||
|
||||
cli.command 'enable-auto-require'
|
||||
.description 'enables source scanning for automatic required module resolution in use-figwheel command.'
|
||||
|
|
Loading…
Reference in New Issue