-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add initial code to support NPM plugin module configuration lookups; … #894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,27 +379,54 @@ export class SeedConfig { | |
]; | ||
|
||
/** | ||
* The BrowserSync configuration of the application. | ||
* The default open behavior is to open the browser. To prevent the browser from opening use the `--b` flag when | ||
* running `npm start` (tested with serve.dev). | ||
* Example: `npm start -- --b` | ||
* @type {any} | ||
*/ | ||
BROWSER_SYNC_CONFIG: any = { | ||
middleware: [require('connect-history-api-fallback')({ index: `${this.APP_BASE}index.html` })], | ||
port: this.PORT, | ||
startPath: this.APP_BASE, | ||
open: argv['b'] ? false : true, | ||
server: { | ||
baseDir: `${this.DIST_DIR}/empty/`, | ||
routes: { | ||
[`${this.APP_BASE}${this.APP_DEST}`]: this.APP_DEST, | ||
[`${this.APP_BASE}node_modules`]: 'node_modules', | ||
[`${this.APP_BASE.replace(/\/$/, '')}`]: this.APP_DEST | ||
* Configurations for NPM module configurations. Add to or override in project.config.ts. | ||
* If you like, use the mergeObject() method to assist with this. | ||
*/ | ||
PLUGIN_CONFIGS: any = { | ||
/** | ||
* The BrowserSync configuration of the application. | ||
* The default open behavior is to open the browser. To prevent the browser from opening use the `--b` flag when | ||
* running `npm start` (tested with serve.dev). | ||
* Example: `npm start -- --b` | ||
* @type {any} | ||
*/ | ||
'browser-sync': { | ||
middleware: [require('connect-history-api-fallback')({ index: `${this.APP_BASE}index.html` })], | ||
port: this.PORT, | ||
startPath: this.APP_BASE, | ||
open: argv['b'] ? false : true, | ||
server: { | ||
baseDir: `${this.DIST_DIR}/empty/`, | ||
routes: { | ||
[`${this.APP_BASE}${this.APP_DEST}`]: this.APP_DEST, | ||
[`${this.APP_BASE}node_modules`]: 'node_modules', | ||
[`${this.APP_BASE.replace(/\/$/, '')}`]: this.APP_DEST | ||
} | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Recursively merge source onto target. | ||
* @param {any} target The target object (to receive values from source) | ||
* @param {any} source The source object (to be merged onto target) | ||
*/ | ||
mergeObject(target: any, source: any) { | ||
const deepExtend = require('deep-extend'); | ||
deepExtend(target, source); | ||
} | ||
|
||
/** | ||
* Locate a plugin configuration object by plugin key. | ||
* @param {any} pluginKey The object key to look up in PLUGIN_CONFIGS. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A parameter documentation would be nice :) like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. And both titles are identical, they should not :-) |
||
getPluginConfig(pluginKey: string): any { | ||
if (this.PLUGIN_CONFIGS[ pluginKey ]) { | ||
return this.PLUGIN_CONFIGS[pluginKey]; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spaces inside |
||
return null; | ||
} | ||
|
||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A parameter documentation would be nice :) like: