chore: migrate to hexo-component-inferno 0.1.1
parent
8d7624fc69
commit
43898dd3d4
|
@ -4,6 +4,7 @@ const path = require('path');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const logger = require('hexo-log')();
|
const logger = require('hexo-log')();
|
||||||
|
const { Migrator } = require('hexo-component-inferno/lib/core/migrate');
|
||||||
|
|
||||||
module.exports = hexo => {
|
module.exports = hexo => {
|
||||||
if (!process.argv.includes('--icarus-dont-check-config')) {
|
if (!process.argv.includes('--icarus-dont-check-config')) {
|
||||||
|
@ -32,7 +33,8 @@ module.exports = hexo => {
|
||||||
let cfg = yaml.parse(cfgStr);
|
let cfg = yaml.parse(cfgStr);
|
||||||
// Check config version
|
// Check config version
|
||||||
if (!process.argv.includes('--icarus-dont-upgrade-config')) {
|
if (!process.argv.includes('--icarus-dont-upgrade-config')) {
|
||||||
const migrator = new(require('hexo-component-inferno/lib/core/migrate'))(path.join(hexo.theme_dir, 'include/migration'));
|
const head = require(path.join(hexo.theme_dir, 'include/migration/head'));
|
||||||
|
const migrator = new Migrator(head);
|
||||||
// Upgrade config
|
// Upgrade config
|
||||||
if (migrator.isOudated(cfg.version)) {
|
if (migrator.isOudated(cfg.version)) {
|
||||||
logger.info(`Your configuration file is outdated (${cfg.version} < ${migrator.getLatestVersion()}). `
|
logger.info(`Your configuration file is outdated (${cfg.version} < ${migrator.getLatestVersion()}). `
|
||||||
|
@ -57,7 +59,7 @@ module.exports = hexo => {
|
||||||
const result = schema.validate(cfg);
|
const result = schema.validate(cfg);
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
logger.warn('Configuration file failed one or more checks.');
|
logger.warn('Configuration file failed one or more checks.');
|
||||||
logger.warn('Icarus may still run, but you will encounter excepted results.');
|
logger.warn('Icarus may still run, but you will encounter unexcepted results.');
|
||||||
logger.warn('Here is some information for you to correct the configuration file.');
|
logger.warn('Here is some information for you to correct the configuration file.');
|
||||||
logger.warn(util.inspect(result));
|
logger.warn(util.inspect(result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
{
|
{
|
||||||
"$ref": "/comment/livere.json"
|
"$ref": "/comment/livere.json"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"$ref": "/comment/utterances.json"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"$ref": "/comment/valine.json"
|
"$ref": "/comment/valine.json"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
"$id": "/common/donates.json",
|
"$id": "/common/donates.json",
|
||||||
"description": "Donate plugin configurations",
|
"description": "Donate plugin configurations\nhttps://blog.zhangruipeng.me/hexo-theme-icarus/categories/Plugins/Donation/",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
"type": "object",
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"$ref": "/donate/alipay.json"
|
"$ref": "/donate/alipay.json"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const { Component, Fragment } = require('inferno');
|
const { Component, Fragment } = require('inferno');
|
||||||
const Paginator = require('hexo-component-inferno/lib/view/misc/paginator');
|
const Paginator = require('hexo-component-inferno/lib/view/misc/paginator');
|
||||||
const ArticleMedia = require('hexo-component-inferno/lib/view/common/article-media');
|
const ArticleMedia = require('hexo-component-inferno/lib/view/common/article_media');
|
||||||
|
|
||||||
module.exports = class extends Component {
|
module.exports = class extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -5,6 +5,6 @@ module.exports = class extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { site, page, helper } = this.props;
|
const { site, page, helper } = this.props;
|
||||||
|
|
||||||
return <Categories site={site} page={page} helper={helper} />;
|
return <Categories.Cacheable site={site} page={page} helper={helper} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,8 @@ module.exports = class extends Component {
|
||||||
<h3 class="title is-5">{__('article.comments')}</h3>
|
<h3 class="title is-5">{__('article.comments')}</h3>
|
||||||
{(() => {
|
{(() => {
|
||||||
try {
|
try {
|
||||||
const Comment = view.require('comment/' + comment.type);
|
let Comment = view.require('comment/' + comment.type);
|
||||||
|
Comment = Comment.Cacheable ? Comment.Cacheable : Comment;
|
||||||
return <Comment config={config} page={page} helper={helper} comment={comment} />;
|
return <Comment config={config} page={page} helper={helper} comment={comment} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load comment "${comment.type}"`);
|
logger.w(`Icarus cannot load comment "${comment.type}"`);
|
||||||
|
|
|
@ -18,7 +18,8 @@ module.exports = class extends Component {
|
||||||
const type = service.type;
|
const type = service.type;
|
||||||
if (typeof type === 'string') {
|
if (typeof type === 'string') {
|
||||||
try {
|
try {
|
||||||
const Donate = view.require('donate/' + type);
|
let Donate = view.require('donate/' + type);
|
||||||
|
Donate = Donate.Cacheable ? Donate.Cacheable : Donate;
|
||||||
return <Donate helper={helper} donate={service} />;
|
return <Donate helper={helper} donate={service} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load donate button "${type}"`);
|
logger.w(`Icarus cannot load donate button "${type}"`);
|
||||||
|
|
|
@ -14,7 +14,8 @@ module.exports = class extends Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const Plugin = view.require('plugin/' + name);
|
let Plugin = view.require('plugin/' + name);
|
||||||
|
Plugin = Plugin.Cacheable ? Plugin.Cacheable : Plugin;
|
||||||
return <Plugin site={site} config={config} page={page} helper={helper} plugin={plugins[name]} head={head} />;
|
return <Plugin site={site} config={config} page={page} helper={helper} plugin={plugins[name]} head={head} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load plugin "${name}"`);
|
logger.w(`Icarus cannot load plugin "${name}"`);
|
||||||
|
|
|
@ -11,7 +11,8 @@ module.exports = class extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const Search = view.require('search/' + search.type);
|
let Search = view.require('search/' + search.type);
|
||||||
|
Search = Search.Cacheable ? Search.Cacheable : Search;
|
||||||
return <Search config={config} helper={helper} search={search} />;
|
return <Search config={config} helper={helper} search={search} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load search "${search.type}"`);
|
logger.w(`Icarus cannot load search "${search.type}"`);
|
||||||
|
|
|
@ -11,7 +11,8 @@ module.exports = class extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const Share = view.require('share/' + share.type);
|
let Share = view.require('share/' + share.type);
|
||||||
|
Share = Share.Cacheable ? Share.Cacheable : Share;
|
||||||
return <Share config={config} page={page} helper={helper} share={share} />;
|
return <Share config={config} page={page} helper={helper} share={share} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load share button "${share.type}"`);
|
logger.w(`Icarus cannot load share button "${share.type}"`);
|
||||||
|
|
|
@ -81,7 +81,8 @@ class Widgets extends Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const Widget = view.require('widget/' + widget.type);
|
let Widget = view.require('widget/' + widget.type);
|
||||||
|
Widget = Widget.Cacheable ? Widget.Cacheable : Widget;
|
||||||
return <Widget site={site} helper={helper} config={config} page={page} widget={widget} />;
|
return <Widget site={site} helper={helper} config={config} page={page} widget={widget} />;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.w(`Icarus cannot load widget "${widget.type}"`);
|
logger.w(`Icarus cannot load widget "${widget.type}"`);
|
||||||
|
|
|
@ -5,6 +5,6 @@ module.exports = class extends Component {
|
||||||
render() {
|
render() {
|
||||||
const { site, helper } = this.props;
|
const { site, helper } = this.props;
|
||||||
|
|
||||||
return <Tags site={site} helper={helper} />;
|
return <Tags.Cacheable site={site} helper={helper} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
"bulma-stylus": "0.8.0",
|
"bulma-stylus": "0.8.0",
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"hexo": "^4.2.0",
|
"hexo": "^4.2.0",
|
||||||
"hexo-component-inferno": "^0.0.2",
|
"hexo-component-inferno": "^0.1.1",
|
||||||
"hexo-log": "^1.0.0",
|
"hexo-log": "^1.0.0",
|
||||||
"hexo-pagination": "^1.0.0",
|
"hexo-pagination": "^1.0.0",
|
||||||
"hexo-renderer-inferno": "^0.1.1",
|
"hexo-renderer-inferno": "^0.1.3",
|
||||||
"hexo-renderer-stylus": "^1.1.0",
|
"hexo-renderer-stylus": "^1.1.0",
|
||||||
"hexo-util": "^1.8.0",
|
"hexo-util": "^1.8.0",
|
||||||
"inferno": "^7.3.3",
|
"inferno": "^7.3.3",
|
||||||
|
|
Loading…
Reference in New Issue