Skip to content
Permalink
Browse files

feat(option): add build option exclude.default.server.files which is …

…a boolean and defaults to false
  • Loading branch information
jyounce committed Nov 9, 2015
1 parent a0ca9b0 commit a7ed1eddb94c984ffb6ce40eb002c74cc478145f
@@ -176,6 +176,7 @@ package.json
# exclude.spa = (boolean) defaults to false = set to true to exclude spa.html from client dist
# exclude.angular.files = (boolean) defaults to false = set to true to exclude the angular files that come with rapid-build from dist (lib and modules)
# exclude.angular.modules = (boolean) defaults to false = set to true to exclude injecting the angular modules that come with rapid-build ['ngResource', 'ngRoute', 'ngSanitize']
# exclude.default.server.files = (boolean) defaults to false = set to true to exclude the server files rapid-build sends to the dist server directory
# exclude.from.cacheBust = (array of strings) = file paths: exclude files from the cache bust
# exclude.from.minFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the scripts.min.js or styles.min.css file
# exclude.from.spaFile[scripts|styles] = (array of strings) = file paths: exclude script or style files from automatically being generated in the spa.html file
@@ -13,8 +13,8 @@ module.exports = (config, options) ->
opt = options.exclude[type][opt]
return defaultVal if isType.null opt
opt
deep3: (opt, type, defaultVal) ->
opt = options.exclude.from[opt][type]
deep3: (base, opt, type, defaultVal) ->
opt = options.exclude[base][opt][type]
return defaultVal if isType.null opt
opt

@@ -24,6 +24,9 @@ module.exports = (config, options) ->
spa: !!options.exclude.spa
angular:
files: get.opt.deep2 'angular', 'files', false
default:
server:
files: get.opt.deep3 'default', 'server', 'files', false
rb:
from:
cacheBust: []
@@ -40,14 +43,14 @@ module.exports = (config, options) ->
from:
cacheBust: get.opt.deep2 'from', 'cacheBust', []
minFile:
scripts: get.opt.deep3 'minFile', 'scripts', []
styles: get.opt.deep3 'minFile', 'styles', []
scripts: get.opt.deep3 'from', 'minFile', 'scripts', []
styles: get.opt.deep3 'from', 'minFile', 'styles', []
spaFile:
scripts: get.opt.deep3 'spaFile', 'scripts', []
styles: get.opt.deep3 'spaFile', 'styles', []
scripts: get.opt.deep3 'from', 'spaFile', 'scripts', []
styles: get.opt.deep3 'from', 'spaFile', 'styles', []
dist:
client: get.opt.deep3 'dist', 'client', []
server: get.opt.deep3 'dist', 'server', []
client: get.opt.deep3 'from', 'dist', 'client', []
server: get.opt.deep3 'from', 'dist', 'server', []

# format options
# ==============
@@ -238,6 +238,16 @@ module.exports = (config) ->
# ============
glob.browserSync = path.join pathHelp.format(config.dist.app.client.dir), lang.all

# exclude rb server files
# =======================
excludeRbServerFiles = ->
return unless config.exclude.default.server.files
scripts = glob.src.rb.server.scripts
for own k1, v1 of scripts
scripts[k1] = []

excludeRbServerFiles()

# add glob to config
# ==================
config.glob = glob
@@ -90,10 +90,12 @@ module.exports = (config, options) ->
excludeOptions = ->
options.exclude = {} unless isType.object options.exclude
options.exclude.angular = {} unless isType.object options.exclude.angular
options.exclude.default = {} unless isType.object options.exclude.default
options.exclude.from = {} unless isType.object options.exclude.from
options.exclude.spa = null unless isType.boolean options.exclude.spa
options.exclude.angular.files = null unless isType.boolean options.exclude.angular.files
options.exclude.angular.modules = null unless isType.boolean options.exclude.angular.modules
options.exclude.default.server = {} unless isType.object options.exclude.default.server
options.exclude.from.cacheBust = null unless isType.array options.exclude.from.cacheBust
options.exclude.from.minFile = {} unless isType.object options.exclude.from.minFile
options.exclude.from.spaFile = {} unless isType.object options.exclude.from.spaFile
@@ -104,6 +106,7 @@ module.exports = (config, options) ->
options.exclude.from.spaFile.styles = null unless isType.array options.exclude.from.spaFile.styles
options.exclude.from.dist.client = null unless isType.array options.exclude.from.dist.client
options.exclude.from.dist.server = null unless isType.array options.exclude.from.dist.server
options.exclude.default.server.files = null unless isType.boolean options.exclude.default.server.files

