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)) diff --git a/package.json b/package.json index 004de49..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", @@ -95,6 +95,9 @@ "*.md": "eslint" }, "ava": { + "files": [ + "test/test-*" + ], "require": [ "@babel/register" ] 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)) 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 + + + + + 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')) + ); +});