From 316d1775c6e1ead0cf17968704c6b30f5c8550a7 Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 17 Sep 2020 17:40:39 -0400 Subject: [PATCH 1/4] Add PostCSS 8 plugins support --- src/plugins.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins.js b/src/plugins.js index 2db59d3..ff22254 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -56,18 +56,23 @@ const plugins = (config, file) => { if (plugins.length && plugins.length > 0) { plugins.forEach((plugin, i) => { - if (plugin.postcss) { - plugin = plugin.postcss - } - if (plugin.default) { plugin = plugin.default } + if (plugin.postcss === 1) { + plugin = plugin() + } else if (plugin.postcss) { + plugin = plugin.postcss + } + if ( // eslint-disable-next-line - !(typeof plugin === 'object' && Array.isArray(plugin.plugins) || - typeof plugin === 'function') + !( + (typeof plugin === 'object' && Array.isArray(plugin.plugins)) || + (typeof plugin === 'object' && plugin.postcssPlugin) || + (typeof plugin === 'function') + ) ) { throw new TypeError(`Invalid PostCSS Plugin found at: plugins[${i}]\n\n(@${file})`) } From 33433991afae21f0bd52fd78bf0068a301ff5299 Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 17 Sep 2020 17:46:21 -0400 Subject: [PATCH 2/4] Remove old Node.js from Travis CI --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2fd2861..882dd6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: node_js node_js: - - 'stable' - - 'lts/*' - - 6 + - stable + - "12" + - "10" script: npm run lint && npm t From 67b3a12a29b9568e6b29659e0a637ac3c26de11c Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 17 Sep 2020 17:48:22 -0400 Subject: [PATCH 3/4] Add PostCSS 8 tests --- package.json | 6 +++--- src/plugins.js | 2 +- test/js.test.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index def6276..2dd58d0 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,12 @@ "cssnano": "^4.0.0", "jest": "^24.0.0", "jsdoc-to-markdown": "^5.0.0", - "postcss": "^7.0.0", + "postcss": "^8.0.5", "postcss-import": "^12.0.0", - "postcss-nested": "^4.0.0", + "postcss-nested": "^5.0.0", "standard": "^12.0.0", "standard-version": "6.0.0", - "sugarss": "^2.0.0" + "sugarss": "^3.0.0" }, "keywords": [ "postcss", diff --git a/src/plugins.js b/src/plugins.js index ff22254..9b757b3 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -60,7 +60,7 @@ const plugins = (config, file) => { plugin = plugin.default } - if (plugin.postcss === 1) { + if (plugin.postcss === true) { plugin = plugin() } else if (plugin.postcss) { plugin = plugin.postcss diff --git a/test/js.test.js b/test/js.test.js index bc41972..cf1bb33 100644 --- a/test/js.test.js +++ b/test/js.test.js @@ -85,7 +85,7 @@ describe('postcss.config.js - {Array} - Load Config', () => { expect(config.plugins.length).toEqual(2) expect(typeof config.plugins[0]).toBe('function') - expect(typeof config.plugins[1]).toBe('function') + expect(typeof config.plugins[1]).toBe('object') expect(config.file) .toEqual(path.resolve('test/js/array', 'postcss.config.js')) From 6a34874bb451788a0afe1fffacecf6dd9c2bc3b9 Mon Sep 17 00:00:00 2001 From: Andrey Sitnik Date: Thu, 17 Sep 2020 17:53:10 -0400 Subject: [PATCH 4/4] Update Node.js version on AppVeyor --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d86beb1..093120a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,5 +19,5 @@ test_script: environment: matrix: - nodejs_version: 'stable' - - nodejs_version: 'lts' - - nodejs_version: '6' + - nodejs_version: '12' + - nodejs_version: '10'