@caweb/webpack 1.3.0 → 1.3.1

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.
package/changelog.txt CHANGED
@@ -1,3 +1,6 @@
1
+ v1.3.1
2
+ - Updated npm packages
3
+
1
4
  v1.3.0
2
5
  - Webpack configuration has been moved to @caweb/html-webpack-plugin
3
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@caweb/a11y-webpack-plugin": "^1.0.9",
39
39
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
40
- "@caweb/html-webpack-plugin": "^1.5.1",
40
+ "@caweb/html-webpack-plugin": "^1.5.2",
41
41
  "@caweb/jshint-webpack-plugin": "^1.0.9"
42
42
  }
43
43
  }
@@ -1,3 +1,8 @@
1
+ v1.5.2
2
+ - Fixed issue with webpack plugins still being added even when flags are passed
3
+ - Reverted multiple configuration export change back to single config export
4
+ - Reduced font size for footer social icons
5
+
1
6
  v1.5.1
2
7
  - updated npm packages
3
8
  - Changed mobile control structure, navigation and search are now in the mobile overlay
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@caweb/html-webpack-plugin",
9
- "version": "1.5.1",
9
+ "version": "1.5.2",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@caweb/a11y-webpack-plugin": "^1.0.9",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "CAWebPublishing Sample Page and Configurations",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,8 @@
25
25
  "generate-json": "node ./scripts/icon.js",
26
26
  "serve": "webpack serve --config ./webpack.config.js ./entry/oceanside.js ./scripts/webpack.test.js --merge",
27
27
  "serve:quick": "set NODE_OPTIONS='--no-jshint --no-audit --no-a11y' && webpack serve --config ./webpack.config.js ./entry/oceanside.js ./scripts/webpack.test.js --merge",
28
- "test": "echo \"Error: run tests from root\" && exit 0"
28
+ "test": "echo \"Error: run tests from root\" && exit 0",
29
+ "t": "webpack build --config ./webpack.test.js"
29
30
  },
30
31
  "repository": {
31
32
  "type": "git",
@@ -50,10 +50,13 @@ function processArgs( arr ){
50
50
  return tmp
51
51
  }
52
52
 
53
- function getArgVal(flag){
54
- return flags.includes(flag) ? flags[flags.indexOf(flag) + 1] : false;
53
+ function flagExists(flag){
54
+ return flags.includes(flag)
55
55
  }
56
56
 
57
+ function getArgVal(flag){
58
+ return flagExists(flag) ? flags[flags.indexOf(flag) + 1] : false;
59
+ }
57
60
 
58
61
  // Update some of the default WordPress webpack rules.
59
62
  baseConfig.module.rules.forEach((rule, i) => {
@@ -97,12 +100,14 @@ delete baseConfig.devServer;
97
100
  let mode = getArgVal('--mode') ? getArgVal('--mode') : baseConfig.mode;
98
101
 
99
102
  let webpackConfig = {
103
+ ...baseConfig,
100
104
  mode,
101
105
  name: 'uncompressed',
102
106
  target: 'web',
103
107
  cache: false,
104
108
  stats: 'errors',
105
109
  output: {
110
+ ...baseConfig.output,
106
111
  clean: mode === 'production'
107
112
  },
108
113
  performance: {
@@ -110,7 +115,9 @@ let webpackConfig = {
110
115
  maxEntrypointSize: 500000
111
116
  },
112
117
  module:{
118
+ ...baseConfig.module,
113
119
  rules: [
120
+ ...baseConfig.module.rules,
114
121
  /**
115
122
  * Default template loader for html is lodash,
116
123
  * lets switch to handlebars
@@ -230,7 +237,7 @@ if( 'serve' === webpackCommand ){
230
237
  }
231
238
 
232
239
  // Page Template and additional plugins
233
- webpackConfig.plugins = [
240
+ webpackConfig.plugins.push(
234
241
  new CAWebHTMLPlugin({
235
242
  template,
236
243
  templateParameters: {
@@ -246,34 +253,35 @@ if( 'serve' === webpackCommand ){
246
253
  }),
247
254
  new HtmlWebpackSkipAssetsPlugin(),
248
255
  new HtmlWebpackLinkTypePlugin(),
249
- ! getArgVal('--no-jshint') ? new JSHintPlugin() : false,
250
- ! getArgVal('--no-audit') ? new CSSAuditPlugin() : false,
251
- ! getArgVal('--no-a11y') ? new A11yPlugin() : false
252
- ]
256
+ ! flagExists('--no-jshint') ? new JSHintPlugin() : false,
257
+ ! flagExists('--no-audit') ? new CSSAuditPlugin() : false,
258
+ ! flagExists('--no-a11y') ? new A11yPlugin() : false
259
+ )
253
260
  }
254
261
 
255
- export default [
256
- baseConfig,
257
- webpackConfig,
258
- mode === 'production' ?
259
- {
260
- name: 'compressed',
261
- dependencies: ['uncompressed'],
262
- devtool: false,
263
- output: {
264
- filename: '[name].min.js',
265
- chunkFilename: '[name].min.js?v=[chunkhash]',
266
- },
267
- plugins: [
268
- new MiniCSSExtractPlugin( { filename: '[name].min.css' } ),
269
- new RtlCssPlugin( { filename: '[name]-rtl.min.css' } ),
270
- ],
271
- optimization:{
272
- minimize: true,
273
- minimizer: [
274
- `...`,
275
- new CssMinimizerPlugin({test: /\.min\.css$/})
276
- ]
277
- }
278
- } : false
279
- ].filter(Boolean);
262
+ /**
263
+ * Production only
264
+ */
265
+ if( mode === 'production' ){
266
+ // Config
267
+ webpackConfig.name = 'compressed';
268
+ webpackConfig.devtool = false;
269
+
270
+ // Output
271
+ webpackConfig.output.filename = '[name].min.js';
272
+ webpackConfig.output.chunkFilename = '[name].min.js?v=[chunkhash]';
273
+
274
+ // Plugins
275
+ webpackConfig.plugins.push(
276
+ new MiniCSSExtractPlugin( { filename: '[name].min.css' } ),
277
+ new RtlCssPlugin( { filename: '[name]-rtl.min.css' } )
278
+ )
279
+
280
+ // Optimization
281
+ webpackConfig.optimization.minimize = true;
282
+ webpackConfig.optimization.minimizer.push(
283
+ new CssMinimizerPlugin({test: /\.min\.css$/})
284
+ )
285
+ }
286
+
287
+ export default webpackConfig;