@caweb/webpack 2.0.0 → 2.0.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.
package/lib/args.js CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { parseArgs } from 'node:util';
4
+ // import { parseArgs } from 'node:util';
5
+ import minimist from 'minimist';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -16,62 +17,14 @@ let argv0 = process.argv0.replace(/.*node[.a-z\s]*/, '');
16
17
  // flags can be passed via argv0
17
18
  // we also add args from NODE_OPTIONS
18
19
  // we also add args from CAWEB_NODE_OPTIONS
19
- let { values: flags } = parseArgs( {
20
- args: [
20
+ let flags = minimist( [
21
21
  ...argv,
22
22
  ...argv0.split(' '),
23
23
  ...(process.env.NODE_OPTIONS ? process.env.NODE_OPTIONS.trim().replace(/(^'|'$)/g, '').split(' ') : []).filter( Boolean ),
24
24
  ...(process.env.CAWEB_NODE_OPTIONS ? process.env.CAWEB_NODE_OPTIONS.trim().replace(/(^'|'$)/g, '').split(' ') : []).filter( Boolean )
25
- ].filter( Boolean ),
26
- strict: false,
27
- allowPositionals: true,
28
- allowNegative: true,
29
-
30
- // in order for the flags to work with the cli's params,
31
- // we need to set the options
32
- options: {
33
- template: {
34
- type: 'string',
35
- },
36
- scheme: {
37
- type: 'string',
38
- },
39
- cwd: {
40
- type: 'string',
41
- },
42
- update: {
43
- type: 'boolean',
44
- },
45
- xdebug: {
46
- type: 'string'
47
- },
48
- spx: {
49
- type: 'string'
50
- },
51
- scripts: {
52
- type: 'boolean',
53
- },
54
- sync: {
55
- type: 'boolean',
56
- },
57
- plugin: {
58
- type: 'boolean',
59
- short: 'p'
60
- },
61
- theme: {
62
- type: 'boolean',
63
- short: 't'
64
- },
65
- multisite: {
66
- type: 'boolean',
67
- short: 'm'
68
- },
69
- subdomain: {
70
- type: 'boolean',
71
- }
72
- }
73
- } )
74
-
25
+ ].filter( Boolean )
26
+ )
27
+
75
28
  // function to add a flag
76
29
  function addFlag(flag, value = null){
77
30
  if( ! flagExists(flag) ){
@@ -81,7 +34,7 @@ function addFlag(flag, value = null){
81
34
 
82
35
  // check if a flag exists
83
36
  function flagExists(flag){
84
- // parseArgs removes the leading dashes from flags, so we need to account for that
37
+ // minimist removes the leading dashes from flags, so we need to account for that
85
38
  return Object.keys(flags).includes(flag.replace(/^-+/, ''));
86
39
  }
87
40
 
package/lib/handlebars.js CHANGED
@@ -17,7 +17,9 @@ let templatePartials = {
17
17
  'header': 'semantics/header.html',
18
18
  'mobileControls': 'semantics/mobile-controls.html',
19
19
  'navFooter': 'semantics/nav-footer.html',
20
- 'navHeader': 'semantics/nav-header.html',
20
+ 'navSingle': 'semantics/nav-single.html',
21
+ 'navDropdown': 'semantics/nav-dropdown.html',
22
+ 'navMegaDropdown': 'semantics/nav-mega-dropdown.html',
21
23
  'utilityHeader': 'semantics/utility-header.html',
22
24
  'head': 'semantics/head.html',
23
25
  'alert': 'components/alert/alert.html',
package/lib/loader.js CHANGED
@@ -41,7 +41,9 @@ const partialResolver = ( partial, callback ) => {
41
41
  case 'header':
42
42
  case 'mobileControls':
43
43
  case 'navFooter':
44
- case 'navHeader':
44
+ case 'navSingle':
45
+ case 'navDropdown':
46
+ case 'navMegaDropdown':
45
47
  case 'utilityHeader':
46
48
  case 'head':
47
49
  partialDir = 'semantics';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/webpack",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "CAWebPublishing Webpack Configuration",
5
5
  "main": "webpack.config.js",
6
6
  "files": [
@@ -9,8 +9,6 @@ import path from 'path';
9
9
  import fs from 'fs';
10
10
  import { fileURLToPath } from 'url';
11
11
  import HtmlWebpackPlugin from 'html-webpack-plugin';
12
- import deepmerge from 'deepmerge';
13
- import Handlebars from 'handlebars';
14
12
 
15
13
  /**
16
14
  * Internal Dependencies
@@ -29,10 +27,10 @@ let testCaweb = JSON.parse( fs.readFileSync( path.join(currentPath, 'caweb.json'
29
27
  // we read the app caweb.json file if it exists
30
28
  let defaultCaweb = fs.existsSync( path.join(appPath, 'caweb.json') ) ?
31
29
  JSON.parse(fs.readFileSync(path.join(appPath, 'caweb.json')))
32
- : {};
30
+ : null;
33
31
 
34
32
  // merge the two caweb.json files, with the project data taking precedence
35
- let caweb = deepmerge( testCaweb, defaultCaweb );
33
+ let caweb = defaultCaweb ?? testCaweb;
36
34
 
37
35
  let templatePath = path.join(appPath, 'node_modules', '@caweb', 'template');
38
36
  let template = getArgVal( 'template', path.join(templatePath, 'patterns', 'default.html') );
package/webpack.config.js CHANGED
@@ -82,6 +82,7 @@ if( 'serve' === webpackCommand ){
82
82
 
83
83
  // main webpack configuration object
84
84
  let webpackConfig = {
85
+ entry: path.join( process.cwd(), 'src', 'index.js' ),
85
86
  mode,
86
87
  // target: 'web',
87
88
  name: isProduction ? 'compressed' : 'uncompressed',