add advanced compilation profile
This commit is contained in:
parent
b3f5284041
commit
fabcaab72d
|
@ -30,6 +30,8 @@ devProfilesRx = /#_\(\$DEV_PROFILES\$\)/g
|
|||
devProfilesId = "#_($DEV_PROFILES$)"
|
||||
prodProfilesRx = /#_\(\$PROD_PROFILES\$\)/g
|
||||
prodProfilesId = "#_($PROD_PROFILES$)"
|
||||
advProfilesRx = /#_\(\$ADVANCED_PROFILES\$\)/g
|
||||
advProfilesId = "#_($ADVANCED_PROFILES$)"
|
||||
platformCleanRx = /#_\(\$PLATFORM_CLEAN\$\)/g
|
||||
platformCleanId = "#_($PLATFORM_CLEAN$)"
|
||||
devHostRx = /\$DEV_HOST\$/g
|
||||
|
@ -418,7 +420,17 @@ copyProjectClj = (interfaceName, projNameHyph) ->
|
|||
prodProfiles = platforms.map (platform) -> prodProfileTemplate.replace(platformRx, platform)
|
||||
prodProfiles.push prodProfilesId
|
||||
|
||||
edit 'project.clj', [[projNameHyphRx, projNameHyph], [interfaceDepsRx, deps], [platformCleanRx, cleans.join(' ')], [devProfilesRx, devProfiles.join("\n")], [prodProfilesRx, prodProfiles.join("\n")]]
|
||||
advProfileTemplate = readFile "#{resources}/advanced.profile"
|
||||
advProfiles = platforms.map (platform) -> advProfileTemplate.replace(platformRx, platform)
|
||||
advProfiles.push advProfilesId
|
||||
|
||||
edit 'project.clj', [
|
||||
[projNameHyphRx, projNameHyph],
|
||||
[interfaceDepsRx, deps],
|
||||
[platformCleanRx, cleans.join(' ')],
|
||||
[devProfilesRx, devProfiles.join("\n")],
|
||||
[prodProfilesRx, prodProfiles.join("\n")],
|
||||
[advProfilesRx, advProfiles.join("\n")]]
|
||||
|
||||
updateProjectClj = (platform) ->
|
||||
proj = readFile('project.clj')
|
||||
|
@ -449,7 +461,22 @@ updateProjectClj = (platform) ->
|
|||
log "Manual update of project.clj required: add new build to prod profile:"
|
||||
log "#{prodProfiles.join('\n')}", "red"
|
||||
|
||||
edit 'project.clj', [[platformCleanRx, cleans.join(' ')], [devProfilesRx, devProfiles.join("\n")], [prodProfilesRx, prodProfiles.join("\n")]]
|
||||
advProfileTemplate = readFile "#{resources}/advanced.profile"
|
||||
advProfiles = []
|
||||
advProfiles.push advProfileTemplate.replace(platformRx, platform)
|
||||
advProfiles.push advProfilesId
|
||||
|
||||
if !proj.match(advProfilesRx)
|
||||
log "Manual update of project.clj required: add new build to advanced profile:"
|
||||
log "#{advProfiles.join('\n')}", "red"
|
||||
|
||||
|
||||
edit 'project.clj', [
|
||||
[platformCleanRx, cleans.join(' ')],
|
||||
[devProfilesRx, devProfiles.join("\n")],
|
||||
[prodProfilesRx, prodProfiles.join("\n")],
|
||||
[advProfilesRx, advProfiles.join("\n")]
|
||||
]
|
||||
|
||||
init = (interfaceName, projName) ->
|
||||
if projName.toLowerCase() is 'react' or !projName.match validNameRx
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{:id "$PLATFORM$"
|
||||
:source-paths ["src" "env/prod"]
|
||||
:compiler {:output-to "index.$PLATFORM$.js"
|
||||
:main "env.$PLATFORM$.main"
|
||||
:output-dir "target/$PLATFORM$"
|
||||
:static-fns true
|
||||
:optimize-constants true
|
||||
:optimizations :advanced
|
||||
:closure-defines {"goog.DEBUG" false}}}
|
|
@ -11,7 +11,10 @@
|
|||
:clean-targets ["target/" #_($PLATFORM_CLEAN$)]
|
||||
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
||||
["do" "clean"
|
||||
["with-profile" "prod" "cljsbuild" "once"]]}
|
||||
["with-profile" "prod" "cljsbuild" "once"]]
|
||||
"advanced-build" ^{:doc "Recompile code for production using :advanced compilation."}
|
||||
["do" "clean"
|
||||
["with-profile" "advanced" "cljsbuild" "once"]]}
|
||||
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.10"]
|
||||
[com.cemerick/piggieback "0.2.1"]]
|
||||
:source-paths ["src" "env/dev"]
|
||||
|
@ -19,6 +22,9 @@
|
|||
#_($DEV_PROFILES$)]}
|
||||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
|
||||
:prod {:cljsbuild {:builds [
|
||||
#_($PROD_PROFILES$)]}}})
|
||||
#_($PROD_PROFILES$)]}}
|
||||
:advanced {:dependencies [[react-native-externs "0.0.3"]]
|
||||
:cljsbuild {:builds [
|
||||
#_($ADVANCED_PROFILES$)]}}})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue