Skip to content

Commit

Permalink
Require Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 11, 2019
1 parent 5eedb15 commit 1117396
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ language: node_js
node_js:
- '10'
- '8'
- '6'
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
'use strict';
const {promisify} = require('util');
const through = require('through2');
const marked = require('marked');
const PluginError = require('plugin-error');

const pMarked = promisify(marked);

module.exports = options => {
return through.obj((file, encoding, callback) => {
return through.obj(async (file, encoding, callback) => {
if (file.isNull()) {
callback(null, file);
return;
Expand All @@ -15,17 +18,14 @@ module.exports = options => {
return;
}

marked(file.contents.toString(), options, (error, data) => {
if (error) {
callback(new PluginError('gulp-markdown', error, {fileName: file.path}));
return;
}

try {
const data = await pMarked(file.contents.toString(), options);
file.contents = Buffer.from(data);
file.extname = '.html';

callback(null, file);
});
} catch (error) {
callback(new PluginError('gulp-markdown', error, {fileName: file.path}));
}
});
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
Expand Down

0 comments on commit 1117396

Please sign in to comment.