@caweb/webpack 1.3.13 → 1.3.14

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caweb/html-webpack-plugin",
3
- "version": "1.5.14",
3
+ "version": "1.5.15",
4
4
  "description": "CAWebPublishing Sample Page and Configurations",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -19,10 +19,17 @@
19
19
  "create-entrypoint": "node ./scripts/create-entrypoints.js",
20
20
  "generate-json": "node ./scripts/icon.js",
21
21
  "update-scripts": "node ./scripts/update-scripts.js",
22
+ "new-scheme": "node ./scripts/schemes.js",
23
+ "remove-scheme": "node ./scripts/schemes.js -r",
22
24
  "test": "echo \"Error: run tests from root\" && exit 0",
23
- "build": "npm run build:compressed && npm run build:uncompressed",
24
- "build:uncompressed": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode development",
25
- "build:compressed": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode production",
25
+ "build": "npm run build:prod && npm run build:dev",
26
+ "build:prod": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode production",
27
+ "build:dev": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode development",
28
+ "build:danny": "npm run build:danny:prod && npm run build:danny:dev",
29
+ "build:danny:prod": "webpack build --config ./webpack.config.js ./entry/danny.js --merge --mode production",
30
+ "build:danny:dev": "webpack build --config ./webpack.config.js ./entry/danny.js --merge --mode development",
31
+ "serve:danny": "set NODE_OPTIONS='--scheme false' && webpack serve --config ./webpack.config.js ./entry/danny.js ./scripts/webpack.test.js --merge",
32
+ "serve:danny:quick": "set NODE_OPTIONS='--no-jshint --no-audit --no-a11y --scheme false' && webpack serve --config ./webpack.config.js ./entry/danny.js ./scripts/webpack.test.js --merge",
26
33
  "build:delta": "npm run build:delta:prod && npm run build:delta:dev",
27
34
  "build:delta:prod": "webpack build --config ./webpack.config.js ./entry/delta.js --merge --mode production",
28
35
  "build:delta:dev": "webpack build --config ./webpack.config.js ./entry/delta.js --merge --mode development",
@@ -104,9 +111,12 @@
104
111
  },
105
112
  "homepage": "https://github.com/CAWebPublishing/webpack/plugins/html#readme",
106
113
  "devDependencies": {
114
+ "@inquirer/prompts": "^7.2.1",
107
115
  "animate.css": "^4.1.1",
108
116
  "bootstrap": "^5.3.3",
109
117
  "bootstrap-forced-colors-css": "^1.0.7",
118
+ "chalk": "^5.4.1",
119
+ "cross-spawn": "^7.0.6",
110
120
  "fast-xml-parser": "^4.5.1",
111
121
  "mini-css-extract-plugin": "^2.9.2",
112
122
  "rtlcss-webpack-plugin": "^4.0.7"
@@ -115,13 +125,13 @@
115
125
  "@caweb/a11y-webpack-plugin": "^1.0.9",
116
126
  "@caweb/css-audit-webpack-plugin": "^1.0.12",
117
127
  "@caweb/jshint-webpack-plugin": "^1.0.9",
118
- "@wordpress/scripts": "^30.7.0",
128
+ "@wordpress/scripts": "^30.8.1",
119
129
  "css-minimizer-webpack-plugin": "^7.0.0",
120
130
  "handlebars-loader": "^1.7.3",
121
131
  "html-webpack-link-type-plugin": "^1.1.1",
122
132
  "html-webpack-plugin": "^5.6.3",
123
133
  "html-webpack-skip-assets-plugin": "^1.0.4",
124
134
  "webpack": "^5.97.1",
125
- "webpack-cli": "^5.1.4"
135
+ "webpack-cli": "^6.0.1"
126
136
  }
