@lipemat/js-boilerplate 8.6.1 → 8.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/helpers/config.js +12 -9
  2. package/package.json +1 -1
package/helpers/config.js CHANGED
@@ -53,14 +53,15 @@ function hasLocalOverride( fileName, inWorkingDirectory = false ) {
53
53
  * }
54
54
  * ```
55
55
  *
56
- * @param {string} $fileName
56
+ * @param {string} fileName
57
57
  *
58
58
  * @return {Object}
59
59
  */
60
- function getConfig( $fileName ) {
61
- let config = {...require( '../config/' + $fileName ), ...getExtensionsConfig( $fileName )};
60
+ function getConfig( fileName ) {
61
+ let config = require( '../config/' + fileName );
62
+ config = {...config, ...getExtensionsConfig( fileName, config )};
62
63
  try {
63
- const localConfig = require( path.resolve( packageConfig.packageDirectory + '/config', $fileName ) );
64
+ const localConfig = require( path.resolve( packageConfig.packageDirectory + '/config', fileName ) );
64
65
  if ( 'function' === typeof localConfig ) {
65
66
  config = {...config, ...localConfig( config )};
66
67
  } else {
@@ -75,19 +76,21 @@ function getConfig( $fileName ) {
75
76
  * Get a config from any existing extension's /config directories
76
77
  * merged into one.
77
78
  *
78
- * @see getConfig
79
+ * @param {string} fileName
80
+ * @param {Object} defaultConfig - Default config from this package.
81
+ * Used for passing to an extension callback.
79
82
  *
80
- * @param {string} $fileName
83
+ * @see getConfig
81
84
  *
82
85
  * @return {Object}
83
86
  */
84
- function getExtensionsConfig( $fileName ) {
87
+ function getExtensionsConfig( fileName, defaultConfig ) {
85
88
  let config = {};
86
89
  extensions.forEach( extension => {
87
90
  try {
88
- const extensionConfig = require( extension + '/config/' + $fileName );
91
+ const extensionConfig = require( extension + '/config/' + fileName );
89
92
  if ( 'function' === typeof extensionConfig ) {
90
- config = {...config, ...extensionConfig( config )};
93
+ config = {...config, ...extensionConfig( {...defaultConfig, ...config} )};
91
94
  } else {
92
95
  config = {...config, ...extensionConfig};
93
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "8.6.1",
3
+ "version": "8.6.2",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",