Skip to content

Commit

Permalink
fix: remove hexo-util due to version match
Browse files Browse the repository at this point in the history
  • Loading branch information
zthxxx committed Apr 30, 2020
1 parent 766cb81 commit 3378ec3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 73 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Expand Up @@ -25,6 +25,7 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 13.x
registry-url: https://registry.npmjs.org

- name: Install
run: |
Expand Down
12 changes: 8 additions & 4 deletions lib/processor/post.js
@@ -1,7 +1,11 @@
/**
* mirror from https://github.com/hexojs/hexo/blob/4.2.1/lib/plugins/processor/post.js
*
* add line `categories = autoClassify(config, data, categories);`
* - add line `categories = autoClassify(config, data, categories);`
*
* - remove hexo-util `Pattern`,
* because hexo-util version may not match hexo/node_modules/hexo-util,
* and will cause a error within `new Pattern(new Pattern())`
*/
'use strict';

Expand All @@ -10,7 +14,7 @@ const Promise = require('bluebird');
const yfm = require('hexo-front-matter');
const { extname, join } = require('path');
const { stat, listDir } = require('hexo-fs');
const { slugize, Pattern, Permalink } = require('hexo-util');
const { slugize, Permalink } = require('hexo-util');
const autoClassify = require('../classify');

const postDir = '_posts/';
Expand Down Expand Up @@ -217,7 +221,7 @@ module.exports = ctx => {
}

return {
pattern: new Pattern(path => {
pattern: path => {
if (isTmpFile(path)) return;

let result;
Expand All @@ -238,7 +242,7 @@ module.exports = ctx => {

result.renderable = ctx.render.isRenderable(path) && !isMatch(path, ctx.config.skip_render);
return result;
}),
},

process: function postProcessor(file) {
if (file.params.renderable) {
Expand Down
69 changes: 3 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "hexo-directory-category",
"version": "1.1.2",
"version": "1.1.3",
"description": "Automatically add category to Hexo article according to the article file directory.",
"main": "index",
"scripts": {
Expand Down Expand Up @@ -43,7 +43,6 @@
"bluebird": "^3.7.2",
"hexo-front-matter": "^1.0.0",
"hexo-fs": "^3.1.0",
"hexo-util": "^2.2.0",
"micromatch": "^4.0.2",
"moment-timezone": "^0.5.31",
"object-assign": "^4.1.1"
Expand All @@ -55,6 +54,7 @@
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
"gulp-mocha": "^7.0.2",
"hexo": "^4.2.1"
"hexo": "^4.2.1",
"hexo-util": "^2.2.0"
}
}

0 comments on commit 3378ec3

Please sign in to comment.