Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
## <small>0.5.1 (2019-06-28)</small>

* 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))
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -95,6 +95,9 @@
"*.md": "eslint"
},
"ava": {
"files": [
"test/test-*"
],
"require": [
"@babel/register"
]
Expand Down
3 changes: 1 addition & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
12 changes: 12 additions & 0 deletions test/expected/by-config/one-io-and-plugins-array/output.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>

</body>
</html>
12 changes: 12 additions & 0 deletions test/fixtures/by-config/one-io-and-plugins-array/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -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')()
]
};
13 changes: 13 additions & 0 deletions test/test-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
);
});