@caweb/webpack 1.0.5 → 1.1.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.
Files changed (2) hide show
  1. package/package.json +13 -11
  2. package/webpack.config.js +20 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "1.0.5",
3
+ "version": "1.1.1",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -9,13 +9,15 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "webpack": "webpack",
12
- "serve": "webpack serve --entry-reset --entry ./plugins/html/src/index.js",
12
+ "serve": "set NODE_OPTIONS='--no-selectors' && webpack serve --config ./webpack.config.js ./plugins/html/entry/oceanside.js --merge",
13
13
  "build": "npm run build:html",
14
- "build:html": "webpack build --entry-reset --entry ./plugins/html/src/index.js --output-path ./plugins/html/build/ && renamer --find main --replace index ./plugins/html/build/*.* -s",
14
+ "build:html": "cd ./plugins/html/ && npm run build",
15
15
  "u:deps": "node ./scripts/update-deps.js ./plugins",
16
+ "config:test": "webpack configtest ./webpack.config.js",
16
17
  "test": "echo \\\"Error: run tests from root\\\" && exit 0",
18
+ "i:deps": "npm i @caweb/a11y-webpack-plugin @caweb/css-audit-webpack-plugin @caweb/html-webpack-plugin @caweb/jshint-webpack-plugin",
17
19
  "i:local": "npm i plugins/a11y/ plugins/css-audit/ plugins/html/ plugins/jshint/ ",
18
- "un:local": "npm un plugins/a11y/ plugins/css-audit/ plugins/html/ plugins/jshint/ --force"
20
+ "un:local": "npm un @caweb/a11y-webpack-plugin @caweb/css-audit-webpack-plugin @caweb/html-webpack-plugin @caweb/jshint-webpack-plugin --force"
19
21
  },
20
22
  "repository": {
21
23
  "type": "git",
@@ -36,18 +38,18 @@
36
38
  },
37
39
  "homepage": "https://github.com/CAWebPublishing/webpack#readme",
38
40
  "devDependencies": {
39
- "renamer": "^5.0.1",
40
41
  "rimraf": "^6.0.1",
41
42
  "webpack": "^5.93.0",
42
43
  "webpack-cli": "^5.1.4"
43
44
  },
44
45
  "dependencies": {
45
- "@caweb/a11y-webpack-plugin": "^1.0.2",
46
- "@caweb/css-audit-webpack-plugin": "^1.0.2",
47
- "@caweb/html-webpack-plugin": "^1.0.2",
48
- "@caweb/jshint-webpack-plugin": "^1.0.4",
49
- "@wordpress/scripts": "^28.3.0",
46
+ "@caweb/a11y-webpack-plugin": "^1.0.4",
47
+ "@caweb/css-audit-webpack-plugin": "^1.0.4",
48
+ "@caweb/html-webpack-plugin": "^1.1.1",
49
+ "@caweb/jshint-webpack-plugin": "^1.0.5",
50
+ "@wordpress/scripts": "^28.4.0",
51
+ "handlebars-loader": "^1.7.3",
50
52
  "html-webpack-plugin": "^5.6.0",
51
53
  "html-webpack-skip-assets-plugin": "^1.0.4"
52
54
  }
53
- }
55
+ }
package/webpack.config.js CHANGED
@@ -53,11 +53,11 @@ let webpackConfig = {
53
53
  ...baseConfig,
54
54
  target: 'web',
55
55
  cache: false,
56
- stats: 'errors-warnings',
56
+ stats: 'errors',
57
57
  output: {
58
58
  ...baseConfig.output,
59
59
  clean: true,
60
- publicPath: `/public`
60
+ //publicPath: `/public`
61
61
  },
62
62
  module: {
63
63
  ...baseConfig.module,
@@ -75,10 +75,20 @@ let webpackConfig = {
75
75
  partialResolver: function(partial, callback){
76
76
  // all template partials are loaded from the root sample directory
77
77
  let partialPath = path.join( process.cwd(), 'sample' );
78
+ let partialStructurePath = path.join( partialPath, 'structural' );
78
79
 
79
80
  // template parameter specific partials
80
81
  switch( partial ){
81
- case 'content': // content is served from the /sample/index.html
82
+ // header/footer is served from the /sample/structural/ directory
83
+ case 'footer':
84
+ case 'header':
85
+ partialPath = fs.existsSync(path.join( partialStructurePath, `/${partial}.html` )) ? path.join( partialStructurePath, `/${partial}.html` ) :
86
+ `./structural/${partial}.html`
87
+
88
+ break;
89
+
90
+ // content is served from the /sample/index.html
91
+ case 'content':
82
92
  partialPath = fs.existsSync(path.join( partialPath, '/index.html' )) ? path.join( partialPath, '/index.html' ) :
83
93
  './missing/content.html';
84
94
 
@@ -179,13 +189,15 @@ if( 'serve' === webpackCommand ){
179
189
  },
180
190
  templateParameters: {
181
191
  "title" : path.basename(appPath),
182
- "content": '/sample/index.html'
192
+ "header": '/sample/structural/header.html',
193
+ "content": '/sample/index.html',
194
+ "footer": '/sample/structural/footer.html'
183
195
  },
184
196
  skipAssets: [
185
- '**/*-rtl.css', // we skip the Right-to-Left Styles
186
- '**/css-audit.*', // we skip the CSSAudit Files
187
- '**/a11y.*', // we skip the A11y Files
188
- '**/jshint.*', // we skip the JSHint Files
197
+ /.*-rtl.css/, // we skip the Right-to-Left Styles
198
+ /css-audit.*/, // we skip the CSSAudit Files
199
+ /a11y.*/, // we skip the A11y Files
200
+ /jshint.*/, // we skip the JSHint Files
189
201
  ]
190
202
  }
191
203