mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Remove console reminder
* Revert https://github.com/theme-next/hexo-theme-next/pull/343 * Revert https://github.com/theme-next/hexo-theme-next/pull/1002
This commit is contained in:
parent
4537262c51
commit
533fea7777
@ -9,9 +9,6 @@
|
|||||||
# See: https://theme-next.js.org/docs/theme-settings/
|
# See: https://theme-next.js.org/docs/theme-settings/
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# Console reminder if new version released.
|
|
||||||
reminder: false
|
|
||||||
|
|
||||||
# Allow to cache content generation. Introduced in NexT v6.0.0.
|
# Allow to cache content generation. Introduced in NexT v6.0.0.
|
||||||
cache:
|
cache:
|
||||||
enable: true
|
enable: true
|
||||||
|
|||||||
@ -11,36 +11,17 @@ hexo.on('generateBefore', () => {
|
|||||||
require('./lib/highlight')(hexo);
|
require('./lib/highlight')(hexo);
|
||||||
});
|
});
|
||||||
|
|
||||||
hexo.on('exit', () => {
|
hexo.on('ready', () => {
|
||||||
if (!hexo.theme.config.reminder) return;
|
const { version } = require('../../package.json');
|
||||||
const https = require('https');
|
hexo.log.info(`==================================
|
||||||
const path = require('path');
|
███╗ ██╗███████╗██╗ ██╗████████╗
|
||||||
const { version } = require(path.normalize('../../package.json'));
|
████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝
|
||||||
https.get('https://registry.npmjs.org/hexo-theme-next/latest', {
|
██╔██╗ ██║█████╗ ╚███╔╝ ██║
|
||||||
headers: {
|
██║╚██╗██║██╔══╝ ██╔██╗ ██║
|
||||||
'User-Agent': 'Theme NexT Client'
|
██║ ╚████║███████╗██╔╝ ██╗ ██║
|
||||||
}
|
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝
|
||||||
}, res => {
|
========================================
|
||||||
let result = '';
|
NexT version ${version}
|
||||||
res.on('data', data => {
|
Documentation: https://theme-next.js.org
|
||||||
result += data;
|
========================================`);
|
||||||
});
|
|
||||||
res.on('end', () => {
|
|
||||||
try {
|
|
||||||
const latest = JSON.parse(result).version;
|
|
||||||
if (latest !== version) {
|
|
||||||
hexo.log.warn(`Your theme NexT is outdated. Current version: v${version}, latest version: v${latest}`);
|
|
||||||
hexo.log.warn('Visit https://github.com/next-theme/hexo-theme-next/releases for more information.');
|
|
||||||
} else {
|
|
||||||
hexo.log.info('Congratulations! Your are using the latest version of theme NexT.');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
hexo.log.error('Failed to detect version info. Error message:');
|
|
||||||
hexo.log.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}).on('error', err => {
|
|
||||||
hexo.log.error('Failed to detect version info. Error message:');
|
|
||||||
hexo.log.error(err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const path = require('path');
|
|
||||||
const keys = ['toc', 'reward_settings', 'quicklink'];
|
const keys = ['toc', 'reward_settings', 'quicklink'];
|
||||||
|
|
||||||
hexo.extend.filter.register('template_locals', locals => {
|
hexo.extend.filter.register('template_locals', locals => {
|
||||||
@ -11,7 +10,7 @@ hexo.extend.filter.register('template_locals', locals => {
|
|||||||
const { i18n } = hexo.theme;
|
const { i18n } = hexo.theme;
|
||||||
// Hexo & NexT version
|
// Hexo & NexT version
|
||||||
locals.hexo_version = env.version;
|
locals.hexo_version = env.version;
|
||||||
locals.next_version = require(path.normalize('../../package.json')).version;
|
locals.next_version = require('../../package.json').version;
|
||||||
// Language & Config
|
// Language & Config
|
||||||
locals.title = __('title') !== 'title' ? __('title') : config.title;
|
locals.title = __('title') !== 'title' ? __('title') : config.title;
|
||||||
locals.subtitle = __('subtitle') !== 'subtitle' ? __('subtitle') : config.subtitle;
|
locals.subtitle = __('subtitle') !== 'subtitle' ? __('subtitle') : config.subtitle;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user