Skip to content

Commit e4f2a57

Browse files
authored
Merge pull request #20 from posthtml/milestone-1.2.0
Milestone 1.2.0
2 parents b0c8eee + f0a1f89 commit e4f2a57

5 files changed

Lines changed: 49 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
# NODEJS
66
node_modules
77
npm-debug.log
8+
9+
coverage

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: node_js
2+
3+
node_js:
4+
- "stable"
5+
- "lts/*"
6+
- 6
7+
- 4
8+
- 0.12
9+
10+
env:
11+
global:
12+
- ISTANBUL_COVERAGE: yes
13+
14+
after_success:
15+
- npm i coveralls
16+
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,20 @@ module.exports = function(options) {
1717

1818
if (typeof options.addDependencyTo === 'object' &&
1919
typeof options.addDependencyTo.addDependency === 'function') {
20+
console.warn([
21+
"addDependencyTo is deprecated in favor of",
22+
"result.messages.dependency; posthtml-loader >= v1.0.1 will",
23+
"automatically add your imported files to webpack's file watcher."
24+
].join("\n"));
2025
options.addDependencyTo.addDependency(src);
2126
}
27+
28+
if (tree.messages) {
29+
tree.messages.push({
30+
type: "dependency",
31+
file: src
32+
});
33+
}
2234
}
2335
return {
2436
tag: false,

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
22
"name": "posthtml-include",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Include file in HTML",
55
"main": "index.js",
66
"dependencies": {
77
"posthtml-parser": "^0.1.1"
88
},
99
"devDependencies": {
1010
"chai": "^3.2.0",
11+
"istanbul": "^0.4.5",
1112
"jscs": "^1.13.1",
1213
"jshint": "^2.8.0",
1314
"mocha": "^2.2.5",
14-
"posthtml": "^0.8.1"
15+
"posthtml": "^0.11.3"
1516
},
1617
"scripts": {
17-
"test": "npm run lint && mocha",
18+
"test": "npm run lint && mocha -R dot && npm run cover",
1819
"lint": "jshint . && jscs . -v",
20+
"cover": "istanbul cover --report text --report html --report lcov node_modules/mocha/bin/_mocha -- -R tap",
1921
"preversion": "npm test",
2022
"postversion": "git push && git push --tags"
2123
},

test/test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,18 @@ describe('Simple test', function() {
5050
.use(plugin({ addDependencyTo: { addDependency: test }}))
5151
.process('<include src="./test/blocks/button/button.html">');
5252
});
53+
54+
it('messages dependency for addDependency', function(done) {
55+
var includePath = require('path').resolve('./test/blocks/button/button.html');
56+
57+
posthtml()
58+
.use(plugin())
59+
.process('<include src="./test/blocks/button/button.html">')
60+
.then(function(result) {
61+
expect(result.messages[0].file).to.eql(includePath);
62+
done();
63+
}).catch(function(error) {
64+
done(error);
65+
});
66+
});
5367
});

0 commit comments

Comments
 (0)