-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transition to more explicit module configs
- Loading branch information
1 parent
928522e
commit 377103f
Showing
12 changed files
with
230 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
var lib = require('../../lib') | ||
|
||
|
||
module.exports = function configKnex (vfs, baseConfig, moduleArgs) { | ||
module.exports = { | ||
maxCLIArgs: 0, | ||
pultModuleDeps: [], | ||
pultModuleConflicts: [], | ||
get: function get (vfs, baseConfig, moduleArgs) { | ||
|
||
var serverConfig = lib.clone(baseConfig.server) | ||
var serverConfig = lib.clone(baseConfig.server) | ||
|
||
serverConfig.routerPipeline.unshift('./mount-api.js') | ||
serverConfig.routerPipeline.unshift('./mount-api.js') | ||
|
||
return { server: serverConfig } | ||
return { server: serverConfig } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
var lib = require('../../lib') | ||
|
||
|
||
module.exports = function configCookieSession (vfs, baseConfig, moduleArgs) { | ||
if ( moduleArgs.length >= 2 ) { | ||
throw new lib.errors.ModuleError('Module `cookie-sessions` only takes 1 argument') | ||
} | ||
module.exports = { | ||
maxCLIArgs: 0, | ||
pultModuleDeps: [], | ||
pultModuleConflicts: [], | ||
get: function get (vfs, baseConfig, moduleArgs) { | ||
|
||
var serverConfig = lib.clone(baseConfig.server) | ||
var serverConfig = lib.clone(baseConfig.server) | ||
|
||
serverConfig.routerPipeline.push('./cookie-sessions.js') | ||
serverConfig.routerPipeline.push('./cookie-sessions.js') | ||
|
||
var config = { | ||
dependencies: { | ||
"cookie-session": "*", | ||
}, | ||
server: serverConfig, | ||
} | ||
var config = { | ||
dependencies: { | ||
"cookie-session": "*", | ||
}, | ||
server: serverConfig, | ||
} | ||
|
||
config.installs = Object.keys(config.dependencies) | ||
config.installs = Object.keys(config.dependencies) | ||
|
||
return config | ||
return config | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
var lib = require('../../lib') | ||
|
||
|
||
module.exports = function configKnex (vfs, baseConfig, moduleArgs) { | ||
|
||
if ( ! baseConfig.package.addedPultModules.includes('knex') ) { | ||
throw new lib.errors.MissingDependency('knex') | ||
module.exports = { | ||
maxCLIArgs: 0, | ||
pultModuleDeps: [ 'knex' ], | ||
pultModuleConflicts: [], | ||
get: function get (vfs, baseConfig, moduleArgs) { | ||
return {} | ||
} | ||
|
||
return {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
var lib = require('../../lib') | ||
|
||
|
||
module.exports = function configClient (vfs, baseConfig, moduleArgs) { | ||
if ( moduleArgs.length >= 2 ) { | ||
throw new lib.errors.ModuleError('Module `less` only takes 1 argument') | ||
} | ||
module.exports = { | ||
maxCLIArgs: 0, | ||
pultModuleDeps: [], | ||
pultModuleConflicts: [], | ||
get: function get (vfs, baseConfig, moduleArgs) { | ||
|
||
var serverConfig = lib.clone(baseConfig.server) | ||
var serverConfig = lib.clone(baseConfig.server) | ||
|
||
serverConfig.routerPipeline.unshift('./style-bundles.js') | ||
serverConfig.routerPipeline.unshift('./style-bundles.js') | ||
|
||
|
||
// | ||
// Inject link tag into main html file | ||
// | ||
var isSpa = baseConfig.package.addedPultModules.includes('spa') | ||
var isMarko = baseConfig.package.addedPultModules.includes('marko') | ||
// | ||
// Inject link tag into main html file | ||
// | ||
var isSpa = baseConfig.package.addedPultModules.includes('spa') | ||
var isMarko = baseConfig.package.addedPultModules.includes('marko') | ||
|
||
if ( isSpa || isMarko ) { | ||
var htmlPath = baseConfig.projectRoot + ( | ||
isSpa ? '/client/public/index.html' : '/client/pages/_layouts/main.marko' | ||
) | ||
if ( isSpa || isMarko ) { | ||
var htmlPath = baseConfig.projectRoot + ( | ||
isSpa ? '/client/public/index.html' : '/client/pages/_layouts/main.marko' | ||
) | ||
|
||
var html = vfs.read(htmlPath) | ||
var html = vfs.read(htmlPath) | ||
|
||
var spaces = html.match(/( *)<\/head>/)[1] | ||
var result = html.replace( | ||
'</head>', | ||
` <link rel="stylesheet" type="text/css" href="/app-bundle.css">\n${ spaces }</head>` | ||
) | ||
vfs.write(htmlPath, result) | ||
} | ||
var spaces = html.match(/( *)<\/head>/)[1] | ||
var result = html.replace( | ||
'</head>', | ||
` <link rel="stylesheet" type="text/css" href="/app-bundle.css">\n${ spaces }</head>` | ||
) | ||
vfs.write(htmlPath, result) | ||
} | ||
|
||
|
||
var config = { | ||
dependencies: { | ||
"node-less-endpoint": "0.x", | ||
}, | ||
server: serverConfig, | ||
} | ||
var config = { | ||
dependencies: { | ||
"node-less-endpoint": "0.x", | ||
}, | ||
server: serverConfig, | ||
} | ||
|
||
config.installs = Object.keys(config.dependencies) | ||
config.installs = Object.keys(config.dependencies) | ||
|
||
return config | ||
return config | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,44 @@ | ||
var lib = require('../../lib') | ||
|
||
|
||
module.exports = function configClient (vfs, baseConfig, moduleArgs) { | ||
if ( moduleArgs.length >= 2 ) { | ||
throw new lib.errors.ModuleError('Module `marko` only takes 1 argument') | ||
module.exports = { | ||
maxCLIArgs: 0, | ||
pultModuleDeps: [], | ||
pultModuleConflicts: [ 'spa' ], | ||
get: function get (vfs, baseConfig, moduleArgs) { | ||
|
||
var serverConfig = lib.clone(baseConfig.server) | ||
|
||
serverConfig.routerPipeline.unshift('./marko.js') | ||
|
||
var config = { | ||
package: { | ||
scripts: { | ||
start: "./node_modules/.bin/browser-refresh server/index.js" | ||
} | ||
}, | ||
dependencies: { | ||
"less": "^2.7", | ||
"lasso": "^2.8.3", | ||
"lasso-marko": "^2.1.0", | ||
"lasso-less": "^2.1.0", | ||
"marko": "v4.0.0-rc.3", | ||
"browser-refresh-taglib": "*", | ||
}, | ||
devDependencies: { | ||
"browser-refresh": "^1.7.0", | ||
}, | ||
server: serverConfig, | ||
} | ||
|
||
config.installs = Object.keys(config.dependencies) | ||
|
||
|
||
// git ignore generated files | ||
var gitignorePath = baseConfig.projectRoot + '/.gitignore' | ||
var gitignore = vfs.read(gitignorePath) | ||
vfs.write(gitignorePath, gitignore + '\n*.marko.js\n.cache/\nclient/public/static/\n') | ||
|
||
return config | ||
} | ||
|
||
if ( baseConfig.package.addedPultModules.includes('spa') ) { | ||
throw new lib.errors.ModuleError('Module `marko` is incompatible with the module `spa`') | ||
} | ||
|
||
|
||
var serverConfig = lib.clone(baseConfig.server) | ||
|
||
serverConfig.routerPipeline.unshift('./marko.js') | ||
|
||
var config = { | ||
package: { | ||
scripts: { | ||
start: "./node_modules/.bin/browser-refresh server/index.js" | ||
} | ||
}, | ||
dependencies: { | ||
"less": "^2.7", | ||
"lasso": "^2.8.3", | ||
"lasso-marko": "^2.1.0", | ||
"lasso-less": "^2.1.0", | ||
"marko": "v4.0.0-rc.3", | ||
"browser-refresh-taglib": "*", | ||
}, | ||
devDependencies: { | ||
"browser-refresh": "^1.7.0", | ||
}, | ||
server: serverConfig, | ||
} | ||
|
||
config.installs = Object.keys(config.dependencies) | ||
|
||
|
||
// git ignore generated files | ||
var gitignorePath = baseConfig.projectRoot + '/.gitignore' | ||
var gitignore = vfs.read(gitignorePath) | ||
vfs.write(gitignorePath, gitignore + '\n*.marko.js\n.cache/\nclient/public/static/\n') | ||
|
||
return config | ||
} |
Oops, something went wrong.