Skip to content

Commit 531a0c8

Browse files
authored
Merge pull request #258 from posthtml/milestone-0.3.1
Milestone 0.3.1
2 parents 5b93cc8 + 018f46d commit 531a0c8

7 files changed

Lines changed: 5882 additions & 1369 deletions

File tree

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[{package.json,*.yml,*.jade,*.pss,*.css}]
11+
[{package.json,*.yml,*.jade,*.pss,*.css,*.js}]
1212
indent_size = 2
1313

1414
[*.md]

changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
<a name="0.3.1"></a>
2+
## 0.3.1 (2017-10-10)
3+
4+
* 0.3.1 ([71ea44d](https://github.com/posthtml/posthtml-cli/commit/71ea44d))
5+
* chore: add lint-staged ([90e21f8](https://github.com/posthtml/posthtml-cli/commit/90e21f8))
6+
* chore: lock ([1640193](https://github.com/posthtml/posthtml-cli/commit/1640193))
7+
* chore: space for js according to standard ([c4c4e82](https://github.com/posthtml/posthtml-cli/commit/c4c4e82))
8+
* chore: update changelint ([065d8b9](https://github.com/posthtml/posthtml-cli/commit/065d8b9))
9+
* chore: update depDev ([44e08e6](https://github.com/posthtml/posthtml-cli/commit/44e08e6))
10+
* chore(changelog): Update changelog ([56852a3](https://github.com/posthtml/posthtml-cli/commit/56852a3))
11+
* fix: config file without extension, close #255 ([25c6bb0](https://github.com/posthtml/posthtml-cli/commit/25c6bb0)), closes [#255](https://github.com/posthtml/posthtml-cli/issues/255)
12+
* fix: incorrect argument, close #257 ([68ee0b2](https://github.com/posthtml/posthtml-cli/commit/68ee0b2)), closes [#257](https://github.com/posthtml/posthtml-cli/issues/257)
13+
* test: add for issue #255 ([44e1f7c](https://github.com/posthtml/posthtml-cli/commit/44e1f7c))
14+
* style: remove consloe log, close #254 ([682215c](https://github.com/posthtml/posthtml-cli/commit/682215c)), closes [#254](https://github.com/posthtml/posthtml-cli/issues/254)
15+
* perf: not need function for get version from pkg ([563002b](https://github.com/posthtml/posthtml-cli/commit/563002b))
16+
17+
18+
119
<a name="0.3.0"></a>
220
# 0.3.0 (2017-06-01)
321

cli.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ var argv = require('yargs')
1515
.alias('u', 'use')
1616
.array('use')
1717
.pkgConf('posthtml')
18-
.config()
19-
.alias('c', 'config')
20-
.version(function () {
21-
return require('./package.json').version
18+
.config('config', function (config) {
19+
return JSON.parse(fs.readFileSync(config, 'utf-8'))
2220
})
21+
.alias('c', 'config')
22+
.version()
2323
.alias('v', 'version')
2424
.help('h')
2525
.alias('h', 'help')
@@ -38,16 +38,15 @@ function processing(file, output) {
3838
// get htmls
3939
var html = fs.readFileSync(file, 'utf8')
4040
var plugins;
41-
42-
console.log(argv);
41+
var fileConfig = argv.config && JSON.parse(fs.readFileSync(argv.config, 'utf-8'));
4342

4443
if (argv.autoOff) {
4544
var use = argv.use ? argv.use : [];
46-
var cfg = argv.config ? Object.keys(require(path.resolve(argv.config))) : [];
45+
var cfg = argv.config ? Object.keys(fileConfig) : [];
4746
plugins = [].concat(use, cfg).map((plugin) => {
4847
try {
4948
return require(plugin)(argv[plugin])
50-
} catch (e) {
49+
} catch (err) {
5150
if (err.code === 'MODULE_NOT_FOUND') {
5251
throw new TypeError('Plugin Error: Cannot find module ' + plugin);
5352
}
@@ -65,7 +64,7 @@ function processing(file, output) {
6564
}
6665

6766
if (argv.config) {
68-
config = Object.assign(require(path.resolve(argv.config)), config)
67+
config = Object.assign(fileConfig, config)
6968
}
7069
}
7170

0 commit comments

Comments
 (0)