127
137
  }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import chalk from 'chalk';
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ import { confirm, input } from '@inquirer/prompts';
8
+ import spawn from 'cross-spawn';
9
+
10
+ const bullet = chalk.yellow('-');
11
+ const info = chalk.cyan('i');
12
+
13
+ const removing = process.argv.includes( '-r' );
14
+
15
+ // if we are removing a colorscheme
16
+ if( removing ){
17
+ console.log("Which colorscheme would you like to remove?");
18
+ }else{
19
+ // if we are creating a new colorscheme
20
+ console.log("Let's create a new Colorscheme!");
21
+ }
22
+
23
+ const scheme = await input(
24
+ {
25
+ message: "Scheme Name:"
26
+ },
27
+ {
28
+ clearPromptOnDone: true
29
+ }
30
+ ).catch(
31
+ () => {
32
+ process.exit(1);
33
+ }
34
+ );
35
+
36
+ // if we are removing a colorscheme
37
+ if( removing ){
38
+ // remove colorscheme file
39
+ fs.unlinkSync ( path.resolve('src', 'styles', 'colorschemes', `${scheme}.scss`) );
40
+ fs.unlinkSync ( path.resolve('entry', `${scheme}.js`) );
41
+
42
+ console.log(`Removed colorscheme ${scheme}`);
43
+ process.exit(0);
44
+ }else{
45
+ console.log("Colorschemes require 4 colors:");
46
+ console.log(info, "Enter color hex values in the format #RRGGBB");
47
+
48
+ // lets get the 4 colors needed.
49
+ const colors = {
50
+ main: await input(
51
+ {
52
+ message: "Main Color:"
53
+ }
54
+ ).catch(
55
+ () => {
56
+ process.exit(1);
57
+ }
58
+ ),
59
+ alt: await input(
60
+ {
61
+ message: "Alternate Color:"
62
+ }
63
+ ).catch(
64
+ () => {
65
+ process.exit(1);
66
+ }
67
+ ),
68
+ highlight: await input(
69
+ {
70
+ message: "Highlight Color:"
71
+ }
72
+ ).catch(
73
+ () => {
74
+ process.exit(1);
75
+ }
76
+ ),
77
+ standout: await input(
78
+ {
79
+ message: "Standout Color:"
80
+ }
81
+ ).catch(
82
+ () => {
83
+ process.exit(1);
84
+ }
85
+ )
86
+ }
87
+
88
+ // write colorscheme file
89
+ fs.writeFileSync(
90
+ path.resolve('src', 'styles', 'colorschemes', `${scheme}.scss`),
91
+ `/* -----------------------------------------
92
+ ${scheme.toUpperCase()}
93
+ ----------------------------------------- */
94
+
95
+ // scss-docs-start color-variables
96
+ $main: ${colors.main} !default;
97
+ $alt: ${colors.alt} !default;
98
+ $highlight: ${colors.highlight} !default;
99
+ $standout: ${colors.standout} !default;
100
+ // scss-docs-end color-variables
101
+
102
+ @import '../';`
103
+ );
104
+
105
+ // update scripts in package.json
106
+ spawn.sync('npm run update-scripts');
107
+
108
+ // update entrypoints.
109
+ spawn.sync('npm run create-entrypoint');
110
+
111
+ // ask if user would like to serve up the new colorscheme
112
+ let answer = await confirm(
113
+ {
114
+ message: 'Would you like to serve up the new colorscheme?',
115
+ default: true
116
+ }
117
+ ).catch(() => {process.exit(1);});
118
+
119
+ if( answer ){
120
+ // serve new colorscheme up
121
+ spawn.sync(`npm run serve:${scheme}`, { stdio: 'inherit' });
122
+ }
123
+ }
@@ -15,10 +15,12 @@ let scripts = {
15
15
  "create-entrypoint": "node ./scripts/create-entrypoints.js",
16
16
  "generate-json": "node ./scripts/icon.js",
17
17
  "update-scripts": "node ./scripts/update-scripts.js",
18
+ "new-scheme": "node ./scripts/schemes.js",
19
+ "remove-scheme": "node ./scripts/schemes.js -r",
18
20
  "test": "echo \"Error: run tests from root\" && exit 0",
19
- "build": "npm run build:compressed && npm run build:uncompressed",
20
- "build:uncompressed": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode development",
21
- "build:compressed": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode production",
21
+ "build": "npm run build:prod && npm run build:dev",
22
+ "build:prod": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode production",
23
+ "build:dev": "webpack build --config ./webpack.config.js ./scripts/create-entrypoints.js --merge --mode development"
22
24
  };
23
25
 
24
26
  // iterate over all colorschemes
@@ -81,6 +81,11 @@ baseConfig.module.rules.forEach((rule, i) => {
81
81
  delete rule.issuer;
82
82
  }
83
83
  break;
84
+ case new RegExp(/\.(sc|sa)ss$/).toString():
85
+ rule.use[rule.use.length-1].options.sassOptions = {
86
+ silenceDeprecations: ['global-builtin', 'import', 'color-functions', 'mixed-decls']
87
+ };
88
+ break;
84
89
  }
85
90
  });
86
91