Skip to content

Commit

Permalink
refactor(*): use hexo-component-inferno
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoffice committed Jan 23, 2020
1 parent e3737f5 commit fe70756
Show file tree
Hide file tree
Showing 130 changed files with 75 additions and 3,894 deletions.
6 changes: 3 additions & 3 deletions include/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = hexo => {
const SCHEMA_ROOT = path.join(hexo.theme_dir, 'include/schema/');
const CONFIG_PATH = path.join(hexo.theme_dir, '_config.yml');

const yaml = require('../include/util/yaml');
const { SchemaLoader } = require('../include/util/schema');
const yaml = require('hexo-component-inferno/lib/util/yaml');
const { SchemaLoader } = require('hexo-component-inferno/lib/core/schema');
const loader = SchemaLoader.load(require(path.join(SCHEMA_ROOT, 'config.json')), SCHEMA_ROOT);
const schema = loader.getSchema('/config.json');
logger.info('=== Checking the configuration file ===');
Expand All @@ -32,7 +32,7 @@ module.exports = hexo => {
let cfg = yaml.parse(cfgStr);
// Check config version
if (!process.argv.includes('--icarus-dont-upgrade-config')) {
const migrator = new(require('../include/util/migrate'))(path.join(hexo.theme_dir, 'include/migration'));
const migrator = new(require('hexo-component-inferno/lib/core/migrate'))(path.join(hexo.theme_dir, 'include/migration'));
// Upgrade config
if (migrator.isOudated(cfg.version)) {
logger.info(`Your configuration file is outdated (${cfg.version} < ${migrator.getLatestVersion()}). `
Expand Down
66 changes: 0 additions & 66 deletions include/filter/locals.js

This file was deleted.

14 changes: 0 additions & 14 deletions include/generator/categories.js

This file was deleted.

14 changes: 0 additions & 14 deletions include/generator/tags.js

This file was deleted.

99 changes: 0 additions & 99 deletions include/helper/cdn.js

This file was deleted.

16 changes: 0 additions & 16 deletions include/helper/page.js

This file was deleted.

24 changes: 0 additions & 24 deletions include/helper/thumbnail.js

This file was deleted.

4 changes: 2 additions & 2 deletions include/migration/v2_v3.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const logger = require('hexo-log')();
const deepmerge = require('deepmerge');
const Migration = require('../util/migrate').Migration;
const Migration = require('hexo-component-inferno/lib/core/migrate').Migration;

module.exports = class extends Migration {
constructor() {
super('3.0.0', null);
}

doMigrate(config) {
upgrade(config) {
const result = deepmerge({}, config);
result.head = {
favicon: config.favicon || null,
Expand Down
19 changes: 10 additions & 9 deletions include/register.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const logger = require('hexo-log')();

module.exports = hexo => {
logger.info('=== Patching Hexo ===');
require('../include/generator/categories')(hexo);
require('../include/generator/category')(hexo);
require('../include/generator/tags')(hexo);
require('../include/generator/insight')(hexo);
require('../include/filter/locals')(hexo);
require('../include/helper/cdn')(hexo);
require('../include/helper/page')(hexo);
require('../include/helper/thumbnail')(hexo);
logger.info('=== Registering Hexo extensions ===');
require('hexo-component-inferno/lib/hexo/filter/locals')(hexo);
require('./generator/category')(hexo);
require('./generator/insight')(hexo);
require('hexo-component-inferno/lib/hexo/generator/categories')(hexo);
require('hexo-component-inferno/lib/hexo/generator/tags')(hexo);
require('hexo-component-inferno/lib/hexo/helper/cdn')(hexo);
require('hexo-component-inferno/lib/hexo/helper/page')(hexo);
require('hexo-component-inferno/lib/hexo/helper/thumbnail')(hexo);
require('hexo-component-inferno/lib/core/view').init(hexo);

const hooks = [
'after_render:html',
Expand Down
Empty file added include/schema/comment/.gitkeep
Empty file.
25 changes: 0 additions & 25 deletions include/schema/comment/changyan.json

This file was deleted.

20 changes: 0 additions & 20 deletions include/schema/comment/disqus.json

This file was deleted.

Loading

0 comments on commit fe70756

Please sign in to comment.