@lipemat/js-boilerplate 8.3.1 → 8.4.0

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.
@@ -9,10 +9,7 @@ const presetEnv = {
9
9
  };
10
10
 
11
11
  /**
12
- * If browserslist is not specified, we fallback to WordPress defaults
13
- * except for IE11 which we don't support by default.
14
- *
15
- * @link https://babeljs.io/docs/en/babel-preset-env#targets
12
+ * Use shared browserslist configurations.
16
13
  */
17
14
  if ( getDefaultBrowsersList() ) {
18
15
  presetEnv.targets = getDefaultBrowsersList();
@@ -30,4 +27,3 @@ module.exports = {
30
27
  'react-hot-loader/babel',
31
28
  ],
32
29
  };
33
-
package/helpers/config.js CHANGED
@@ -37,6 +37,22 @@ function hasLocalOverride( fileName, inWorkingDirectory = false ) {
37
37
  * we will merge the contents with our config/babel.config.js in favor of whatever
38
38
  * is specified with the project's file.
39
39
  *
40
+ * If the `module.exports` are a function, the existing configuration will be passed
41
+ * as the only argument. Otherwise, standard `module.exports` are also supported.
42
+ *
43
+ * @example ```ts
44
+ * // standard
45
+ * module.export = {
46
+ * externals: {extra: 'Extra'}
47
+ * }
48
+ * // function
49
+ * module.exports = function( config ) {
50
+ * return {
51
+ * externals: {...config.externals, extra: 'Extra'}
52
+ * }
53
+ * }
54
+ * ```
55
+ *
40
56
  * @param {string} $fileName
41
57
  *
42
58
  * @return {Object}
@@ -45,7 +61,11 @@ function getConfig( $fileName ) {
45
61
  let config = {...require( '../config/' + $fileName ), ...getExtensionsConfig( $fileName )};
46
62
  try {
47
63
  const localConfig = require( path.resolve( packageConfig.packageDirectory + '/config', $fileName ) );
48
- config = {...config, ...localConfig};
64
+ if ( 'function' === typeof localConfig ) {
65
+ config = {...config, ...localConfig( config )};
66
+ } else {
67
+ config = {...config, ...localConfig};
68
+ }
49
69
  } catch ( e ) {
50
70
  }
51
71
  return config;
@@ -55,6 +75,8 @@ function getConfig( $fileName ) {
55
75
  * Get a config from any existing extension's /config directories
56
76
  * merged into one.
57
77
  *
78
+ * @see getConfig
79
+ *
58
80
  * @param {string} $fileName
59
81
  *
60
82
  * @return {Object}
@@ -64,7 +86,11 @@ function getExtensionsConfig( $fileName ) {
64
86
  extensions.forEach( extension => {
65
87
  try {
66
88
  const extensionConfig = require( extension + '/config/' + $fileName );
67
- config = {...config, ...extensionConfig};
89
+ if ( 'function' === typeof extensionConfig ) {
90
+ config = {...config, ...extensionConfig( config )};
91
+ } else {
92
+ config = {...config, ...extensionConfig};
93
+ }
68
94
  } catch ( e ) {
69
95
  }
70
96
  } );
@@ -73,8 +99,8 @@ function getExtensionsConfig( $fileName ) {
73
99
  }
74
100
 
75
101
  /**
76
- * If browserslist is not specified, we fallback to WordPress defaults
77
- * except for IE11 which we don't support by default.
102
+ * If browserslist is not specified, we fall back to WordPress defaults
103
+ * except for > 1% we don't support by default.
78
104
  *
79
105
  * Return false if a browserslist is specified in the current project.
80
106
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "8.3.1",
3
+ "version": "8.4.0",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "engines": {
6
6
  "node": ">=14.17.6"
@@ -67,7 +67,6 @@
67
67
  "postcss-nested": "^4.1.2",
68
68
  "postcss-preset-env": "^6.6.0",
69
69
  "postcss-scss": "^2.0.0",
70
- "prop-types": "^15.7.2",
71
70
  "react": "^17.0.1",
72
71
  "react-dom": "^17.0.1",
73
72
  "react-hot-loader": "^4.8.3",