From 1c1b3dbc231ed3ec5ce2fd6bb474025cef7d3584 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 12:19:42 +0300 Subject: [PATCH 1/7] test: when plugins array --- .../by-config/one-io-and-plugins-array/input.html | 12 ++++++++++++ .../one-io-and-plugins-array/posthtml.config.js | 7 +++++++ test/test-cli.js | 13 +++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/fixtures/by-config/one-io-and-plugins-array/input.html create mode 100644 test/fixtures/by-config/one-io-and-plugins-array/posthtml.config.js diff --git a/test/fixtures/by-config/one-io-and-plugins-array/input.html b/test/fixtures/by-config/one-io-and-plugins-array/input.html new file mode 100644 index 0000000..a148fe6 --- /dev/null +++ b/test/fixtures/by-config/one-io-and-plugins-array/input.html @@ -0,0 +1,12 @@ + + + + + + + Document + + + + + diff --git a/test/fixtures/by-config/one-io-and-plugins-array/posthtml.config.js b/test/fixtures/by-config/one-io-and-plugins-array/posthtml.config.js new file mode 100644 index 0000000..65333c4 --- /dev/null +++ b/test/fixtures/by-config/one-io-and-plugins-array/posthtml.config.js @@ -0,0 +1,7 @@ +module.exports = { + input: 'test/fixtures/by-config/one-io-and-plugins-array/input.html', + output: 'test/expected/by-config/one-io-and-plugins-array/output.html', + plugins: [ + require('posthtml-custom-elements')() + ] +}; diff --git a/test/test-cli.js b/test/test-cli.js index 3f383c0..c34ab36 100644 --- a/test/test-cli.js +++ b/test/test-cli.js @@ -188,3 +188,16 @@ test('Transform html stdin options only config one-io-by-pattern', async t => { (await read('test/fixtures/by-config/one-io-by-pattern/input-1.html')) ); }); + +test('Transform html stdin options only config one-io anf plugins array', async t => { + t.plan(2); + await execa(cli, [ + '-c', + 'test/fixtures/by-config/one-io-and-plugins-array/posthtml.config.js' + ]); + t.true(await pathExists('test/expected/by-config/one-io-and-plugins-array/output.html')); + t.is( + (await read('test/expected/by-config/one-io-and-plugins-array/output.html')), + (await read('test/fixtures/by-config/one-io-and-plugins-array/input.html')) + ); +}); From df36e4fe82ac04dc710fb018bf641c7665e71a76 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 14:38:54 +0300 Subject: [PATCH 2/7] test: expected for plugins array --- .../by-config/one-io-and-plugins-array/output.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/expected/by-config/one-io-and-plugins-array/output.html diff --git a/test/expected/by-config/one-io-and-plugins-array/output.html b/test/expected/by-config/one-io-and-plugins-array/output.html new file mode 100644 index 0000000..a148fe6 --- /dev/null +++ b/test/expected/by-config/one-io-and-plugins-array/output.html @@ -0,0 +1,12 @@ + + + + + + + Document + + + + + From f550f11d5e938f4f5bd9badd251042404877dfe7 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 14:39:18 +0300 Subject: [PATCH 3/7] fix: if plugins is array --- src/cli.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cli.js b/src/cli.js index 189fffe..8affcd7 100755 --- a/src/cli.js +++ b/src/cli.js @@ -67,8 +67,7 @@ const config = cfgResolve(cli); const processing = async file => { const output = await outResolve(file, config.output); - // const output = path.resolve(config.output, path.basename(file)); - const plugins = getPlugins(config); + const plugins = Array.isArray(config.plugins) ? config.plugins : getPlugins(config); makeDir(path.dirname(output)) .then(read.bind(null, file)) From efa1950f165213bc5377032aebc9fd0651e5bcb0 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 14:44:50 +0300 Subject: [PATCH 4/7] build: add path in test script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 004de49..4522cc5 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "build": "rimraf lib && babel src -d lib", "coverage": "nyc report --reporter=text-lcov | coveralls", "pretest": "npm run build", - "test": "nyc ava" + "test": "nyc ava test/test-*.js" }, "files": [ "lib/" From ad49a51c222fa1c9e3180c74d0624b811b073cbc Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 15:12:14 +0300 Subject: [PATCH 5/7] ci: try fix in windows --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4522cc5..ee5e5f5 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "build": "rimraf lib && babel src -d lib", "coverage": "nyc report --reporter=text-lcov | coveralls", "pretest": "npm run build", - "test": "nyc ava test/test-*.js" + "test": "nyc ava" }, "files": [ "lib/" @@ -95,6 +95,9 @@ "*.md": "eslint" }, "ava": { + "files": [ + "test/test-*" + ], "require": [ "@babel/register" ] From 603a125f1ab92d4a66840c450141679bc1b26d1d Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 15:28:29 +0300 Subject: [PATCH 6/7] build: update changelog --- changelog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changelog.md b/changelog.md index f20d3d9..8ad3922 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,21 @@ +## 0.5.1 (2019-06-28) + +* ci: try fix in windows ([ad49a51](https://github.com/posthtml/posthtml-cli/commit/ad49a51)) +* build: add path in test script ([efa1950](https://github.com/posthtml/posthtml-cli/commit/efa1950)) +* fix: if plugins is array ([f550f11](https://github.com/posthtml/posthtml-cli/commit/f550f11)) +* test: expected for plugins array ([df36e4f](https://github.com/posthtml/posthtml-cli/commit/df36e4f)) +* test: when plugins array ([1c1b3db](https://github.com/posthtml/posthtml-cli/commit/1c1b3db)) +* docs: update example ([2a7130c](https://github.com/posthtml/posthtml-cli/commit/2a7130c)) + + + ## 0.5.0 (2019-06-27) +* 0.5.0 ([0199026](https://github.com/posthtml/posthtml-cli/commit/0199026)) * build: fix linter ([50e592d](https://github.com/posthtml/posthtml-cli/commit/50e592d)) * build: npm lock to false ([43f1f4b](https://github.com/posthtml/posthtml-cli/commit/43f1f4b)) * build: perf script for changelog ([e963ea9](https://github.com/posthtml/posthtml-cli/commit/e963ea9)) +* build: update changelog ([09980f6](https://github.com/posthtml/posthtml-cli/commit/09980f6)) * build: update config for chgngelog ([de5ff40](https://github.com/posthtml/posthtml-cli/commit/de5ff40)) * build: update config for editor ([33ffa69](https://github.com/posthtml/posthtml-cli/commit/33ffa69)) * build: update depDev ([4f5cbb5](https://github.com/posthtml/posthtml-cli/commit/4f5cbb5)) From 16fbf31032a35c39713d6ffbd65309986b421cb7 Mon Sep 17 00:00:00 2001 From: Ivan Demidov Date: Fri, 28 Jun 2019 15:28:36 +0300 Subject: [PATCH 7/7] 0.5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee5e5f5..b7f4537 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "posthtml-cli", - "version": "0.5.0", + "version": "0.5.1", "description": "CLI for posthtml", "license": "MIT", "repository": "posthtml/posthtml-cli",