Skip to content

Commit 2fad324

Browse files
authored
Merge pull request #334 from posthtml/milestone-0.9.1
Milestone 0.9.1
2 parents 70902c0 + 991588b commit 2fad324

File tree

9 files changed

+58
-29
lines changed

9 files changed

+58
-29
lines changed

changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
## <small>0.9.1 (2020-11-27)</small>
2+
3+
* build: update dep dev ([c542315](https://github.com/posthtml/posthtml-cli/commit/c542315))
4+
* perf: skip files by pattern ([0bb92bc](https://github.com/posthtml/posthtml-cli/commit/0bb92bc))
5+
* test: skip by pattern ([1dac470](https://github.com/posthtml/posthtml-cli/commit/1dac470))
6+
* docs: add open collective ([70902c0](https://github.com/posthtml/posthtml-cli/commit/70902c0))
7+
* docs: fix typo ([1b89474](https://github.com/posthtml/posthtml-cli/commit/1b89474))
8+
9+
10+
111
## 0.9.0 (2020-11-24)
212

13+
* 0.9.0 ([59bffb6](https://github.com/posthtml/posthtml-cli/commit/59bffb6))
314
* build: update dep dev ([41f89ec](https://github.com/posthtml/posthtml-cli/commit/41f89ec))
415
* docs: description for skip parse, #332 ([3cb4612](https://github.com/posthtml/posthtml-cli/commit/3cb4612)), closes [#332](https://github.com/posthtml/posthtml-cli/issues/332)
516
* feat: skip parse option, close #332 ([a77c7a1](https://github.com/posthtml/posthtml-cli/commit/a77c7a1)), closes [#332](https://github.com/posthtml/posthtml-cli/issues/332)

package-lock.json

Lines changed: 24 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posthtml-cli",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"description": "CLI for posthtml",
55
"license": "MIT",
66
"repository": "posthtml/posthtml-cli",
@@ -40,13 +40,13 @@
4040
"meow": "^7.1.1",
4141
"merge-options": "^3.0.4",
4242
"normalize-path": "^3.0.0",
43-
"posthtml": "^0.15.0",
43+
"posthtml": "^0.15.1",
4444
"to-camel-case": "^1.0.0",
4545
"update-notifier": "^5.0.0"
4646
},
4747
"devDependencies": {
4848
"@babel/cli": "^7.12.8",
49-
"@babel/core": "^7.12.8",
49+
"@babel/core": "^7.12.9",
5050
"@babel/node": "^7.10.5",
5151
"@babel/preset-env": "^7.12.7",
5252
"@babel/register": "^7.11.5",

src/cfg-resolve.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {cosmiconfigSync} from 'cosmiconfig';
33
import toCamelCase from 'to-camel-case';
44
import mergeOptions from 'merge-options';
55
import normalizePath from 'normalize-path';
6+
import fg from 'fast-glob';
67

78
export default ({input, flags = {}}) => {
89
const explorer = cosmiconfigSync('posthtml');
@@ -95,7 +96,7 @@ export default ({input, flags = {}}) => {
9596
output = normalizePath(output);
9697
}
9798

98-
skip = skip.map(file => normalizePath(path.join(path.resolve(root), file)));
99+
skip = fg.sync(skip, {cwd: path.resolve(root)}).map(file => normalizePath(path.join(path.resolve(root), file)));
99100

100101
return mergeOptions(config ?? {}, {
101102
input,

test/config/.config-skip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
'root': 'test/fixtures/input-skip',
23
'skip': 'input-skip.html'
34
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
'root': 'test/fixtures',
3+
'skip': '**/input-skip-by-pattern.html'
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<custome-element>input-skip-skip</custome-element>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div>input-skip-index</div>

test/test-cfg-resolve.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,17 @@ test('should return config when skip param from config', t => {
143143
config: 'test/config/.config-skip'
144144
};
145145
const config = cfgResolve({input, flags});
146-
const expected = [normalizePath(path.resolve('input-skip.html'))];
146+
const expected = [normalizePath(path.join(path.resolve('test/fixtures/input-skip/'), 'input-skip.html'))];
147+
t.deepEqual(config.skip, expected);
148+
});
149+
150+
test('should return config when skip param from config by pattern', t => {
151+
const input = 'input.html';
152+
const flags = {
153+
config: 'test/config/.config-skip-by-pattern'
154+
};
155+
const config = cfgResolve({input, flags});
156+
const expected = [normalizePath(path.join(path.resolve('test/fixtures/input-skip-by-pattern/'), 'input-skip-by-pattern.html'))];
147157
t.deepEqual(config.skip, expected);
148158
});
149159

0 commit comments

Comments
 (0)