mirror of
https://github.com/status-im/re-natal.git
synced 2025-01-11 21:24:07 +00:00
Use plain vanilla React Native reload based development flow for iOS and Android
- Removed REPL based on ambly for now, need to find a good solution for both iOS and Android
This commit is contained in:
parent
720903fda6
commit
f70ae59b55
@ -219,9 +219,7 @@ init = (projName) ->
|
|||||||
exec "cp #{resources}core-ios.cljs #{coreIosPath}"
|
exec "cp #{resources}core-ios.cljs #{coreIosPath}"
|
||||||
edit coreIosPath, [[projNameHyphRx, projNameHyph], [projNameRx, projName]]
|
edit coreIosPath, [[projNameHyphRx, projNameHyph], [projNameRx, projName]]
|
||||||
|
|
||||||
log 'Creating React Native skeleton'
|
log 'Creating React Native skeleton. Relax, this takes a while...'
|
||||||
fs.mkdirSync 'native'
|
|
||||||
process.chdir 'native'
|
|
||||||
|
|
||||||
fs.writeFileSync 'package.json', JSON.stringify
|
fs.writeFileSync 'package.json', JSON.stringify
|
||||||
name: projName
|
name: projName
|
||||||
@ -234,91 +232,19 @@ init = (projName) ->
|
|||||||
, null, 2
|
, null, 2
|
||||||
|
|
||||||
exec 'npm i'
|
exec 'npm i'
|
||||||
|
|
||||||
|
fs.unlinkSync '.gitignore'
|
||||||
exec "
|
exec "
|
||||||
node -e
|
node -e
|
||||||
\"require('react-native/local-cli/cli').init('.', '#{projName}')\"
|
\"require('react-native/local-cli/cli').init('.', '#{projName}')\"
|
||||||
"
|
"
|
||||||
|
|
||||||
fs.unlinkSync 'index.android.js'
|
fs.unlinkSync 'index.android.js'
|
||||||
|
fs.unlinkSync 'index.ios.js'
|
||||||
|
|
||||||
log 'Installing Pod dependencies'
|
log 'Compiling ClojureScript'
|
||||||
process.chdir 'ios'
|
exec 'lein cljsbuild once dev'
|
||||||
exec "cp #{resources}Podfile ."
|
exec 'lein cljsbuild once android'
|
||||||
exec 'pod install'
|
|
||||||
|
|
||||||
log 'Updating Xcode project'
|
|
||||||
for ext in ['m', 'h']
|
|
||||||
path = "#{projName}/AppDelegate.#{ext}"
|
|
||||||
exec "cp #{resources}AppDelegate.#{ext} #{path}"
|
|
||||||
edit path, [[projNameRx, projName], [projNameHyphRx, projNameHyph]]
|
|
||||||
|
|
||||||
uuid1 = crypto
|
|
||||||
.createHash 'md5'
|
|
||||||
.update projName, 'utf8'
|
|
||||||
.digest('hex')[...24]
|
|
||||||
.toUpperCase()
|
|
||||||
|
|
||||||
uuid2 = uuid1.split ''
|
|
||||||
uuid2.splice 7, 1, ((parseInt(uuid1[7], 16) + 1) % 16).toString(16).toUpperCase()
|
|
||||||
uuid2 = uuid2.join ''
|
|
||||||
|
|
||||||
edit \
|
|
||||||
"#{projName}.xcodeproj/project.pbxproj",
|
|
||||||
[
|
|
||||||
[
|
|
||||||
/OTHER_LDFLAGS = "-ObjC";/g
|
|
||||||
'OTHER_LDFLAGS = "${inherited}";'
|
|
||||||
]
|
|
||||||
[
|
|
||||||
/\/\* End PBXBuildFile section \*\//
|
|
||||||
"\t\t#{uuid2} /* out in Resources */ =
|
|
||||||
{isa = PBXBuildFile; fileRef = #{uuid1} /* out */; };
|
|
||||||
\n/* End PBXBuildFile section */"
|
|
||||||
]
|
|
||||||
[
|
|
||||||
/\/\* End PBXFileReference section \*\//
|
|
||||||
"\t\t#{uuid1} /* out */ = {isa = PBXFileReference; lastKnownFileType
|
|
||||||
= folder; name = out; path = ../../target/out;
|
|
||||||
sourceTree = \"<group>\"; };\n/* End PBXFileReference section */"
|
|
||||||
]
|
|
||||||
[
|
|
||||||
/main.jsbundle \*\/\,/
|
|
||||||
"main.jsbundle */,\n\t\t\t\t#{uuid1} /* out */,"
|
|
||||||
]
|
|
||||||
[
|
|
||||||
/\/\* LaunchScreen.xib in Resources \*\/\,/
|
|
||||||
"/* LaunchScreen.xib in Resources */,
|
|
||||||
\n\t\t\t\t#{uuid2} /* out in Resources */,"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
testId = readFile("#{projName}.xcodeproj/project.pbxproj")
|
|
||||||
.match(new RegExp "([0-9A-F]+) \/\\* #{projName}Tests \\*\/ = \\{")[1]
|
|
||||||
|
|
||||||
edit \
|
|
||||||
"#{projName}.xcodeproj/xcshareddata/xcschemes/#{projName}.xcscheme",
|
|
||||||
[
|
|
||||||
[
|
|
||||||
/\<Testables\>\n\s*\<\/Testables\>/
|
|
||||||
"""
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "#{testId}"
|
|
||||||
BuildableName = "#{projName}Tests.xctest"
|
|
||||||
BlueprintName = "#{projName}Tests"
|
|
||||||
ReferencedContainer = "container:#{projName}.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
"""
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
process.chdir '../..'
|
|
||||||
launch generateConfig projName
|
|
||||||
|
|
||||||
log ''
|
log ''
|
||||||
log 'To get started with your new app, first cd into its directory:', 'yellow'
|
log 'To get started with your new app, first cd into its directory:', 'yellow'
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||||
|
|
||||||
|
(def app-registry (.-AppRegistry js/React))
|
||||||
(def text (r/adapt-react-class (.-Text js/React)))
|
(def text (r/adapt-react-class (.-Text js/React)))
|
||||||
(def view (r/adapt-react-class (.-View js/React)))
|
(def view (r/adapt-react-class (.-View js/React)))
|
||||||
(def image (r/adapt-react-class (.-Image js/React)))
|
(def image (r/adapt-react-class (.-Image js/React)))
|
||||||
@ -21,9 +22,7 @@
|
|||||||
[touchable-highlight {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}}
|
[touchable-highlight {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}}
|
||||||
[text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"]]])))
|
[text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"]]])))
|
||||||
|
|
||||||
(r/render [widget] 1)
|
(.registerRunnable app-registry "$PROJECT_NAME$"
|
||||||
|
(fn [params]
|
||||||
(defn ^:export init []
|
(dispatch-sync [:initialize-db])
|
||||||
(dispatch-sync [:initialize-db])
|
(r/render [widget] (.-rootTag params))))
|
||||||
((fn render []
|
|
||||||
(.requestAnimationFrame js/window render))))
|
|
||||||
|
@ -4,16 +4,17 @@
|
|||||||
:license {:name "Eclipse Public License"
|
:license {:name "Eclipse Public License"
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.7.0"]
|
:dependencies [[org.clojure/clojure "1.7.0"]
|
||||||
[org.clojure/clojurescript "1.7.145"]
|
[org.clojure/clojurescript "1.7.170"]
|
||||||
[reagent "0.5.1" :exclusions [cljsjs/react]]
|
[reagent "0.5.1" :exclusions [cljsjs/react]]
|
||||||
[org.omcljs/ambly "0.6.0"]
|
|
||||||
[re-frame "0.5.0"]]
|
[re-frame "0.5.0"]]
|
||||||
:plugins [[lein-cljsbuild "1.1.0"]]
|
:plugins [[lein-cljsbuild "1.1.1"]]
|
||||||
:cljsbuild {:builds {:dev {:source-paths ["src"]
|
:cljsbuild {:builds {:dev {:source-paths ["src"]
|
||||||
:compiler {:output-to "target/out/main.js"
|
:compiler {:output-to "index.ios.js"
|
||||||
|
:main "$PROJECT_NAME_HYPHENATED$.ios.core"
|
||||||
:output-dir "target/out"
|
:output-dir "target/out"
|
||||||
:optimizations :none}}
|
:optimizations :simple}}
|
||||||
:android {:source-paths ["src"]
|
:android {:source-paths ["src"]
|
||||||
:compiler {:output-to "native/index.android.js"
|
:compiler {:output-to "index.android.js"
|
||||||
|
:main "$PROJECT_NAME_HYPHENATED$.android.core"
|
||||||
:output-dir "target/android"
|
:output-dir "target/android"
|
||||||
:optimizations :simple}}}})
|
:optimizations :simple}}}})
|
Loading…
x
Reference in New Issue
Block a user