Merge branch 'master'
This commit is contained in:
commit
b5a2865bc5
|
@ -40,10 +40,6 @@ interfaceConf =
|
||||||
'reagent':
|
'reagent':
|
||||||
cljsDir: "cljs-reagent"
|
cljsDir: "cljs-reagent"
|
||||||
sources:
|
sources:
|
||||||
ios: ["core.cljs"]
|
|
||||||
android: ["core.cljs"]
|
|
||||||
windows: ["core.cljs"]
|
|
||||||
wpf: ["core.cljs"]
|
|
||||||
common: ["handlers.cljs", "subs.cljs", "db.cljs"]
|
common: ["handlers.cljs", "subs.cljs", "db.cljs"]
|
||||||
other: []
|
other: []
|
||||||
deps: ['[reagent "0.5.1" :exclusions [cljsjs/react]]'
|
deps: ['[reagent "0.5.1" :exclusions [cljsjs/react]]'
|
||||||
|
@ -54,10 +50,6 @@ interfaceConf =
|
||||||
'reagent6':
|
'reagent6':
|
||||||
cljsDir: "cljs-reagent6"
|
cljsDir: "cljs-reagent6"
|
||||||
sources:
|
sources:
|
||||||
ios: ["core.cljs"]
|
|
||||||
android: ["core.cljs"]
|
|
||||||
windows: ["core.cljs"]
|
|
||||||
wpf: ["core.cljs"]
|
|
||||||
common: ["events.cljs", "subs.cljs", "db.cljs"]
|
common: ["events.cljs", "subs.cljs", "db.cljs"]
|
||||||
other: [["reagent_dom.cljs","reagent/dom.cljs"], ["reagent_dom_server.cljs","reagent/dom/server.cljs"]]
|
other: [["reagent_dom.cljs","reagent/dom.cljs"], ["reagent_dom_server.cljs","reagent/dom/server.cljs"]]
|
||||||
deps: ['[reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]'
|
deps: ['[reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]'
|
||||||
|
@ -68,10 +60,6 @@ interfaceConf =
|
||||||
'om-next':
|
'om-next':
|
||||||
cljsDir: "cljs-om-next"
|
cljsDir: "cljs-om-next"
|
||||||
sources:
|
sources:
|
||||||
ios: ["core.cljs"]
|
|
||||||
android: ["core.cljs"]
|
|
||||||
windows: ["core.cljs"]
|
|
||||||
wpf: ["core.cljs"]
|
|
||||||
common: ["state.cljs"]
|
common: ["state.cljs"]
|
||||||
other: [["support.cljs","re_natal/support.cljs"]]
|
other: [["support.cljs","re_natal/support.cljs"]]
|
||||||
deps: ['[org.omcljs/om "1.0.0-alpha48" :exclusions [cljsjs/react cljsjs/react-dom]]']
|
deps: ['[org.omcljs/om "1.0.0-alpha48" :exclusions [cljsjs/react cljsjs/react-dom]]']
|
||||||
|
@ -81,10 +69,6 @@ interfaceConf =
|
||||||
'rum':
|
'rum':
|
||||||
cljsDir: "cljs-rum"
|
cljsDir: "cljs-rum"
|
||||||
sources:
|
sources:
|
||||||
ios: ["core.cljs"]
|
|
||||||
android: ["core.cljs"]
|
|
||||||
windows: ["core.cljs"]
|
|
||||||
wpf: ["core.cljs"]
|
|
||||||
common: []
|
common: []
|
||||||
other: [["sablono_compiler.clj","sablono/compiler.clj"],["support.cljs","re_natal/support.cljs"]]
|
other: [["sablono_compiler.clj","sablono/compiler.clj"],["support.cljs","re_natal/support.cljs"]]
|
||||||
deps: ['[rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom sablono]]']
|
deps: ['[rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom sablono]]']
|
||||||
|
@ -96,7 +80,20 @@ defaultInterface = 'reagent6'
|
||||||
defaultEnvRoots =
|
defaultEnvRoots =
|
||||||
dev: 'env/dev'
|
dev: 'env/dev'
|
||||||
prod: 'env/prod'
|
prod: 'env/prod'
|
||||||
platforms = ['ios', 'android']
|
platformMeta =
|
||||||
|
'ios':
|
||||||
|
name: "iOS"
|
||||||
|
sources: ["core.cljs"]
|
||||||
|
'android':
|
||||||
|
name: "Android"
|
||||||
|
sources: ["core.cljs"]
|
||||||
|
'windows':
|
||||||
|
name: "UWP"
|
||||||
|
sources: ["core.cljs"]
|
||||||
|
'wpf':
|
||||||
|
name: "WPF"
|
||||||
|
sources: ["core.cljs"]
|
||||||
|
platforms = []
|
||||||
|
|
||||||
log = (s, color = 'green') ->
|
log = (s, color = 'green') ->
|
||||||
console.log chalk[color] s
|
console.log chalk[color] s
|
||||||
|
@ -181,9 +178,10 @@ generateConfig = (interfaceName, projName) ->
|
||||||
envRoots: defaultEnvRoots
|
envRoots: defaultEnvRoots
|
||||||
modules: []
|
modules: []
|
||||||
imageDirs: ["images"]
|
imageDirs: ["images"]
|
||||||
|
platforms: {}
|
||||||
|
|
||||||
for platform in platforms
|
for platform in platforms
|
||||||
config["#{platform}Host"] = "localhost"
|
config.platforms[platform] = {"host": "localhost"}
|
||||||
|
|
||||||
writeConfig config
|
writeConfig config
|
||||||
config
|
config
|
||||||
|
@ -200,15 +198,8 @@ writeConfig = (config) ->
|
||||||
message
|
message
|
||||||
|
|
||||||
verifyConfig = (config) ->
|
verifyConfig = (config) ->
|
||||||
upgradeMessage = 're-natal project needs to be upgraded, please run: re-natal upgrade'
|
if !config.platforms? || !config.modules? || !config.imageDirs? || !config.interface? || !config.envRoots?
|
||||||
|
throw new Error 're-natal project needs to be upgraded, please run: re-natal upgrade'
|
||||||
if !config.modules? || !config.imageDirs? || !config.interface? || !config.envRoots?
|
|
||||||
throw new Error upgradeMessage
|
|
||||||
|
|
||||||
for platform in platforms
|
|
||||||
platformHost = "#{platform}Host"
|
|
||||||
if !config[platformHost]?
|
|
||||||
throw new Error upgradeMessage
|
|
||||||
|
|
||||||
config
|
config
|
||||||
|
|
||||||
|
@ -268,7 +259,7 @@ configureDevHostForAndroidDevice = (deviceType) ->
|
||||||
try
|
try
|
||||||
devHost = resolveAndroidDevHost(deviceType)
|
devHost = resolveAndroidDevHost(deviceType)
|
||||||
config = readConfig()
|
config = readConfig()
|
||||||
config.androidHost = devHost
|
config.android.host = devHost
|
||||||
writeConfig(config)
|
writeConfig(config)
|
||||||
log "Please run: re-natal use-figwheel to take effect."
|
log "Please run: re-natal use-figwheel to take effect."
|
||||||
catch {message}
|
catch {message}
|
||||||
|
@ -289,7 +280,7 @@ configureDevHostForIosDevice = (deviceType) ->
|
||||||
try
|
try
|
||||||
devHost = resolveIosDevHost(deviceType)
|
devHost = resolveIosDevHost(deviceType)
|
||||||
config = readConfig()
|
config = readConfig()
|
||||||
config.iosHost = devHost
|
config.ios.host = devHost
|
||||||
writeConfig(config)
|
writeConfig(config)
|
||||||
log "Please run: re-natal use-figwheel to take effect."
|
log "Please run: re-natal use-figwheel to take effect."
|
||||||
catch {message}
|
catch {message}
|
||||||
|
@ -358,7 +349,7 @@ copySrcFiles = (interfaceName, projName, projNameUs, projNameHyph) ->
|
||||||
|
|
||||||
for platform in platforms
|
for platform in platforms
|
||||||
fs.mkdirSync "src/#{projNameUs}/#{platform}"
|
fs.mkdirSync "src/#{projNameUs}/#{platform}"
|
||||||
fileNames = interfaceConf[interfaceName].sources[platform]
|
fileNames = platformMeta[platform].sources
|
||||||
for fileName in fileNames
|
for fileName in fileNames
|
||||||
path = "src/#{projNameUs}/#{platform}/#{fileName}"
|
path = "src/#{projNameUs}/#{platform}/#{fileName}"
|
||||||
fs.copySync("#{resources}/#{cljsDir}/#{fileName}", path)
|
fs.copySync("#{resources}/#{cljsDir}/#{fileName}", path)
|
||||||
|
@ -550,6 +541,7 @@ platformModulesAndImages = (config, platform) ->
|
||||||
generateDevScripts = () ->
|
generateDevScripts = () ->
|
||||||
try
|
try
|
||||||
config = readConfig()
|
config = readConfig()
|
||||||
|
platforms = Object.keys config.platforms
|
||||||
projName = config.name
|
projName = config.name
|
||||||
devEnvRoot = config.envRoots.dev
|
devEnvRoot = config.envRoots.dev
|
||||||
|
|
||||||
|
@ -562,7 +554,7 @@ generateDevScripts = () ->
|
||||||
|
|
||||||
devHost = {}
|
devHost = {}
|
||||||
for platform in platforms
|
for platform in platforms
|
||||||
devHost[platform] = config["#{platform}Host"]
|
devHost[platform] = config.platforms[platform].host
|
||||||
|
|
||||||
for platform in platforms
|
for platform in platforms
|
||||||
moduleMap = generateRequireModulesCode(platformModulesAndImages(config, platform))
|
moduleMap = generateRequireModulesCode(platformModulesAndImages(config, platform))
|
||||||
|
@ -575,7 +567,7 @@ generateDevScripts = () ->
|
||||||
|
|
||||||
updateFigwheelUrls(devEnvRoot, devHost)
|
updateFigwheelUrls(devEnvRoot, devHost)
|
||||||
for platform in platforms
|
for platform in platforms
|
||||||
log "Dev server host for #{platform}: #{devHost[platform]}"
|
log "Dev server host for #{platformMeta[platform].name}: #{devHost[platform]}"
|
||||||
|
|
||||||
catch {message}
|
catch {message}
|
||||||
logErr \
|
logErr \
|
||||||
|
@ -601,10 +593,18 @@ doUpgrade = (config) ->
|
||||||
unless config.envRoots
|
unless config.envRoots
|
||||||
config.envRoots = defaultEnvRoots
|
config.envRoots = defaultEnvRoots
|
||||||
|
|
||||||
for platform in platforms
|
unless config.platforms
|
||||||
platformHost = "#{platform}Host"
|
config.platforms = {}
|
||||||
unless config[platformHost]
|
config.platforms.ios = {"host": "localhost"}
|
||||||
config[platformHost] = "localhost"
|
config.platforms.android = {"host": "localhost"}
|
||||||
|
|
||||||
|
if config.iosHost?
|
||||||
|
config.platforms.ios.host = config.iosHost
|
||||||
|
delete config.iosHost
|
||||||
|
|
||||||
|
if config.androidHost?
|
||||||
|
config.platforms.android.host = config.androidHost
|
||||||
|
delete config.androidHost
|
||||||
|
|
||||||
writeConfig(config)
|
writeConfig(config)
|
||||||
log 'upgraded .re-natal'
|
log 'upgraded .re-natal'
|
||||||
|
@ -623,6 +623,7 @@ doUpgrade = (config) ->
|
||||||
useComponent = (name, platform) ->
|
useComponent = (name, platform) ->
|
||||||
try
|
try
|
||||||
config = readConfig()
|
config = readConfig()
|
||||||
|
platforms = Object.keys config.platforms
|
||||||
if typeof platform isnt 'string'
|
if typeof platform isnt 'string'
|
||||||
config.modules.push name
|
config.modules.push name
|
||||||
log "Component '#{name}' is now configured for figwheel, please re-run 'use-figwheel' command to take effect"
|
log "Component '#{name}' is now configured for figwheel, please re-run 'use-figwheel' command to take effect"
|
||||||
|
@ -656,6 +657,8 @@ cli.command 'init <name>'
|
||||||
'''
|
'''
|
||||||
unless interfaceConf[cmd.interface]
|
unless interfaceConf[cmd.interface]
|
||||||
logErr "Unsupported React interface: #{cmd.interface}, one of [#{interfaceNames}] was expected."
|
logErr "Unsupported React interface: #{cmd.interface}, one of [#{interfaceNames}] was expected."
|
||||||
|
platforms.push 'ios'
|
||||||
|
platforms.push 'android'
|
||||||
if cmd.uwp?
|
if cmd.uwp?
|
||||||
platforms.push 'windows'
|
platforms.push 'windows'
|
||||||
if cmd.wpf?
|
if cmd.wpf?
|
||||||
|
|
Loading…
Reference in New Issue