Skip to content

Commit

Permalink
Merge pull request #291 from posthtml/milestone-0.5.1
Browse files Browse the repository at this point in the history
Milestone 0.5.1
  • Loading branch information
Scrum authored Jun 28, 2019
2 parents 2a7130c + 16fbf31 commit cc177e6
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 3 deletions.
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:/posthtml/posthtml-cli/commit/ad49a51))
* build: add path in test script ([efa1950](https:/posthtml/posthtml-cli/commit/efa1950))
* fix: if plugins is array ([f550f11](https:/posthtml/posthtml-cli/commit/f550f11))
* test: expected for plugins array ([df36e4f](https:/posthtml/posthtml-cli/commit/df36e4f))
* test: when plugins array ([1c1b3db](https:/posthtml/posthtml-cli/commit/1c1b3db))
* docs: update example ([2a7130c](https:/posthtml/posthtml-cli/commit/2a7130c))



## 0.5.0 (2019-06-27)

* 0.5.0 ([0199026](https:/posthtml/posthtml-cli/commit/0199026))
* build: fix linter ([50e592d](https:/posthtml/posthtml-cli/commit/50e592d))
* build: npm lock to false ([43f1f4b](https:/posthtml/posthtml-cli/commit/43f1f4b))
* build: perf script for changelog ([e963ea9](https:/posthtml/posthtml-cli/commit/e963ea9))
* build: update changelog ([09980f6](https:/posthtml/posthtml-cli/commit/09980f6))
* build: update config for chgngelog ([de5ff40](https:/posthtml/posthtml-cli/commit/de5ff40))
* build: update config for editor ([33ffa69](https:/posthtml/posthtml-cli/commit/33ffa69))
* build: update depDev ([4f5cbb5](https:/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'))
);
});

0 comments on commit cc177e6

Please sign in to comment.