@lipemat/js-boilerplate 8.6.0-beta.5 → 8.6.0

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,24 +1,7 @@
1
1
  const postcssPresetEnv = require( 'postcss-preset-env' );
2
- const packageConfig = require( '../helpers/package-config' );
3
- const path = require( 'path' );
4
- const fs = require( 'fs' );
5
2
  const {getDefaultBrowsersList} = require( '../helpers/config' );
6
3
 
7
- /**
8
- * Files containing CSS properties to be provided to `postcss-preset-env`.
9
- * Allows rendering the values in the finished CSS for IE11.
10
- *
11
- * If none of the CSS files exist, or properties are not provided in them,
12
- * the variable won't work in IE11.
13
- *
14
- * @link https://github.com/csstools/postcss-preset-env#importfrom
15
- */
16
4
  const presetEnv = {
17
- importFrom: [
18
- path.resolve( packageConfig.workingDirectory, 'src/globals/pcss/variables.css' ),
19
- path.resolve( packageConfig.workingDirectory, '../pcss/globals/variables.css' ),
20
- ].filter( filePath => fs.existsSync( filePath ) ),
21
-
22
5
  features: {
23
6
  /**
24
7
  * Fixes `focus-visible` feature for CSS modules (included by preset-env anywhere
@@ -42,8 +25,7 @@ const presetEnv = {
42
25
  };
43
26
 
44
27
  /**
45
- * If browserslist is not specified, we fallback to WordPress defaults
46
- * except for IE11 which we don't support by default.
28
+ * If browserslist is not specified, we fallback to WordPress defaults.
47
29
  *
48
30
  * @link https://github.com/csstools/postcss-preset-env#browsers
49
31
  */
@@ -5,7 +5,7 @@ const fs = require( 'fs' );
5
5
  const ForkTsCheckerWebpackPlugin = require( 'fork-ts-checker-webpack-plugin' );
6
6
  const config = require( '../helpers/package-config' );
7
7
 
8
- const postCSSOptions = getConfig( 'postcss.config.js' );
8
+ const postcssOptions = getConfig( 'postcss.config.js' );
9
9
  const babelOptions = getConfig( 'babel.config.js' );
10
10
  const cssLoaderOptions = getConfig( 'css-loader.config.js' );
11
11
 
@@ -97,8 +97,10 @@ module.exports = {
97
97
  options: cssLoaderOptions,
98
98
  },
99
99
  {
100
- loader: '@lipemat/postcss-loader',
101
- options: postCSSOptions,
100
+ loader: 'postcss-loader',
101
+ options: {
102
+ postcssOptions,
103
+ },
102
104
  },
103
105
  ],
104
106
  },
@@ -9,7 +9,7 @@ const WebpackAssetsManifest = require( 'webpack-assets-manifest' );
9
9
  const SriPlugin = require( 'webpack-subresource-integrity' );
10
10
  const config = require( '../helpers/package-config' );
11
11
 
12
- const postCSSOptions = getConfig( 'postcss.config.js' );
12
+ const postcssOptions = getConfig( 'postcss.config.js' );
13
13
  const babelOptions = getConfig( 'babel.config.js' );
14
14
  const cssLoaderOptions = getConfig( 'css-loader.config.js' );
15
15
 
@@ -105,8 +105,10 @@ module.exports = {
105
105
  options: cssLoaderOptions,
106
106
  },
107
107
  {
108
- loader: '@lipemat/postcss-loader',
109
- options: postCSSOptions,
108
+ loader: 'postcss-loader',
109
+ options: {
110
+ postcssOptions,
111
+ },
110
112
  },
111
113
  ],
112
114
  },
