@caweb/cli 1.4.2 → 1.4.4
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 -180
- package/bin/css-audit/.editorconfig +12 -0
- package/bin/css-audit/.github/workflows/build-report.yml +46 -0
- package/bin/css-audit/.github/workflows/merge-trunk-to-report.yml +17 -0
- package/bin/css-audit/.github/workflows/node.yaml +32 -0
- package/bin/css-audit/.nvmrc +1 -0
- package/bin/css-audit/README.md +131 -0
- package/bin/css-audit/css-audit.config.js +13 -0
- package/bin/css-audit/index.js +38 -0
- package/bin/css-audit/package-lock.json +6689 -0
- package/bin/css-audit/package.json +56 -0
- package/bin/css-audit/public/.gitkeep +1 -0
- package/bin/css-audit/src/__tests__/alphas.js +128 -0
- package/bin/css-audit/src/__tests__/colors.js +115 -0
- package/bin/css-audit/src/__tests__/display-none.js +52 -0
- package/bin/css-audit/src/__tests__/important.js +88 -0
- package/bin/css-audit/src/__tests__/media-queries.js +84 -0
- package/bin/css-audit/src/__tests__/property-values.js +55 -0
- package/bin/css-audit/src/__tests__/run.js +25 -0
- package/bin/css-audit/src/__tests__/selectors.js +66 -0
- package/bin/css-audit/src/audits/alphas.js +70 -0
- package/bin/css-audit/src/audits/colors.js +83 -0
- package/bin/css-audit/src/audits/display-none.js +39 -0
- package/bin/css-audit/src/audits/important.js +60 -0
- package/bin/css-audit/src/audits/media-queries.js +96 -0
- package/bin/css-audit/src/audits/property-values.js +65 -0
- package/bin/css-audit/src/audits/selectors.js +67 -0
- package/bin/css-audit/src/audits/typography.js +41 -0
- package/bin/css-audit/src/formats/cli-table.js +81 -0
- package/bin/css-audit/src/formats/html/_audit-alpha.twig +23 -0
- package/bin/css-audit/src/formats/html/_audit-colors.twig +23 -0
- package/bin/css-audit/src/formats/html/_audit-default.twig +24 -0
- package/bin/css-audit/src/formats/html/index.twig +88 -0
- package/bin/css-audit/src/formats/html/style.css +341 -0
- package/bin/css-audit/src/formats/html.js +52 -0
- package/bin/css-audit/src/formats/json.js +9 -0
- package/bin/css-audit/src/run.js +76 -0
- package/bin/css-audit/src/utils/__tests__/cli.js +70 -0
- package/bin/css-audit/src/utils/__tests__/example-config.config.js +12 -0
- package/bin/css-audit/src/utils/__tests__/get-specificity.js +39 -0
- package/bin/css-audit/src/utils/cli.js +133 -0
- package/bin/css-audit/src/utils/format-report.js +37 -0
- package/bin/css-audit/src/utils/get-specificity.js +97 -0
- package/bin/css-audit/src/utils/get-values-count.js +17 -0
- package/commands/index.js +15 -5
- package/commands/test.js +0 -3
- package/commands/webpack/webpack.js +166 -0
- package/configs/webpack.config.js +151 -81
- package/lib/cli.js +71 -35
- package/lib/helpers.js +3 -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 +18 -12
- package/assets/logo.ico +0 -0
- package/commands/a11y.js +0 -95
- package/commands/build.js +0 -80
- package/commands/serve.js +0 -95
- package/configs/aceconfig.js +0 -28
- package/docs/CREDITS.MD +0 -27
- package/docs/ISSUES.MD +0 -7
- package/docs/OVERRIDES.md +0 -53
- package/docs/ROADMAP.MD +0 -19
- 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
|
@@ -10,113 +10,183 @@
|
|
|
10
10
|
* External dependencies
|
|
11
11
|
*/
|
|
12
12
|
import baseConfig from '@wordpress/scripts/config/webpack.config.js';
|
|
13
|
-
import
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import fs from 'fs';
|
|
15
|
+
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
16
|
+
import {HtmlWebpackSkipAssetsPlugin} from 'html-webpack-skip-assets-plugin';
|
|
17
|
+
|
|
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';
|
|
14
21
|
|
|
15
22
|
/**
|
|
16
23
|
* Internal dependencies
|
|
17
24
|
*/
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// because we use WordPress default WebPack config
|
|
24
|
-
// 'mode' is defined by process.env.NODE_ENV
|
|
25
|
-
// some of the webpack cli flags are ignored
|
|
26
|
-
// so let's make some corrections.
|
|
27
|
-
let corrections = {};
|
|
28
|
-
|
|
29
|
-
process.argv.splice( 2 ).forEach(element => {
|
|
30
|
-
// if flag
|
|
31
|
-
if( element.startsWith( '--' ) ){
|
|
32
|
-
let splitterIndex = element.indexOf( '=' );
|
|
33
|
-
let flag = element.substring(2, splitterIndex );
|
|
34
|
-
let value = element.substring( splitterIndex + 1 );
|
|
35
|
-
|
|
36
|
-
// if flag is a webpack flag add corrections.
|
|
37
|
-
switch( flag ){
|
|
38
|
-
case 'mode':
|
|
39
|
-
// if cli arg was passed use that value
|
|
40
|
-
isProduction = "production" === value;
|
|
41
|
-
|
|
42
|
-
corrections[flag] = value
|
|
43
|
-
break
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
});
|
|
25
|
+
import {
|
|
26
|
+
projectPath,
|
|
27
|
+
appPath
|
|
28
|
+
} from '../lib/index.js';
|
|
29
|
+
|
|
49
30
|
|
|
31
|
+
const samplePath = path.join( appPath, 'sample');
|
|
32
|
+
const srcPath = path.join( appPath, 'src');
|
|
33
|
+
const dataPath = path.join( srcPath, 'data');
|
|
50
34
|
|
|
51
|
-
|
|
35
|
+
|
|
36
|
+
// Update some of the default WordPress webpack rules.
|
|
52
37
|
baseConfig.module.rules.forEach((rule, i) => {
|
|
53
38
|
const r = new RegExp(rule.test).toString();
|
|
54
39
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
filename
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// we don't care who the issuer is
|
|
76
|
-
delete baseConfig.module.rules[i].issuer;
|
|
77
|
-
|
|
78
|
-
}
|
|
40
|
+
switch(r){
|
|
41
|
+
// WordPress adds a hash to asset file names we remove that hash.
|
|
42
|
+
case new RegExp(/\.(bmp|png|jpe?g|gif|webp)$/i).toString():
|
|
43
|
+
rule.generator.filename = 'images/[name][ext]';
|
|
44
|
+
break;
|
|
45
|
+
case new RegExp(/\.(woff|woff2|eot|ttf|otf)$/i).toString():
|
|
46
|
+
rule.generator.filename = 'fonts/[name][ext]';
|
|
47
|
+
break;
|
|
48
|
+
case new RegExp(/\.svg$/).toString():
|
|
49
|
+
// we don't want SVG to be asset/inline otherwise the resource may not be available.
|
|
50
|
+
// the asset should be an asset/resource we move them to the fonts folder.
|
|
51
|
+
if( 'asset/inline' === rule.type ){
|
|
52
|
+
rule.type = 'asset/resource';
|
|
53
|
+
rule.generator = { filename: 'fonts/[name][ext]' };
|
|
54
|
+
|
|
55
|
+
delete rule.issuer;
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
79
58
|
}
|
|
80
|
-
})
|
|
59
|
+
});
|
|
81
60
|
|
|
82
61
|
// Our Webpack Configuration.
|
|
83
62
|
let webpackConfig = {
|
|
84
63
|
...baseConfig,
|
|
85
64
|
target: 'web',
|
|
86
|
-
|
|
65
|
+
cache: false,
|
|
87
66
|
output: {
|
|
88
67
|
...baseConfig.output,
|
|
89
|
-
publicPath:
|
|
68
|
+
publicPath: `/public`,
|
|
90
69
|
clean: true
|
|
91
70
|
},
|
|
92
|
-
plugins: [
|
|
93
|
-
...baseConfig.plugins,
|
|
94
|
-
new MiniCssExtractPlugin(
|
|
95
|
-
{
|
|
96
|
-
linkType: "text/css",
|
|
97
|
-
filename: '[name].css'
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
],
|
|
101
|
-
module: {
|
|
102
|
-
rules: [
|
|
103
|
-
...baseConfig.module.rules,
|
|
104
|
-
/*{
|
|
105
|
-
test: /\.html$/,
|
|
106
|
-
loader:'handlebars-loader'
|
|
107
|
-
}*/
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
71
|
performance: {
|
|
111
72
|
maxAssetSize: 500000,
|
|
112
73
|
maxEntrypointSize: 500000
|
|
113
74
|
}
|
|
114
75
|
};
|
|
115
76
|
|
|
116
|
-
|
|
117
|
-
|
|
77
|
+
// Delete the default WP Dev Server
|
|
78
|
+
delete webpackConfig.devServer;
|
|
79
|
+
|
|
80
|
+
// Only add the Dev Server if the serve command is ran.
|
|
81
|
+
if( 'serve' === process.argv[2] ){
|
|
82
|
+
|
|
83
|
+
// Add html rule
|
|
84
|
+
webpackConfig.module.rules = [
|
|
85
|
+
...baseConfig.module.rules,
|
|
86
|
+
{
|
|
87
|
+
test: /\.html$/,
|
|
88
|
+
loader:'handlebars-loader'
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
// we only want to display errors and warnings
|
|
93
|
+
webpackConfig.stats = 'errors-warnings';
|
|
94
|
+
|
|
95
|
+
let pageTemplate = {
|
|
96
|
+
title: path.basename(appPath),
|
|
97
|
+
minify: false,
|
|
98
|
+
meta: {
|
|
99
|
+
"Author": "CAWebPublishing",
|
|
100
|
+
"Description": "State of California",
|
|
101
|
+
"Keywords": "California,government",
|
|
102
|
+
"viewport": "width=device-width, initial-scale=1.0, minimum-scale=1.0"
|
|
103
|
+
},
|
|
104
|
+
templateParameters: {
|
|
105
|
+
"title" : path.basename(appPath)
|
|
106
|
+
},
|
|
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
|
+
]
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// if an favicon exists.
|
|
116
|
+
if( fs.existsSync(path.join(srcPath, 'favicon.ico')) ){
|
|
117
|
+
pageTemplate.favicon = path.join(srcPath, 'favicon.ico');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Sample Page.
|
|
121
|
+
let sample = {
|
|
122
|
+
...pageTemplate,
|
|
123
|
+
filename: path.join( appPath, 'public', 'index.html'),
|
|
124
|
+
template: path.join(samplePath, 'index.html')
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
webpackConfig.plugins.push(
|
|
128
|
+
new HtmlWebpackPlugin(sample),
|
|
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
|
+
})
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
webpackConfig.devServer = {
|
|
149
|
+
devMiddleware: {
|
|
150
|
+
writeToDisk: true
|
|
151
|
+
},
|
|
152
|
+
headers: {
|
|
153
|
+
},
|
|
154
|
+
hot: true,
|
|
155
|
+
open: ['http://localhost:9000'],
|
|
156
|
+
//client: 'verbose',
|
|
157
|
+
allowedHosts: 'auto',
|
|
158
|
+
host: 'localhost',
|
|
159
|
+
port: 9000,
|
|
160
|
+
compress: true,
|
|
161
|
+
static: [
|
|
162
|
+
{
|
|
163
|
+
directory: path.join( appPath, 'build'),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
directory: path.join(appPath, 'public')
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
directory: path.join(appPath, 'node_modules'),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
directory: path.join(appPath, 'src'),
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
proxy: [
|
|
176
|
+
{
|
|
177
|
+
context: ['/node_modules'],
|
|
178
|
+
target: 'http://localhost:9000',
|
|
179
|
+
pathRewrite: { '^/node_modules': '' },
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
context: ['/src'],
|
|
183
|
+
target: 'http://localhost:9000',
|
|
184
|
+
pathRewrite: { '^/src': '' },
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
}
|
|
188
|
+
|
|
118
189
|
|
|
119
|
-
SiteGenerator( webpackConfig );
|
|
120
190
|
}
|
|
121
191
|
|
|
122
192
|
export default webpackConfig;
|
package/lib/cli.js
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
//const wpenv_cli = require('@wordpress/env/lib/cli');
|
|
5
5
|
|
|
6
6
|
import path from 'path';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
7
|
import fs from 'fs';
|
|
9
|
-
import terminalLink from 'terminal-link';
|
|
10
8
|
import { Command, Argument, Option } from 'commander';
|
|
11
9
|
|
|
12
10
|
/**
|
|
@@ -14,10 +12,6 @@ import { Command, Argument, Option } from 'commander';
|
|
|
14
12
|
*/
|
|
15
13
|
import * as env from '../commands/index.js';
|
|
16
14
|
import {
|
|
17
|
-
wpPrimary,
|
|
18
|
-
wpGreen,
|
|
19
|
-
wpYellow,
|
|
20
|
-
wpRed,
|
|
21
15
|
withSpinner,
|
|
22
16
|
projectPath,
|
|
23
17
|
} from './index.js';
|
|
@@ -55,9 +49,7 @@ function addWPEnvCommands(){
|
|
|
55
49
|
// Start command.
|
|
56
50
|
program.command('start')
|
|
57
51
|
.description(
|
|
58
|
-
|
|
59
|
-
chalk`Starts two CAWebPublishing WordPress instances\ndevelopment on port ${ terminalLink( '8888', 'http://localhost:8888' ) } (override with WP_ENV_PORT)\ntests on port {bold.underline ${ terminalLink( '8889', 'http://localhost:8889' ) }} (override with WP_ENV_TESTS_PORT).\nAfter first install, use the '--update' flag to download updates to mapped sources and to re-apply CAWeb configuration options.`
|
|
60
|
-
)
|
|
52
|
+
`Starts two CAWebPublishing WordPress instances\ndevelopment on port http://localhost:8888 (override with WP_ENV_PORT)\ntests on port http://localhost:8889 (override with WP_ENV_TESTS_PORT).`
|
|
61
53
|
)
|
|
62
54
|
.option(
|
|
63
55
|
'--update',
|
|
@@ -104,9 +96,7 @@ function addWPEnvCommands(){
|
|
|
104
96
|
// Destroy Command.
|
|
105
97
|
program.command('destroy')
|
|
106
98
|
.description(
|
|
107
|
-
|
|
108
|
-
'Deletes docker containers, volumes, and networks associated with the CAWebPublishing instances and removes local files.'
|
|
109
|
-
)
|
|
99
|
+
'Deletes docker containers, volumes, and networks associated with the CAWebPublishing instances and removes local files.'
|
|
110
100
|
)
|
|
111
101
|
.option(
|
|
112
102
|
'--scripts',
|
|
@@ -119,9 +109,7 @@ function addWPEnvCommands(){
|
|
|
119
109
|
// Stop Command.
|
|
120
110
|
program.command('stop')
|
|
121
111
|
.description(
|
|
122
|
-
|
|
123
|
-
'Stops running WordPress for development and tests and frees the ports.'
|
|
124
|
-
)
|
|
112
|
+
'Stops running WordPress for development and tests and frees the ports.'
|
|
125
113
|
)
|
|
126
114
|
.allowUnknownOption(true)
|
|
127
115
|
.action( withSpinner(env.stop) )
|
|
@@ -135,7 +123,7 @@ function addWPEnvCommands(){
|
|
|
135
123
|
// Clean Command.
|
|
136
124
|
program.command('clean')
|
|
137
125
|
.description(
|
|
138
|
-
|
|
126
|
+
'Cleans the WordPress databases.'
|
|
139
127
|
)
|
|
140
128
|
.addArgument(envArg)
|
|
141
129
|
.option(
|
|
@@ -190,15 +178,10 @@ export default function cli() {
|
|
|
190
178
|
|
|
191
179
|
|
|
192
180
|
program
|
|
193
|
-
.name(
|
|
194
|
-
.usage(
|
|
181
|
+
.name('caweb')
|
|
182
|
+
.usage( '<command>' )
|
|
195
183
|
.description('Command Line Interface utilized by CAWebPublishing to accomplish several tasks.')
|
|
196
184
|
.version( pkg.version )
|
|
197
|
-
.option(
|
|
198
|
-
'--debug',
|
|
199
|
-
'Enable debug output.',
|
|
200
|
-
false
|
|
201
|
-
)
|
|
202
185
|
.allowUnknownOption(true)
|
|
203
186
|
.configureHelp({
|
|
204
187
|
sortSubcommands: true,
|
|
@@ -212,25 +195,78 @@ export default function cli() {
|
|
|
212
195
|
program.command('build')
|
|
213
196
|
.description('Builds the current project.')
|
|
214
197
|
.allowUnknownOption(true)
|
|
215
|
-
.action(
|
|
198
|
+
.action(env.webpack)
|
|
216
199
|
|
|
217
200
|
|
|
218
201
|
// Serve Command.
|
|
219
202
|
program.command('serve')
|
|
220
|
-
|
|
221
|
-
.option(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
)
|
|
203
|
+
.description('Serve the current project')
|
|
204
|
+
.option( '--audit', 'Performs WordPress CSS-Audit.', true )
|
|
205
|
+
.option( '--no-audit', 'Skips WordPress CSS-Audit.', false )
|
|
206
|
+
.option( '--a11y', 'Performs IBM Accessibility Checker.', true )
|
|
207
|
+
.option( '--no-a11y', 'Skips IBM Accessibility Checker.', false )
|
|
225
208
|
.allowUnknownOption(true)
|
|
226
|
-
|
|
209
|
+
//.action(withSpinner(env.webpack))
|
|
210
|
+
.action(env.webpack)
|
|
227
211
|
|
|
228
212
|
// a11y Command.
|
|
229
213
|
program.command('a11y')
|
|
230
|
-
.addArgument(new Argument('<url>', 'URL to scan for accessibility checks.'))
|
|
231
214
|
.description('Runs accessibility checks.')
|
|
215
|
+
.addArgument(new Argument('<url>', 'URL to scan for accessibility checks.'))
|
|
216
|
+
.option( '--rule-archive <rule>', 'Specify the rule archive.', 'latest')
|
|
217
|
+
.option( '--policies <policy...>', 'Specify one or many policies to scan.', ['WCAG_2_1'])
|
|
218
|
+
.option( '--fail-levels <levels...>', 'Specify one or many violation levels on which to fail the test.', [
|
|
219
|
+
'violation',
|
|
220
|
+
'potentialviolation'
|
|
221
|
+
])
|
|
222
|
+
.option( '--report-levels <levels...>', 'Specify one or many violation levels that should be reported.', [
|
|
223
|
+
'violation',
|
|
224
|
+
'potentialviolation',
|
|
225
|
+
'recommendation',
|
|
226
|
+
'potentialrecommendation',
|
|
227
|
+
'manual',
|
|
228
|
+
'pass'
|
|
229
|
+
])
|
|
230
|
+
.option( '--labels <label...>', 'Specify labels that you would like associated to your scan.', [])
|
|
231
|
+
.option( '--output-format <format>', 'In which formats should the results be output.', ['html'])
|
|
232
|
+
.option( '--output-filename <name>', 'Filename for the scan results.')
|
|
233
|
+
.option( '--output-folder <folder>', 'Where the scan results should be saved.', 'a11y')
|
|
234
|
+
.option( '--output-filename-timestamp', 'Should the timestamp be included in the filename of the reports?', false)
|
|
235
|
+
.allowUnknownOption(true)
|
|
236
|
+
.action(env.a11y)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
// audit Command.
|
|
240
|
+
program.command('audit')
|
|
241
|
+
.description('Runs WordPress CSS Audit tool against projects.')
|
|
242
|
+
.addArgument(new Argument('[files...]', 'Files or directory path to CSS files.').default(['./build']))
|
|
243
|
+
.option('--format [format]', 'Format to use for displaying report.', 'html' )
|
|
244
|
+
.option('--filename [name]', 'If using a format that outputs to a file, specify the file name.', 'css-audit' )
|
|
245
|
+
.option('--colors', 'Runs colors audit.', true )
|
|
246
|
+
.addOption(new Option('--no-colors', 'Skips colors audit.', false ).hideHelp())
|
|
247
|
+
.option('--important', 'Runs !important audit.', true )
|
|
248
|
+
.addOption(new Option('--no-important', 'Skips !important audit.', false ).hideHelp())
|
|
249
|
+
.option('--display-none', 'Runs display: none audit.', true )
|
|
250
|
+
.addOption(new Option('--no-display-none', 'Skips display: none audit.', false ).hideHelp())
|
|
251
|
+
.option('--selectors', 'Runs selectors audit.', true )
|
|
252
|
+
.addOption(new Option('--no-selectors', 'Skips selectors audit.', false ).hideHelp())
|
|
253
|
+
.option('--media-queries', 'Runs media queries audit.', true )
|
|
254
|
+
.addOption(new Option('--no-media-queries', 'Skips media queries audit.', false ).hideHelp())
|
|
255
|
+
.option('--typography', 'Runs typography audit.', true )
|
|
256
|
+
.addOption(new Option('--no-typography', 'Skips typography audit.', false ).hideHelp())
|
|
257
|
+
.option('--property-values <values...>', 'Runs property value audit.', ['font-size', 'padding,padding-top,padding-bottom,padding-right,padding-left', 'margin,margin-top,marin-bottom,marin-right,marin-left'] )
|
|
258
|
+
.addOption(new Option('--no-property-values', 'Skips property values audit.', false ).hideHelp())
|
|
259
|
+
.allowUnknownOption(true)
|
|
260
|
+
.action(env.audit)
|
|
261
|
+
|
|
262
|
+
// JSHint Command.
|
|
263
|
+
program.command('jshint')
|
|
264
|
+
.description('Runs JSHint tool against projects.')
|
|
265
|
+
.addArgument(new Argument('[files...]', 'Files or directory path to JS files.').default(['./src']))
|
|
266
|
+
.option( '--output-filename <name>', 'Filename for the scan results.')
|
|
267
|
+
.option( '--output-folder <folder>', 'Where the hint results should be saved.')
|
|
232
268
|
.allowUnknownOption(true)
|
|
233
|
-
.action(
|
|
269
|
+
.action(env.hint)
|
|
234
270
|
|
|
235
271
|
// Update Plugins Command.
|
|
236
272
|
program.command('update-plugins')
|
|
@@ -257,9 +293,9 @@ export default function cli() {
|
|
|
257
293
|
|
|
258
294
|
// Update a Design System Block Command.
|
|
259
295
|
program.command('sync')
|
|
260
|
-
.description('Sync changes from one
|
|
261
|
-
.argument('<from>', 'Target Site URL
|
|
262
|
-
.argument('<to>', 'Destination Site URL
|
|
296
|
+
.description('Sync changes from one WordPress instance to another.')
|
|
297
|
+
.argument('<from>', 'Target Site URL.')
|
|
298
|
+
.argument('<to>', 'Destination Site URL.')
|
|
263
299
|
.addOption(new Option(
|
|
264
300
|
'-t,--tax [tax...]',
|
|
265
301
|
'Taxonomy that should be synced. Omitting this option will sync the full site.'
|
package/lib/helpers.js
CHANGED
|
@@ -40,6 +40,9 @@ async function runCmd(cmd, args,opts = { stdio: ['inherit', 'pipe'] }){
|
|
|
40
40
|
*/
|
|
41
41
|
cmd += /^win/.test(process.platform) ? '.cmd' : '';
|
|
42
42
|
break;
|
|
43
|
+
case 'auditor':
|
|
44
|
+
cmd = 'node ' + resolveBin('@caweb/cli', {executable: 'auditor'} )
|
|
45
|
+
break;
|
|
43
46
|
case 'achecker':
|
|
44
47
|
cmd = resolveBin('accessibility-checker', {executable: 'achecker'})
|
|
45
48
|
break;
|
|
@@ -49,7 +52,6 @@ async function runCmd(cmd, args,opts = { stdio: ['inherit', 'pipe'] }){
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
return spawn.sync( cmd, args, {...opts, env: process.env});
|
|
52
|
-
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for Accessibility Checker
|
|
3
|
+
* @link https://www.npmjs.com/package/accessibility-checker
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let levels = [
|
|
7
|
+
'violation',
|
|
8
|
+
'potentialviolation',
|
|
9
|
+
'recommendation',
|
|
10
|
+
'potentialrecommendation',
|
|
11
|
+
'manual',
|
|
12
|
+
'pass'
|
|
13
|
+
];
|
|
14
|
+
let reportLevels = levels;
|
|
15
|
+
let failLevels = levels;
|
|
16
|
+
|
|
17
|
+
// process args
|
|
18
|
+
process.argv.forEach((arg) => {
|
|
19
|
+
// remove any report levels
|
|
20
|
+
if( arg.includes('--no-report-levels-') ){
|
|
21
|
+
let r = arg.replace('--no-report-levels-', '')
|
|
22
|
+
delete reportLevels[reportLevels.indexOf(r)]
|
|
23
|
+
}
|
|
24
|
+
// remove any fails levels
|
|
25
|
+
if( arg.includes('--no-fail-levels-') ){
|
|
26
|
+
let f = arg.replace('--no-fail-levels-', '')
|
|
27
|
+
delete failLevels[failLevels.indexOf(f)]
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
ruleArchive: "latest",
|
|
33
|
+
policies: [
|
|
34
|
+
'WCAG_2_1'
|
|
35
|
+
],
|
|
36
|
+
failLevels: failLevels.filter(e=>e),
|
|
37
|
+
reportLevels: reportLevels.filter(e=>e),
|
|
38
|
+
outputFilename: 'a11y',
|
|
39
|
+
outputFolder: "public",
|
|
40
|
+
outputFormat: [
|
|
41
|
+
'html'
|
|
42
|
+
],
|
|
43
|
+
outputFilenameTimestamp: false
|
|
44
|
+
}
|