Fix compilation problems
This commit is contained in:
parent
867053651b
commit
6a12a0cf52
|
@ -13,7 +13,8 @@
|
|||
"chalk": "^1.1.1",
|
||||
"coffee-script": "^1.9.3",
|
||||
"commander": "^2.8.1",
|
||||
"semver": "^5.0.1"
|
||||
"semver": "^5.0.1",
|
||||
"react-native": "^0.14.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
|
|
|
@ -20,7 +20,6 @@ validNameRx = /^[A-Z][0-9A-Z]*$/i
|
|||
camelRx = /([a-z])([A-Z])/g
|
||||
projNameRx = /\$PROJECT_NAME\$/g
|
||||
projNameHyphRx = /\$PROJECT_NAME_HYPHENATED\$/g
|
||||
rnVersion = '0.14.2'
|
||||
rnPackagerPort = 8081
|
||||
podMinVersion = '0.38.2'
|
||||
process.title = 're-natal'
|
||||
|
@ -205,8 +204,8 @@ init = (projName, interfaceName) ->
|
|||
corePath = "src/#{projNameUs}/core.clj"
|
||||
fs.unlinkSync corePath
|
||||
|
||||
handlersPath = "src/#{projNameUs}/handlers.clj"
|
||||
subsPath = "src/#{projNameUs}/subs.clj"
|
||||
handlersPath = "src/#{projNameUs}/handlers.cljs"
|
||||
subsPath = "src/#{projNameUs}/subs.cljs"
|
||||
exec "cp #{resources}handlers.cljs #{handlersPath}"
|
||||
exec "cp #{resources}subs.cljs #{subsPath}"
|
||||
|
||||
|
@ -217,12 +216,14 @@ init = (projName, interfaceName) ->
|
|||
exec "echo '(ns cljsjs.react)' > src/cljsjs/react.cljs"
|
||||
|
||||
fs.mkdirSync 'src-android'
|
||||
fs.mkdirSync 'src-ios'
|
||||
fs.mkdirSync "src-android/#{projNameUs}"
|
||||
fs.mkdirSync "src-android/#{projNameUs}/android"
|
||||
fs.mkdirSync "src-android/#{projNameUs}/ios"
|
||||
fs.mkdirSync 'src-ios'
|
||||
fs.mkdirSync "src-ios/#{projNameUs}"
|
||||
fs.mkdirSync "src-ios/#{projNameUs}/ios"
|
||||
|
||||
coreAndroidPath = "src-android/#{projNameUs}/android/core.clj"
|
||||
coreIosPath = "src-ios/#{projNameUs}/ios/core.clj"
|
||||
coreAndroidPath = "src-android/#{projNameUs}/android/core.cljs"
|
||||
coreIosPath = "src-ios/#{projNameUs}/ios/core.cljs"
|
||||
|
||||
exec "cp #{resources}core-android.cljs #{coreAndroidPath}"
|
||||
edit coreAndroidPath, [[projNameHyphRx, projNameHyph], [projNameRx, projName]]
|
||||
|
@ -231,26 +232,12 @@ init = (projName, interfaceName) ->
|
|||
edit coreIosPath, [[projNameHyphRx, projNameHyph], [projNameRx, projName]]
|
||||
|
||||
log 'Creating React Native skeleton'
|
||||
fs.mkdirSync 'native'
|
||||
|
||||
exec "react-native init #{projName}"
|
||||
|
||||
exec "mv #{projName} native"
|
||||
|
||||
process.chdir 'native'
|
||||
|
||||
fs.writeFileSync 'package.json', JSON.stringify
|
||||
name: projName
|
||||
version: '0.0.1'
|
||||
private: true
|
||||
scripts:
|
||||
start: 'node_modules/react-native/packager/packager.sh'
|
||||
dependencies:
|
||||
'react-native': rnVersion
|
||||
, null, 2
|
||||
|
||||
exec 'npm i'
|
||||
exec "
|
||||
node -e
|
||||
\"process.argv[3]='#{projName}';
|
||||
require('react-native/local-cli/init')('.', '#{projName}')\"
|
||||
"
|
||||
|
||||
fs.unlinkSync 'index.android.js'
|
||||
|
||||
log 'Installing Pod dependencies'
|
||||
|
|
|
@ -172,7 +172,7 @@ RCT_EXPORT_MODULE()
|
|||
|
||||
-(void)requireAppNamespaces:(JSContext*)context
|
||||
{
|
||||
[context evaluateScript:[NSString stringWithFormat:@"goog.require('%@');", [self munge:@"$PROJECT_NAME_HYPHENATED$.core"]]];
|
||||
[context evaluateScript:[NSString stringWithFormat:@"goog.require('%@');", [self munge:@"$PROJECT_NAME_HYPHENATED$.ios.core"]]];
|
||||
}
|
||||
|
||||
- (JSValue*)getValue:(NSString*)name inNamespace:(NSString*)namespace fromContext:(JSContext*)context
|
||||
|
@ -225,11 +225,11 @@ RCT_EXPORT_MODULE()
|
|||
JSContext* context = [JSContext contextWithJSGlobalContextRef:self.contextManager.context];
|
||||
[self requireAppNamespaces:context];
|
||||
|
||||
JSValue* initFn = [self getValue:@"init" inNamespace:@"$PROJECT_NAME_HYPHENATED$.core" fromContext:context];
|
||||
JSValue* initFn = [self getValue:@"init" inNamespace:@"$PROJECT_NAME_HYPHENATED$.ios.core" fromContext:context];
|
||||
NSAssert(!initFn.isUndefined, @"Could not find the app init function");
|
||||
[initFn callWithArguments:@[]];
|
||||
|
||||
// Send a nonsense UI event to cause React Native to load our Om UI
|
||||
// Send a nonsense UI event to cause React Native to load our Reagent UI
|
||||
RCTRootView* rootView = (RCTRootView*)self.window.rootViewController.view;
|
||||
[rootView.bridge.modules[@"RCTEventDispatcher"] sendInputEventWithName:@"dummy" body:@{@"target": @1}];
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(ns $PROJECT_NAME_HYPHENATED$.android.core
|
||||
(:require [reagent.core :as r :refer [atom]]
|
||||
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||
[commutewise-app.handlers]
|
||||
[commutewise-app.subs]))
|
||||
[$PROJECT_NAME_HYPHENATED$.handlers]
|
||||
[$PROJECT_NAME_HYPHENATED$.subs]))
|
||||
|
||||
(set! js/React (js/require "react-native"))
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(ns $PROJECT_NAME_HYPHENATED$.ios.core
|
||||
(:require [reagent.core :as r :refer [atom]]
|
||||
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||
[commutewise-app.handlers]
|
||||
[commutewise-app.subs]))
|
||||
[$PROJECT_NAME_HYPHENATED$.handlers]
|
||||
[$PROJECT_NAME_HYPHENATED$.subs]))
|
||||
|
||||
(set! js/React (js/require "react-native"))
|
||||
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))
|
||||
|
||||
(def text (r/adapt-react-class (.-Text js/React)))
|
||||
(def view (r/adapt-react-class (.-View js/React)))
|
||||
|
|
Loading…
Reference in New Issue