testOptions = ->
options.test = {} unless isType.object options.test
@@ -10,6 +10,7 @@ module.exports =
promiseHelp = require "#{config.req.helpers}/promise"
return promiseHelp.get() unless config.browser.reload
return promiseHelp.get() unless config.build.server
return promiseHelp.get() if config.exclude.default.server.files
@set()
.setBsConfig config
._initBs() # returns promise
@@ -13,5 +13,6 @@ module.exports = (config) ->
# return
# ======
return promiseHelp.get() unless config.build.server
return promiseHelp.get() if config.exclude.default.server.files
return promiseHelp.get() unless config.browser.open
api.runTask config.ports.server
@@ -1,10 +1,12 @@
module.exports = (config, gulp) ->
q = require 'q'
q = require 'q'
promiseHelp = require "#{config.req.helpers}/promise"

# API
# ===
api =
runTask: ->
return promiseHelp.get() if config.exclude.default.server.files
defer = q.defer()
src = config.templates.config.dest.path
dest = config.dist.rb.server.scripts.dir
@@ -17,6 +17,7 @@ module.exports = (config, gulp) ->
defer = q.defer()

for appOrRb, v of config.node_modules
continue if appOrRb is 'rb' and config.exclude.default.server.files
for module in v.modules
src = config.glob.node_modules[appOrRb].src[module]
dest = v.dist.modules[module]
@@ -1,9 +1,10 @@
# Updates config.ports if a port is in use.
# =========================================
module.exports = (config, gulp, taskOpts={}) ->
q = require 'q'
findPort = require 'find-port'
configHelp = require("#{config.req.helpers}/config") config
q = require 'q'
findPort = require 'find-port'
promiseHelp = require "#{config.req.helpers}/promise"
configHelp = require("#{config.req.helpers}/config") config

# global
# ======
@@ -51,12 +52,16 @@ module.exports = (config, gulp, taskOpts={}) ->

setPorts = (forTestClientPort) -> # synchronously
defer = q.defer()
tasks = [
-> setPort 'server'
-> setPort 'reload'
-> setPort 'reloadUI'
]
tasks = [ -> setPort 'test' ] if forTestClientPort
switch !!forTestClientPort
when true then tasks = [ -> setPort 'test' ]
else
return promiseHelp.get defer unless config.build.server
return promiseHelp.get defer if config.exclude.default.server.files
tasks = [
-> setPort 'server'
-> setPort 'reload'
-> setPort 'reloadUI'
]
tasks.reduce(q.when, q()).done -> defer.resolve()
defer.promise

@@ -7,6 +7,7 @@ module.exports = (config, gulp, taskOpts={}) ->
api =
runTask: (cb, env) ->
return promiseHelp.get() unless config.build.server
return promiseHelp.get() if config.exclude.default.server.files
serverTask = if env is 'dev' then 'nodemon' else 'spawn-server'
gulpSequence(
"#{config.rb.prefix.task}#{serverTask}"
@@ -9,6 +9,7 @@ module.exports = (config) ->
api =
runTask: ->
return promiseHelp.get() unless config.build.server
return promiseHelp.get() if config.exclude.default.server.files
defer = q.defer()
stopServer = require stopServerFile
stopServer().done -> defer.resolve()

0 comments on commit a7ed1ed

Please sign in to comment.
You can’t perform that action at this time.