@caweb/cli 1.4.5 → 1.5.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.
- package/commands/index.js +13 -19
- package/commands/webpack/webpack.js +19 -102
- package/lib/cli.js +136 -125
- package/lib/helpers.js +3 -5
- package/lib/index.js +12 -18
- package/package.json +7 -31
- package/bin/css-audit/.editorconfig +0 -12
- package/bin/css-audit/.github/workflows/build-report.yml +0 -46
- package/bin/css-audit/.github/workflows/merge-trunk-to-report.yml +0 -17
- package/bin/css-audit/.github/workflows/node.yaml +0 -32
- package/bin/css-audit/.nvmrc +0 -1
- package/bin/css-audit/README.md +0 -131
- package/bin/css-audit/css-audit.config.js +0 -13
- package/bin/css-audit/index.js +0 -38
- package/bin/css-audit/package-lock.json +0 -6689
- package/bin/css-audit/package.json +0 -56
- package/bin/css-audit/public/.gitkeep +0 -1
- package/bin/css-audit/src/__tests__/alphas.js +0 -128
- package/bin/css-audit/src/__tests__/colors.js +0 -115
- package/bin/css-audit/src/__tests__/display-none.js +0 -52
- package/bin/css-audit/src/__tests__/important.js +0 -88
- package/bin/css-audit/src/__tests__/media-queries.js +0 -84
- package/bin/css-audit/src/__tests__/property-values.js +0 -55
- package/bin/css-audit/src/__tests__/run.js +0 -25
- package/bin/css-audit/src/__tests__/selectors.js +0 -66
- package/bin/css-audit/src/audits/alphas.js +0 -70
- package/bin/css-audit/src/audits/colors.js +0 -83
- package/bin/css-audit/src/audits/display-none.js +0 -39
- package/bin/css-audit/src/audits/important.js +0 -60
- package/bin/css-audit/src/audits/media-queries.js +0 -96
- package/bin/css-audit/src/audits/property-values.js +0 -65
- package/bin/css-audit/src/audits/selectors.js +0 -67
- package/bin/css-audit/src/audits/typography.js +0 -41
- package/bin/css-audit/src/formats/cli-table.js +0 -81
- package/bin/css-audit/src/formats/html/_audit-alpha.twig +0 -23
- package/bin/css-audit/src/formats/html/_audit-colors.twig +0 -23
- package/bin/css-audit/src/formats/html/_audit-default.twig +0 -24
- package/bin/css-audit/src/formats/html/index.twig +0 -88
- package/bin/css-audit/src/formats/html/style.css +0 -341
- package/bin/css-audit/src/formats/html.js +0 -52
- package/bin/css-audit/src/formats/json.js +0 -9
- package/bin/css-audit/src/run.js +0 -76
- package/bin/css-audit/src/utils/__tests__/cli.js +0 -70
- package/bin/css-audit/src/utils/__tests__/example-config.config.js +0 -12
- package/bin/css-audit/src/utils/__tests__/get-specificity.js +0 -39
- package/bin/css-audit/src/utils/cli.js +0 -133
- package/bin/css-audit/src/utils/format-report.js +0 -37
- package/bin/css-audit/src/utils/get-specificity.js +0 -97
- package/bin/css-audit/src/utils/get-values-count.js +0 -17
- package/configs/webpack.config.js +0 -192
- package/lib/webpack/plugins/css-audit/css-audit.config.cjs +0 -5
- package/lib/webpack/plugins/css-audit/default.config.js +0 -19
- package/lib/webpack/plugins/css-audit/index.js +0 -297
- package/lib/webpack/plugins/css-audit/package.json +0 -12
- package/lib/webpack/plugins/jshint/.jshintrc +0 -31
- package/lib/webpack/plugins/jshint/index.js +0 -286
- package/lib/webpack/plugins/jshint/package-lock.json +0 -22
- package/lib/webpack/plugins/jshint/package.json +0 -15
- package/lib/webpack/plugins/jshint/reporter.cjs +0 -663
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
const minimist = require( 'minimist' );
|
|
5
|
-
const path = require( 'path' );
|
|
6
|
-
const { cosmiconfigSync } = require( 'cosmiconfig' );
|
|
7
|
-
|
|
8
|
-
const getArgsFromCLI = ( excludePrefixes ) => {
|
|
9
|
-
const args = process.argv.slice( 2 );
|
|
10
|
-
if ( excludePrefixes ) {
|
|
11
|
-
return args.filter( ( arg ) => {
|
|
12
|
-
return ! excludePrefixes.some( ( prefix ) =>
|
|
13
|
-
arg.startsWith( prefix )
|
|
14
|
-
);
|
|
15
|
-
} );
|
|
16
|
-
}
|
|
17
|
-
return args;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const getFileArgsFromCLI = () => minimist( getArgsFromCLI() )._;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get configuration using cosmiconfig.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} env
|
|
26
|
-
*/
|
|
27
|
-
const getConfig = ( env ) => {
|
|
28
|
-
const moduleName = 'test' === env ? 'example-config' : 'css-audit';
|
|
29
|
-
const searchFrom =
|
|
30
|
-
'test' === env ? path.join( __dirname, '__tests__' ) : process.cwd();
|
|
31
|
-
|
|
32
|
-
const explorerSync = cosmiconfigSync( moduleName );
|
|
33
|
-
const { config } = explorerSync.search( searchFrom );
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
return config;
|
|
37
|
-
} catch ( e ) {
|
|
38
|
-
console.error( e, 'Error retrieving config file.' );
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get the argument required for running the audit,
|
|
44
|
-
*
|
|
45
|
-
* First get the argument from CLI, and fallback to the
|
|
46
|
-
* config if its not present.
|
|
47
|
-
*
|
|
48
|
-
* @param {string} arg
|
|
49
|
-
* @param {boolean} cliArgOnly
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
const getArg = ( arg, cliArgOnly = false ) => {
|
|
53
|
-
for ( const cliArg of getArgsFromCLI() ) {
|
|
54
|
-
const [ name, value ] = cliArg.split( '=' );
|
|
55
|
-
|
|
56
|
-
if ( name === arg ) {
|
|
57
|
-
return 'undefined' === typeof value ? true : value || null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if ( true === cliArgOnly ) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const config = getConfig( process.env.NODE_ENV );
|
|
66
|
-
|
|
67
|
-
const term = arg.substr( 2 );
|
|
68
|
-
|
|
69
|
-
// This is a simple property: value arg e.g. format: json
|
|
70
|
-
const isSimplePropertyValueArg = config.hasOwnProperty( term );
|
|
71
|
-
|
|
72
|
-
if ( isSimplePropertyValueArg ) {
|
|
73
|
-
return 'undefined' === typeof config[ term ]
|
|
74
|
-
? true
|
|
75
|
-
: config[ term ] || null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if ( config.hasOwnProperty( 'audits' ) ) {
|
|
79
|
-
// Separate the basic audits from property-values.
|
|
80
|
-
const basicAudits = config.audits.filter(
|
|
81
|
-
( audit ) => term === audit && 'string' === typeof audit
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
// Create an array of values of the property-value audits.
|
|
85
|
-
const propertyValueAudits = config.audits.filter(
|
|
86
|
-
( audit ) => 'object' === typeof audit && term === audit[ 0 ]
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const propertyValueValues = ( () => {
|
|
90
|
-
if ( propertyValueAudits.length > 0 ) {
|
|
91
|
-
return propertyValueAudits
|
|
92
|
-
.flat()
|
|
93
|
-
.filter( ( item ) => 'property-values' !== item );
|
|
94
|
-
}
|
|
95
|
-
return [];
|
|
96
|
-
} )();
|
|
97
|
-
|
|
98
|
-
if ( 'undefined' !== basicAudits[ 0 ] && term === basicAudits[ 0 ] ) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if ( propertyValueValues.length > 0 ) {
|
|
103
|
-
return propertyValueValues;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// The argument cannot be retrieved from CLI or config.
|
|
108
|
-
return false;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const getHelp = () => {
|
|
112
|
-
return `Usage: css-audit -- <files...> [options]
|
|
113
|
-
|
|
114
|
-
--colors Run colors audit.
|
|
115
|
-
--important Run !important audit.
|
|
116
|
-
--display-none Run display: none audit.
|
|
117
|
-
--selectors Run selectors audit.
|
|
118
|
-
--media-queries Run media queries audit.
|
|
119
|
-
--property-values Run audit for a given set of property values, comma-separated.
|
|
120
|
-
--recommended Run recommended audits (colors, important, selectors). Default: true.
|
|
121
|
-
--all Run all audits (except property values, as it requires a value).
|
|
122
|
-
--format Format to use for displaying report.
|
|
123
|
-
--help Show this message.
|
|
124
|
-
`;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
module.exports = {
|
|
128
|
-
getArgsFromCLI,
|
|
129
|
-
getFileArgsFromCLI,
|
|
130
|
-
getArg,
|
|
131
|
-
getConfig,
|
|
132
|
-
getHelp,
|
|
133
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const FMT_CLI_TABLE = 'cli-table';
|
|
2
|
-
const FMT_JSON = 'json';
|
|
3
|
-
const FMT_HTML = 'html';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Format the reports using the specified reporter format.
|
|
7
|
-
*
|
|
8
|
-
* @param {Array<Array<Object>>} reports The list of report data.
|
|
9
|
-
* @param {FMT_CLI_TABLE|FMT_JSON} format One of the predefined formats. Defaults to FMT_CLI_TABLE.
|
|
10
|
-
* @return {string} The formatted reports.
|
|
11
|
-
*/
|
|
12
|
-
function formatReport( reports, format = FMT_CLI_TABLE ) {
|
|
13
|
-
let formatCallback = false;
|
|
14
|
-
switch ( format ) {
|
|
15
|
-
case FMT_JSON:
|
|
16
|
-
formatCallback = require( '../formats/json' );
|
|
17
|
-
break;
|
|
18
|
-
case FMT_HTML:
|
|
19
|
-
formatCallback = require( '../formats/html' );
|
|
20
|
-
break;
|
|
21
|
-
case FMT_CLI_TABLE:
|
|
22
|
-
default:
|
|
23
|
-
formatCallback = require( '../formats/cli-table' );
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const formattedReports = formatCallback( reports );
|
|
27
|
-
if ( Array.isArray( formattedReports ) ) {
|
|
28
|
-
return formattedReports.join( '\n' );
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return formattedReports;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = {
|
|
35
|
-
formats: [ FMT_CLI_TABLE, FMT_JSON ],
|
|
36
|
-
formatReport,
|
|
37
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const csstree = require( 'css-tree' );
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A recursive callback used to build up the specificity of a selector.
|
|
5
|
-
*
|
|
6
|
-
* This is intented to be used as a `reduce` callback, building up the
|
|
7
|
-
* specificity in the array accumulator as it processes each part of a selector.
|
|
8
|
-
*
|
|
9
|
-
* @param {Array<number>} specificity The specificity as an array.
|
|
10
|
-
* @param {Object} selector A selector node from the css-tree AST.
|
|
11
|
-
* @return {Array} The calculated specificity value.
|
|
12
|
-
*/
|
|
13
|
-
function calculateSpecificity( [ a, b, c ], selector ) {
|
|
14
|
-
if ( ! selector.type ) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if ( 'lang' !== selector.name && selector.children ) {
|
|
18
|
-
return selector.children
|
|
19
|
-
.toArray()
|
|
20
|
-
.reduce( calculateSpecificity, [ a, b, c ] );
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
switch ( selector.type ) {
|
|
24
|
-
case 'IdSelector':
|
|
25
|
-
a++;
|
|
26
|
-
break;
|
|
27
|
-
case 'ClassSelector':
|
|
28
|
-
case 'AttributeSelector':
|
|
29
|
-
case 'Nth':
|
|
30
|
-
b++;
|
|
31
|
-
break;
|
|
32
|
-
case 'PseudoClassSelector':
|
|
33
|
-
if ( 'not' === selector.name ) {
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
b++;
|
|
37
|
-
break;
|
|
38
|
-
case 'TypeSelector':
|
|
39
|
-
case 'PseudoElementSelector':
|
|
40
|
-
if ( '*' === selector.name ) {
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
c++;
|
|
44
|
-
break;
|
|
45
|
-
case 'WhiteSpace':
|
|
46
|
-
case 'Combinator':
|
|
47
|
-
case 'Identifier':
|
|
48
|
-
// Whitespace, adjacent selectors (>, ~), … do not impact specificity.
|
|
49
|
-
break;
|
|
50
|
-
case 'Percentage':
|
|
51
|
-
// Part of a keyframe, not to be calculated.
|
|
52
|
-
break;
|
|
53
|
-
default:
|
|
54
|
-
console.warn( 'Unhandled selector type:', selector.type );
|
|
55
|
-
}
|
|
56
|
-
return [ a, b, c ];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Get the specificity value for a given CSS selector.
|
|
61
|
-
*
|
|
62
|
-
* @param {string} selector A valid CSS selector.
|
|
63
|
-
* @return {number} The calculated specificity value.
|
|
64
|
-
*/
|
|
65
|
-
function getSpecificity( selector ) {
|
|
66
|
-
const node = csstree.parse( selector, { context: 'selector' } );
|
|
67
|
-
const selectorList = node.children.toArray();
|
|
68
|
-
const [ a, b, c ] = selectorList.reduce( calculateSpecificity, [
|
|
69
|
-
0,
|
|
70
|
-
0,
|
|
71
|
-
0,
|
|
72
|
-
] );
|
|
73
|
-
return 100 * a + 10 * b + c;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Get the specificity value for a given CSS selector, as an array.
|
|
78
|
-
*
|
|
79
|
-
* @param {string} selector A valid CSS selector.
|
|
80
|
-
* @return {Array} The calculated specificity value.
|
|
81
|
-
*/
|
|
82
|
-
function getSpecificityArray( selector ) {
|
|
83
|
-
const node = csstree.parse( selector, { context: 'selector' } );
|
|
84
|
-
const selectorList = node.children.toArray();
|
|
85
|
-
const [ a, b, c ] = selectorList.reduce( calculateSpecificity, [
|
|
86
|
-
0,
|
|
87
|
-
0,
|
|
88
|
-
0,
|
|
89
|
-
] );
|
|
90
|
-
return [ a, b, c ];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
module.exports = {
|
|
94
|
-
calculateSpecificity,
|
|
95
|
-
getSpecificity,
|
|
96
|
-
getSpecificityArray,
|
|
97
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = function ( values ) {
|
|
2
|
-
const uniqueValues = [ ...new Set( values ) ];
|
|
3
|
-
|
|
4
|
-
return uniqueValues
|
|
5
|
-
.map( ( val ) => {
|
|
6
|
-
// Count up how many times this item appears in the full list.
|
|
7
|
-
const count = values.filter( ( c ) => c === val ).length;
|
|
8
|
-
return {
|
|
9
|
-
name: val,
|
|
10
|
-
count,
|
|
11
|
-
};
|
|
12
|
-
} )
|
|
13
|
-
.sort( ( a, b ) => {
|
|
14
|
-
// Reverse sort
|
|
15
|
-
return b.count - a.count;
|
|
16
|
-
} );
|
|
17
|
-
};
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebPack Configuration for California Department of Technology
|
|
3
|
-
*
|
|
4
|
-
* Utilizes WordPress Scripts Webpack configuration as base.
|
|
5
|
-
* s
|
|
6
|
-
* @link https://webpack.js.org/configuration/
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* External dependencies
|
|
11
|
-
*/
|
|
12
|
-
import baseConfig from '@wordpress/scripts/config/webpack.config.js';
|
|
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';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
import {
|
|
26
|
-
projectPath,
|
|
27
|
-
appPath
|
|
28
|
-
} from '../lib/index.js';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const samplePath = path.join( appPath, 'sample');
|
|
32
|
-
const srcPath = path.join( appPath, 'src');
|
|
33
|
-
const dataPath = path.join( srcPath, 'data');
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Update some of the default WordPress webpack rules.
|
|
37
|
-
baseConfig.module.rules.forEach((rule, i) => {
|
|
38
|
-
const r = new RegExp(rule.test).toString();
|
|
39
|
-
|
|
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;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Our Webpack Configuration.
|
|
62
|
-
let webpackConfig = {
|
|
63
|
-
...baseConfig,
|
|
64
|
-
target: 'web',
|
|
65
|
-
cache: false,
|
|
66
|
-
output: {
|
|
67
|
-
...baseConfig.output,
|
|
68
|
-
publicPath: `/public`,
|
|
69
|
-
clean: true
|
|
70
|
-
},
|
|
71
|
-
performance: {
|
|
72
|
-
maxAssetSize: 500000,
|
|
73
|
-
maxEntrypointSize: 500000
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export default webpackConfig;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
format: 'html',
|
|
7
|
-
filename: 'css-audit',
|
|
8
|
-
colors: true,
|
|
9
|
-
important: true,
|
|
10
|
-
displayNone: true,
|
|
11
|
-
selectors: true,
|
|
12
|
-
mediaQueries: true,
|
|
13
|
-
typography: true,
|
|
14
|
-
propertyValues: [
|
|
15
|
-
'font-size',
|
|
16
|
-
'padding,padding-top,padding-bottom,padding-right,padding-left' ,
|
|
17
|
-
'property-values', 'margin,margin-top,marin-bottom,marin-right,marin-left',
|
|
18
|
-
]
|
|
19
|
-
};
|