@@ -3,13 +3,12 @@
3
3
  /**
4
4
  * Mimic the postcss-clean plugin.
5
5
  *
6
- * Override due to the plugin using version 4 of clean-css which
7
- * has issues with PostCSS 7 and results in inconstant CSS.
6
+ * Override due to the plugin using version 4 of clean-css, which
7
+ * has issues with PostCSS 7/8 and results in inconstant CSS.
8
8
  *
9
9
  * This may potentially be removed in favor of using that plugin again if
10
- * they change the version of PostCSS to 7 and Clean CSS to 5.
11
- * We've already tested using those versions and it works, just need the
12
- * maintainer to bump the versions.
10
+ * they change the version of PostCSS to 8 and Clean CSS to 5.
11
+ *
13
12
  * Decided to use this `lib` instead of maintaining another fork.
14
13
  *
15
14
  * @link https://www.npmjs.com/package/postcss-clean
@@ -18,25 +17,28 @@
18
17
  const postcss = require( 'postcss' );
19
18
  const CleanCss = require( 'clean-css' );
20
19
 
21
- const initializer = ( opts = {} ) => {
22
- const cleancss = new CleanCss( opts );
20
+ module.exports = ( opts = {} ) => {
21
+ const clean = new CleanCss( opts );
23
22
 
24
- return ( css, res ) => {
25
- return new Promise( ( resolve, reject ) => {
26
- cleancss.minify( css.toString(), ( err, min ) => {
27
- if ( err ) {
28
- return reject( new Error( err.join( '\n' ) ) );
29
- }
23
+ return {
24
+ postcssPlugin: 'clean',
25
+ OnceExit( css, {result} ) {
26
+ return new Promise( ( resolve, reject ) => {
27
+ clean.minify( css.toString(), ( err, min ) => {
28
+ if ( err ) {
29
+ return reject( new Error( err.join( '\n' ) ) );
30
+ }
30
31
 
31
- for ( const w of min.warnings ) {
32
- res.warn( w );
33
- }
32
+ if ( min.warnings.length > 0 ) {
33
+ return reject( new Error( 'postcss-clean minify failed! \n' + min.warnings.join( '\n' ) ) );
34
+ }
34
35
 
35
- res.root = postcss.parse( min.styles );
36
- resolve();
36
+ result.root = postcss.parse( min.styles );
37
+ resolve();
38
+ } );
37
39
  } );
38
- } );
40
+ },
39
41
  };
40
42
  };
41
43
 
42
- module.exports = postcss.plugin( 'clean', initializer );
44
+ module.exports.postcss = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lipemat/js-boilerplate",
3
- "version": "8.6.0-beta.5",
3
+ "version": "8.6.0",
4
4
  "description": "Dependencies and scripts for a no config JavaScript app",
5
5
  "author": "Mat Lipe",
6
6
  "license": "MIT",
@@ -43,9 +43,8 @@
43
43
  "@babel/preset-react": "^7.12.10",
44
44
  "@babel/preset-typescript": "^7.12.7",
45
45
  "@hot-loader/react-dom": "^17.0.1",
46
- "@lipemat/css-mqpacker": "^8.0.1",
46
+ "@lipemat/css-mqpacker": "^9.0.0-beta.2",
47
47
  "@lipemat/eslint-config": "^2.0.1",
48
- "@lipemat/postcss-loader": "^3.1.2",
49
48
  "@lipemat/webpack-cleanup-plugin": "^1.0.0",
50
49
  "@types/lipemat__js-boilerplate": "lipemat/types-js-boilerplate#semver:^1.3.0",
51
50
  "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
@@ -54,10 +53,10 @@
54
53
  "babel-jest": "^24.7.1",
55
54
  "babel-loader": "^8.2.2",
56
55
  "browserslist": "^4.17.0",
57
- "clean-css": "^5.2.1",
56
+ "clean-css": "^5.3.0",
58
57
  "core-js": "^3.8.3",
59
58
  "cross-spawn": "^6.0.5",
60
- "css-loader": "6.4.0",
59
+ "css-loader": "6.7.1",
61
60
  "enzyme": "^3.11.0",
62
61
  "enzyme-to-json": "^3.5.0",
63
62
  "fork-ts-checker-webpack-plugin": "^6.0.7",
@@ -67,26 +66,27 @@
67
66
  "jest-cli": "^26.6.3",
68
67
  "lodash": "^4.17.19",
69
68
  "mini-css-extract-plugin": "^1.3.3",
70
- "postcss": "^7.0.14",
69
+ "postcss": "^8.4.13",
71
70
  "postcss-color-mod-function": "^3.0.3",
72
- "postcss-custom-media": "^6.0.0",
73
- "postcss-import": "^12.0.1",
74
- "postcss-nested": "^4.1.2",
75
- "postcss-preset-env": "^6.6.0",
76
- "postcss-scss": "^2.0.0",
71
+ "postcss-custom-media": "^8.0.1",
72
+ "postcss-import": "^14.1.0",
73
+ "postcss-loader": "^6.2.1",
74
+ "postcss-nested": "^5.0.6",
75
+ "postcss-preset-env": "^7.5.0",
76
+ "postcss-scss": "^4.0.4",
77
77
  "react": "^17.0.1",
78
78
  "react-dom": "^17.0.1",
79
79
  "react-hot-loader": "^4.8.3",
80
80
  "react-test-renderer": "^17.0.2",
81
81
  "react-transition-group": "^4.4.1",
82
- "style-loader": "^3.2.1",
82
+ "style-loader": "^3.3.1",
83
83
  "typescript": "^4.2.4",
84
84
  "update-notifier": "^4.1.3",
85
- "webpack": "^5.65.0",
85
+ "webpack": "^5.72.1",
86
86
  "webpack-assets-manifest": "^5.0.6",
87
87
  "webpack-cli": "^4.9.1",
88
88
  "webpack-dev-server": "^4.7.2",
89
89
  "webpack-subresource-integrity": "^1.5.2"
90
90
  },
91
- "packageManager": "yarn@3.2.0"
91
+ "packageManager": "yarn@3.2.1"
92
92
  }