@caweb/cli 1.4.3 → 1.4.5
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/README.md +2 -206
- package/commands/index.js +9 -2
- package/commands/test.js +0 -3
- package/commands/webpack/webpack.js +59 -26
- package/configs/webpack.config.js +34 -12
- package/lib/cli.js +65 -38
- package/lib/helpers.js +0 -1
- package/lib/webpack/plugins/a11y/aceconfig.js +44 -0
- package/lib/webpack/plugins/a11y/index.js +272 -0
- package/lib/webpack/plugins/a11y/package.json +12 -0
- package/lib/webpack/plugins/css-audit/css-audit.config.cjs +5 -0
- package/lib/webpack/plugins/css-audit/default.config.js +19 -0
- package/lib/webpack/plugins/css-audit/index.js +297 -0
- package/lib/webpack/plugins/css-audit/package.json +12 -0
- package/lib/webpack/plugins/jshint/.jshintrc +31 -0
- package/lib/webpack/plugins/jshint/index.js +286 -0
- package/lib/webpack/plugins/jshint/package-lock.json +22 -0
- package/lib/webpack/plugins/jshint/package.json +15 -0
- package/lib/webpack/plugins/jshint/reporter.cjs +663 -0
- package/package.json +5 -5
- package/assets/logo.ico +0 -0
- package/commands/a11y.js +0 -95
- package/commands/audit.js +0 -135
- package/configs/aceconfig.js +0 -28
- package/configs/css-audit.config.cjs +0 -9
- package/docs/CREDITS.MD +0 -32
- package/docs/ISSUES.MD +0 -7
- package/docs/OVERRIDES.md +0 -53
- package/docs/ROADMAP.MD +0 -20
- package/docs/SYNC.MD +0 -29
- package/docs/tool/index.js +0 -45
- package/gen/parser.js +0 -166
- package/gen/site-generator.js +0 -144
package/README.md
CHANGED
|
@@ -18,209 +18,5 @@
|
|
|
18
18
|
- phpMyAdmin test site started at http://localhost:9090
|
|
19
19
|
- Uses CAWebPublishing [External Project Template Configuration](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/packages-create-block-external-template/) when creating Gutenberg Blocks, see configurations [here](https://github.com/CAWebPublishing/cli/lib/template)
|
|
20
20
|
- Allows for syncing of WordPress instance via Rest API, to maintain ID's please ensure [CAWebPublishing Development Toolbox](https://github.com/CAWebPublishing/caweb-dev/) plugin is installed.
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
<pre>
|
|
24
|
-
path: /var/www/html
|
|
25
|
-
apache_modules:
|
|
26
|
-
- mod_rewrite
|
|
27
|
-
</pre>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Command Reference
|
|
31
|
-
### `caweb start`
|
|
32
|
-
Generates the required wp-env.json, starts the WordPress environment, downloads any CAWebPublishing sources and approved plugins.
|
|
33
|
-
<pre>
|
|
34
|
-
Usage: caweb start [options]
|
|
35
|
-
|
|
36
|
-
Starts two CAWebPublishing WordPress instances
|
|
37
|
-
development on port 8888 (http://localhost:8888) (override with WP_ENV_PORT)
|
|
38
|
-
tests on port 8889 (http://localhost:8889) (override with WP_ENV_TESTS_PORT).
|
|
39
|
-
After first install, use the '--update' flag to download updates to mapped sources and to re-apply CAWeb configuration options.
|
|
40
|
-
|
|
41
|
-
Options:
|
|
42
|
-
--bare True if excluding any downloads from CAWeb, use this if you want to use a local version of the CAWeb Theme, Configurations will still be applied. (default: false)
|
|
43
|
-
-h, --help display help for command
|
|
44
|
-
-m, --multisite True if converting to multisite. (default: false)
|
|
45
|
-
-p, --plugin True if root directory is a plugin. (default: false)
|
|
46
|
-
--scripts Execute any configured lifecycle scripts. (default: true)
|
|
47
|
-
--subdomain If passed, the network will use subdomains, instead of subdirectories. Doesn't work with 'localhost', make sure to set Port to 80. (default: false)
|
|
48
|
-
-t, --theme True if root directory is a theme. (default: false)
|
|
49
|
-
--update Download source updates and apply WordPress configuration. (default: false)
|
|
50
|
-
--xdebug <mode> Enables Xdebug. If not passed, Xdebug is turned off. If no modes are set, uses "debug". You may set multiple Xdebug modes by passing them in a comma-separated list:
|
|
51
|
-
`--xdebug=develop,coverage`. See https://xdebug.org/docs/all_settings#mode for information about Xdebug modes.
|
|
52
|
-
</pre>
|
|
53
|
-
### `caweb stop`
|
|
54
|
-
<pre>
|
|
55
|
-
Usage: caweb stop
|
|
56
|
-
|
|
57
|
-
Stops running WordPress for development and tests and frees the ports.
|
|
58
|
-
|
|
59
|
-
Options:
|
|
60
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
61
|
-
</pre>
|
|
62
|
-
### `caweb clean [environment]`
|
|
63
|
-
<pre>
|
|
64
|
-
Usage: caweb clean [environment]
|
|
65
|
-
|
|
66
|
-
Cleans the WordPress databases.
|
|
67
|
-
|
|
68
|
-
Positionals:
|
|
69
|
-
environment Which environments' databases to clean.
|
|
70
|
-
[string] [choices: "all", "development", "tests"] [default: "tests"]
|
|
71
|
-
|
|
72
|
-
Options:
|
|
73
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
74
|
-
--scripts Execute any configured lifecycle scripts. [boolean] [default: true]
|
|
75
|
-
</pre>
|
|
76
|
-
### `caweb run <container> [command...]`
|
|
77
|
-
<pre>
|
|
78
|
-
Usage: caweb run <container> [command...]
|
|
79
|
-
|
|
80
|
-
Runs an arbitrary command in one of the underlying Docker containers. A double
|
|
81
|
-
dash can be used to pass arguments to the container without parsing them. This
|
|
82
|
-
is necessary if you are using an option that is defined below. You can use
|
|
83
|
-
`bash` to open a shell session and both `composer` and `phpunit` are available
|
|
84
|
-
in all WordPress and CLI containers. WP-CLI is also available in the CLI
|
|
85
|
-
containers.
|
|
86
|
-
|
|
87
|
-
Positionals:
|
|
88
|
-
container The underlying Docker service to run the command on.
|
|
89
|
-
[string] [required] [choices: "mysql", "tests-mysql", "wordpress",
|
|
90
|
-
"tests-wordpress", "cli", "tests-cli"]
|
|
91
|
-
command The command to run. [array] [default: []]
|
|
92
|
-
|
|
93
|
-
Options:
|
|
94
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
95
|
-
--env-cwd The command's working directory inside of the container. Paths
|
|
96
|
-
without a leading slash are relative to the WordPress root.
|
|
97
|
-
[string] [default: "."]
|
|
98
|
-
</pre>
|
|
99
|
-
### `caweb destroy`
|
|
100
|
-
<pre>
|
|
101
|
-
Usage: caweb destroy
|
|
102
|
-
|
|
103
|
-
Destroy the WordPress environment. Deletes docker containers, volumes, and
|
|
104
|
-
networks associated with the WordPress environment and removes local files.
|
|
105
|
-
|
|
106
|
-
Options:
|
|
107
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
108
|
-
--scripts Execute any configured lifecycle scripts. [boolean] [default: true]
|
|
109
|
-
</pre>
|
|
110
|
-
### `caweb logs [environment]`
|
|
111
|
-
<pre>
|
|
112
|
-
Usage: caweb logs [environment]
|
|
113
|
-
|
|
114
|
-
displays PHP and Docker logs for given WordPress environment.
|
|
115
|
-
|
|
116
|
-
Positionals:
|
|
117
|
-
environment Which environment to display the logs from.
|
|
118
|
-
[string] [choices: "development", "tests", "all"] [default: "development"]
|
|
119
|
-
|
|
120
|
-
Options:
|
|
121
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
122
|
-
--watch Watch for logs as they happen. [boolean] [default: true]
|
|
123
|
-
</pre>
|
|
124
|
-
### `caweb install-path`
|
|
125
|
-
<pre>
|
|
126
|
-
Usage: caweb install-path
|
|
127
|
-
|
|
128
|
-
Get the path where all of the environment files are stored. This includes the
|
|
129
|
-
Docker files, WordPress, PHPUnit files, and any sources that were downloaded.
|
|
130
|
-
|
|
131
|
-
Options:
|
|
132
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
133
|
-
</pre>
|
|
134
|
-
### `caweb shell [environment]`
|
|
135
|
-
<pre>
|
|
136
|
-
Usage: caweb shell [environment]
|
|
137
|
-
|
|
138
|
-
Open shell terminal in WordPress environment.
|
|
139
|
-
|
|
140
|
-
Positionals:
|
|
141
|
-
environment Which environment to open terminal in.
|
|
142
|
-
[string] [choices: "development", "tests"] [default: "development"]
|
|
143
|
-
|
|
144
|
-
Options:
|
|
145
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
146
|
-
</pre>
|
|
147
|
-
### `caweb update-plugins [environment]`
|
|
148
|
-
<pre>
|
|
149
|
-
Usage: caweb update-plugins [environment]
|
|
150
|
-
|
|
151
|
-
Updates all plugins in the WordPress environment.
|
|
152
|
-
|
|
153
|
-
Positionals:
|
|
154
|
-
environment Which environment to update.
|
|
155
|
-
[string] [choices: "development", "tests"] [default: "development"]
|
|
156
|
-
|
|
157
|
-
Options:
|
|
158
|
-
--debug Enable debug output. [boolean] [default: false]
|
|
159
|
-
</pre>
|
|
160
|
-
|
|
161
|
-
### `caweb create-block [options] <slug>`
|
|
162
|
-
<pre>
|
|
163
|
-
Usage: caweb create-block [options] <slug>
|
|
164
|
-
|
|
165
|
-
Scaffold for WordPress plugin to register CA.gov Design System Block.
|
|
166
|
-
|
|
167
|
-
Arguments:
|
|
168
|
-
slug Plugin slug to use.
|
|
169
|
-
|
|
170
|
-
Options:
|
|
171
|
-
-h, --help display help for command
|
|
172
|
-
</pre>
|
|
173
|
-
### `caweb update-block [options] <slug>`
|
|
174
|
-
<pre>
|
|
175
|
-
Usage: caweb update-block [options] <slug>
|
|
176
|
-
|
|
177
|
-
Updates a CA.gov Design System Block.
|
|
178
|
-
|
|
179
|
-
Arguments:
|
|
180
|
-
slug Plugin slug to update.
|
|
181
|
-
|
|
182
|
-
Options:
|
|
183
|
-
-h, --help display help for command
|
|
184
|
-
</pre>
|
|
185
|
-
### `caweb sync <from> <to>`
|
|
186
|
-
In order for the sync process to work correctly, you must have a caweb.json file in the project root directory. For more information read [caweb.json](./docs/SYNC.MD) configuration.
|
|
187
|
-
<pre>
|
|
188
|
-
Usage: caweb sync <from> <to>
|
|
189
|
-
|
|
190
|
-
Sync changes from one destination to another.
|
|
191
|
-
|
|
192
|
-
Arguments:
|
|
193
|
-
from Target Site URL with current changes.
|
|
194
|
-
to Destination Site URL that should be synced.
|
|
195
|
-
|
|
196
|
-
Options:
|
|
197
|
-
-h, --help display help for command
|
|
198
|
-
-i, --include [include...] IDs to of taxonomies to include. Omitting this option will sync all items for given taxonomy.
|
|
199
|
-
-t, --tax [tax...] Taxonomy that should be synced. Omitting this option will sync the full site. (choices: "pages", "posts", "media", "menus")
|
|
200
|
-
</pre>
|
|
201
|
-
### `caweb a11y <url>`
|
|
202
|
-
Runs accessibility checks.
|
|
203
|
-
<pre>
|
|
204
|
-
Usage: caweb a11y url
|
|
205
|
-
|
|
206
|
-
Runs accessibility checks.
|
|
207
|
-
|
|
208
|
-
Arguments:
|
|
209
|
-
url URL or local file to scan for accessibility checks.
|
|
210
|
-
|
|
211
|
-
Options:
|
|
212
|
-
-h, --help display help for command
|
|
213
|
-
</pre>
|
|
214
|
-
### `caweb a11y <url>`
|
|
215
|
-
Runs WordPress CSS Audit tool against projects.
|
|
216
|
-
<pre>
|
|
217
|
-
Usage: caweb audit [options] [files...]
|
|
218
|
-
|
|
219
|
-
Runs WordPress CSS Audit tool against projects.
|
|
220
|
-
|
|
221
|
-
Arguments:
|
|
222
|
-
files Files or directory path to CSS files. (default: "build")
|
|
223
|
-
|
|
224
|
-
Options:
|
|
225
|
-
-h, --help display help for command
|
|
226
|
-
</pre>
|
|
21
|
+
- Allows for generation of WordPress CSS Audits
|
|
22
|
+
- Allows for IBM Accessibility Scan reports.
|
package/commands/index.js
CHANGED
|
@@ -14,9 +14,15 @@ import installPath from '@wordpress/env/lib/commands/install-path.js';
|
|
|
14
14
|
*/
|
|
15
15
|
import webpack from './webpack/webpack.js';
|
|
16
16
|
|
|
17
|
-
import a11y from './a11y.js';
|
|
18
17
|
|
|
19
|
-
import
|
|
18
|
+
import A11yPlugin from '../lib/webpack/plugins/a11y/index.js';
|
|
19
|
+
const a11y = new A11yPlugin().a11yCheck;
|
|
20
|
+
|
|
21
|
+
import CSSAuditPlugin from '../lib/webpack/plugins/css-audit/index.js';
|
|
22
|
+
const audit = new CSSAuditPlugin({}).audit;
|
|
23
|
+
|
|
24
|
+
import JSHintPlugin from '../lib/webpack/plugins/jshint/index.js';
|
|
25
|
+
const hint = new JSHintPlugin().hint;
|
|
20
26
|
|
|
21
27
|
import shell from './tasks/shell.js';
|
|
22
28
|
|
|
@@ -46,6 +52,7 @@ export {
|
|
|
46
52
|
webpack,
|
|
47
53
|
a11y,
|
|
48
54
|
audit,
|
|
55
|
+
hint,
|
|
49
56
|
sync,
|
|
50
57
|
updatePlugins,
|
|
51
58
|
shell,
|
package/commands/test.js
CHANGED
|
@@ -12,9 +12,6 @@ import os from 'os';
|
|
|
12
12
|
*/
|
|
13
13
|
import { runCLICmds, runCmd, projectPath } from '../lib/index.js';
|
|
14
14
|
import { CAWEB_OPTIONS, DIVI_OPTIONS } from '../lib/wordpress/index.js';
|
|
15
|
-
/*
|
|
16
|
-
import generateOverridesMD from '../admin.js';
|
|
17
|
-
*/
|
|
18
15
|
/**
|
|
19
16
|
* Promisified dependencies
|
|
20
17
|
*/
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* External dependencies
|
|
5
5
|
*/
|
|
6
6
|
import path from 'path';
|
|
7
|
-
import fs from 'fs';
|
|
7
|
+
import fs, { watch } from 'fs';
|
|
8
8
|
import deepmerge from 'deepmerge';
|
|
9
|
+
import Webpack from 'webpack';
|
|
10
|
+
import webpackServer from 'webpack-dev-server';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Internal dependencies
|
|
@@ -13,28 +15,27 @@ import deepmerge from 'deepmerge';
|
|
|
13
15
|
import {
|
|
14
16
|
runCmd,
|
|
15
17
|
projectPath,
|
|
16
|
-
appPath
|
|
18
|
+
appPath,
|
|
19
|
+
wpPrimary,
|
|
20
|
+
wpGreen,
|
|
21
|
+
wpRed
|
|
17
22
|
} from '../../lib/index.js';
|
|
18
23
|
|
|
19
|
-
import {default as auditor} from '../audit.js';
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Build the current project
|
|
23
27
|
*
|
|
24
28
|
* @param {Object} options
|
|
25
|
-
* @param {Object} options.spinner A CLI spinner which indicates progress.
|
|
26
29
|
* @param {boolean} options.debug True if debug mode is enabled.
|
|
27
30
|
* @param {boolean} options.audit Add CSS-Audit Page to pages served.
|
|
28
31
|
*/
|
|
29
32
|
export default async function webpack({
|
|
30
|
-
|
|
33
|
+
spinner,
|
|
31
34
|
debug,
|
|
32
|
-
audit
|
|
35
|
+
audit,
|
|
36
|
+
a11y,
|
|
37
|
+
selectors
|
|
33
38
|
} ) {
|
|
34
|
-
|
|
35
|
-
spinner.stop();
|
|
36
|
-
console.log( `Building ${path.basename(appPath)} project...` );
|
|
37
|
-
|
|
38
39
|
const webpackCommand = 'build' === process.argv[2] ? 'build' : 'serve' ;
|
|
39
40
|
|
|
40
41
|
const defaultConfigPath = path.join( projectPath, 'configs', 'webpack.config.js' );
|
|
@@ -61,7 +62,7 @@ export default async function webpack({
|
|
|
61
62
|
'--merge'
|
|
62
63
|
)
|
|
63
64
|
|
|
64
|
-
customConfig = await import('file://' + path.join(appPath, 'webpack.config.cjs' ));
|
|
65
|
+
customConfig = await import('file://' + path.join(appPath, 'webpack.config.cjs' )).default;
|
|
65
66
|
|
|
66
67
|
// ESM
|
|
67
68
|
}else if( fs.existsSync(path.join(appPath, 'webpack.config.js' )) ){
|
|
@@ -77,16 +78,18 @@ export default async function webpack({
|
|
|
77
78
|
if( customConfig.length ){
|
|
78
79
|
webpackConfig = deepmerge(webpackConfig.default, customConfig.default);
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
|
|
81
82
|
// we always run the build command.
|
|
82
83
|
let result = await runCmd(
|
|
83
84
|
'webpack',
|
|
84
|
-
['build', ...webPackArgs]
|
|
85
|
+
['build', ...webPackArgs],
|
|
86
|
+
{stdio:'pipe'}
|
|
85
87
|
).then(({stdout, stderr}) => {
|
|
86
88
|
// we hide the punycode deprecation warning.
|
|
89
|
+
// this is caused by the wp-scripts package
|
|
87
90
|
// if an error was thrown
|
|
88
91
|
if( stderr ){
|
|
89
|
-
console.log( stderr.toString().replace(/.*`punycode`.*\n.*/, '') )
|
|
92
|
+
//console.log( stderr.toString().replace(/.*`punycode`.*\n.*/, '') )
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
if(stdout){
|
|
@@ -97,21 +100,46 @@ export default async function webpack({
|
|
|
97
100
|
|
|
98
101
|
// if serving.
|
|
99
102
|
if( 'serve' === webpackCommand ){
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
+
let hostUrl = 'localhost' === webpackConfig.default.devServer.host ? `http://${webpackConfig.default.devServer.host}`: webpackConfig.default.devServer.host;
|
|
104
|
+
let hostPort = webpackConfig.default.devServer.port;
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
if( hostPort && 80 !== hostPort )
|
|
107
|
+
{
|
|
108
|
+
hostUrl = `${hostUrl}:${hostPort}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
console.log( `Webpack Server is preparing to launch ${ wpGreen(hostUrl) }` );
|
|
112
|
+
console.log( `Press ${ wpRed('Ctrl + C') } to shutdown the server.\n` );
|
|
113
|
+
|
|
114
|
+
// add a11y plugin
|
|
115
|
+
if( a11y ){
|
|
116
|
+
/*webpackConfig.default.plugins.push(new A11yPlugin({
|
|
117
|
+
outputFilename: 'a11y'
|
|
118
|
+
}) )
|
|
119
|
+
|
|
120
|
+
webpackConfig.default.devServer.static.push({
|
|
121
|
+
directory: path.join(appPath, 'a11y')
|
|
122
|
+
})*/
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// add css-auditor plugin
|
|
126
|
+
if( audit ){
|
|
107
127
|
}
|
|
128
|
+
|
|
129
|
+
const compiler = Webpack(webpackConfig.default);
|
|
130
|
+
const server = new webpackServer({...webpackConfig.default.devServer}, compiler);
|
|
131
|
+
|
|
132
|
+
await server.start();
|
|
108
133
|
|
|
109
|
-
|
|
134
|
+
//process.stdin.resume();
|
|
110
135
|
|
|
111
136
|
// run webpack serve command
|
|
112
|
-
await runCmd(
|
|
137
|
+
/*await runCmd(
|
|
113
138
|
'webpack',
|
|
114
|
-
['serve', ...webPackArgs]
|
|
139
|
+
['serve', ...webPackArgs],
|
|
140
|
+
{
|
|
141
|
+
stdio: 'inherit'
|
|
142
|
+
}
|
|
115
143
|
).then(({stdout, stderr}) => {
|
|
116
144
|
// if an error was thrown, and no output
|
|
117
145
|
if( stderr && ! stdout){
|
|
@@ -122,12 +150,17 @@ export default async function webpack({
|
|
|
122
150
|
spinner.text = "Webpack Server was closed.";
|
|
123
151
|
}
|
|
124
152
|
|
|
125
|
-
})
|
|
153
|
+
});*/
|
|
126
154
|
|
|
155
|
+
/*
|
|
156
|
+
const compiler = Webpack(webpackConfig.default);
|
|
157
|
+
const server = new webpackServer({...webpackConfig.default.devServer}, compiler);
|
|
158
|
+
*/
|
|
159
|
+
|
|
127
160
|
// only build was ran.
|
|
128
161
|
}else{
|
|
129
|
-
spinner.prefixText = result;
|
|
130
|
-
spinner.text = "Done!";
|
|
162
|
+
//spinner.prefixText = result;
|
|
163
|
+
//spinner.text = "Done!";
|
|
131
164
|
}
|
|
132
165
|
|
|
133
166
|
};
|
|
@@ -15,7 +15,9 @@ import fs from 'fs';
|
|
|
15
15
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
16
16
|
import {HtmlWebpackSkipAssetsPlugin} from 'html-webpack-skip-assets-plugin';
|
|
17
17
|
|
|
18
|
-
import
|
|
18
|
+
import CSSAuditPlugin from '../lib/webpack/plugins/css-audit/index.js';
|
|
19
|
+
import A11yPlugin from '../lib/webpack/plugins/a11y/index.js';
|
|
20
|
+
import JSHintPlugin from '../lib/webpack/plugins/jshint/index.js';
|
|
19
21
|
|
|
20
22
|
/**
|
|
21
23
|
* Internal dependencies
|
|
@@ -25,11 +27,11 @@ import {
|
|
|
25
27
|
appPath
|
|
26
28
|
} from '../lib/index.js';
|
|
27
29
|
|
|
30
|
+
|
|
28
31
|
const samplePath = path.join( appPath, 'sample');
|
|
29
32
|
const srcPath = path.join( appPath, 'src');
|
|
30
33
|
const dataPath = path.join( srcPath, 'data');
|
|
31
34
|
|
|
32
|
-
import SiteGenerator from '../gen/site-generator.js';
|
|
33
35
|
|
|
34
36
|
// Update some of the default WordPress webpack rules.
|
|
35
37
|
baseConfig.module.rules.forEach((rule, i) => {
|
|
@@ -38,17 +40,17 @@ baseConfig.module.rules.forEach((rule, i) => {
|
|
|
38
40
|
switch(r){
|
|
39
41
|
// WordPress adds a hash to asset file names we remove that hash.
|
|
40
42
|
case new RegExp(/\.(bmp|png|jpe?g|gif|webp)$/i).toString():
|
|
41
|
-
rule.generator.filename = 'images/[name]
|
|
43
|
+
rule.generator.filename = 'images/[name][ext]';
|
|
42
44
|
break;
|
|
43
45
|
case new RegExp(/\.(woff|woff2|eot|ttf|otf)$/i).toString():
|
|
44
|
-
rule.generator.filename = 'fonts/[name]
|
|
46
|
+
rule.generator.filename = 'fonts/[name][ext]';
|
|
45
47
|
break;
|
|
46
48
|
case new RegExp(/\.svg$/).toString():
|
|
47
49
|
// we don't want SVG to be asset/inline otherwise the resource may not be available.
|
|
48
50
|
// the asset should be an asset/resource we move them to the fonts folder.
|
|
49
51
|
if( 'asset/inline' === rule.type ){
|
|
50
52
|
rule.type = 'asset/resource';
|
|
51
|
-
rule.generator = { filename: 'fonts/[name]
|
|
53
|
+
rule.generator = { filename: 'fonts/[name][ext]' };
|
|
52
54
|
|
|
53
55
|
delete rule.issuer;
|
|
54
56
|
}
|
|
@@ -63,7 +65,7 @@ let webpackConfig = {
|
|
|
63
65
|
cache: false,
|
|
64
66
|
output: {
|
|
65
67
|
...baseConfig.output,
|
|
66
|
-
publicPath:
|
|
68
|
+
publicPath: `/public`,
|
|
67
69
|
clean: true
|
|
68
70
|
},
|
|
69
71
|
performance: {
|
|
@@ -102,7 +104,12 @@ if( 'serve' === process.argv[2] ){
|
|
|
102
104
|
templateParameters: {
|
|
103
105
|
"title" : path.basename(appPath)
|
|
104
106
|
},
|
|
105
|
-
skipAssets: [
|
|
107
|
+
skipAssets: [
|
|
108
|
+
'**/index-rtl.css', // we skip the Right-to-Left Styles
|
|
109
|
+
'**/css-audit.*', // we skip the CSSAudit Files
|
|
110
|
+
'**/a11y.*', // we skip the A11y Files
|
|
111
|
+
'**/jshint.*', // we skip the JSHint Files
|
|
112
|
+
]
|
|
106
113
|
}
|
|
107
114
|
|
|
108
115
|
// if an favicon exists.
|
|
@@ -119,7 +126,23 @@ if( 'serve' === process.argv[2] ){
|
|
|
119
126
|
|
|
120
127
|
webpackConfig.plugins.push(
|
|
121
128
|
new HtmlWebpackPlugin(sample),
|
|
122
|
-
new HtmlWebpackSkipAssetsPlugin()
|
|
129
|
+
new HtmlWebpackSkipAssetsPlugin(),
|
|
130
|
+
new JSHintPlugin(),
|
|
131
|
+
new A11yPlugin(),
|
|
132
|
+
new CSSAuditPlugin({
|
|
133
|
+
format: 'html',
|
|
134
|
+
colors: ! process.argv.includes('--no-colors'),
|
|
135
|
+
important: ! process.argv.includes('--no-important'),
|
|
136
|
+
displayNone: ! process.argv.includes('--no-display-none'),
|
|
137
|
+
selectors: ! process.argv.includes('--no-selectors'),
|
|
138
|
+
mediaQueries: ! process.argv.includes('--no-media-queries'),
|
|
139
|
+
typography: ! process.argv.includes('--no-typography'),
|
|
140
|
+
propertyValues: process.argv.includes('--no-property-values') ? false : [
|
|
141
|
+
'font-size',
|
|
142
|
+
'padding,padding-top,padding-bottom,padding-right,padding-left' ,
|
|
143
|
+
'property-values', 'margin,margin-top,marin-bottom,marin-right,marin-left',
|
|
144
|
+
]
|
|
145
|
+
})
|
|
123
146
|
);
|
|
124
147
|
|
|
125
148
|
webpackConfig.devServer = {
|
|
@@ -129,6 +152,8 @@ if( 'serve' === process.argv[2] ){
|
|
|
129
152
|
headers: {
|
|
130
153
|
},
|
|
131
154
|
hot: true,
|
|
155
|
+
open: ['http://localhost:9000'],
|
|
156
|
+
//client: 'verbose',
|
|
132
157
|
allowedHosts: 'auto',
|
|
133
158
|
host: 'localhost',
|
|
134
159
|
port: 9000,
|
|
@@ -138,7 +163,7 @@ if( 'serve' === process.argv[2] ){
|
|
|
138
163
|
directory: path.join( appPath, 'build'),
|
|
139
164
|
},
|
|
140
165
|
{
|
|
141
|
-
directory: path.join(appPath, 'public')
|
|
166
|
+
directory: path.join(appPath, 'public')
|
|
142
167
|
},
|
|
143
168
|
{
|
|
144
169
|
directory: path.join(appPath, 'node_modules'),
|
|
@@ -146,9 +171,6 @@ if( 'serve' === process.argv[2] ){
|
|
|
146
171
|
{
|
|
147
172
|
directory: path.join(appPath, 'src'),
|
|
148
173
|
},
|
|
149
|
-
{
|
|
150
|
-
directory: path.join(projectPath, 'bin', 'css-audit', 'public'),
|
|
151
|
-
}
|
|
152
174
|
],
|
|
153
175
|
proxy: [
|
|
154
176
|
{
|