Skip to content

Commit

Permalink
fix: fs.write instead of stdout (#69)
Browse files Browse the repository at this point in the history
* fix: fs.write instead of stdout

* chore: include highlight_alias.json
  • Loading branch information
curbengh authored and tomap committed Aug 10, 2019
1 parent 52820ac commit d63fda6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"eslint": "eslint .",
"test": "mocha test/index.js",
"test-cov": "nyc npm run test",
"build:highlight": "node scripts/build_highlight_alias.js > highlight_alias.json",
"build:highlight": "node scripts/build_highlight_alias.js",
"prepare": "npm run build:highlight"
},
"directories": {
Expand All @@ -16,7 +16,8 @@
},
"files": [
"lib/",
"scripts/"
"scripts/",
"highlight_alias.json"
],
"repository": "hexojs/hexo-util",
"homepage": "https://hexo.io/",
Expand Down
8 changes: 7 additions & 1 deletion scripts/build_highlight_alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var hljs = require('highlight.js');
var languages = hljs.listLanguages();
const fs = require('fs');

var result = {
languages: languages,
Expand All @@ -21,4 +22,9 @@ languages.forEach(function(lang) {
}
});

console.log(JSON.stringify(result));
const stream = fs.createWriteStream('highlight_alias.json');
stream.write(JSON.stringify(result));
stream.on('end', () => {
stream.end();
});

0 comments on commit d63fda6

Please sign in to comment.