mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +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/
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
# Console reminder if new version released.
|
||||
reminder: false
|
||||
|
||||
# Allow to cache content generation. Introduced in NexT v6.0.0.
|
||||
cache:
|
||||
enable: true
|
||||
|
||||
@ -11,36 +11,17 @@ hexo.on('generateBefore', () => {
|
||||
require('./lib/highlight')(hexo);
|
||||
});
|
||||
|
||||
hexo.on('exit', () => {
|
||||
if (!hexo.theme.config.reminder) return;
|
||||
const https = require('https');
|
||||
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 = '';
|
||||
res.on('data', data => {
|
||||
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);
|
||||
});
|
||||
hexo.on('ready', () => {
|
||||
const { version } = require('../../package.json');
|
||||
hexo.log.info(`==================================
|
||||
███╗ ██╗███████╗██╗ ██╗████████╗
|
||||
████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝
|
||||
██╔██╗ ██║█████╗ ╚███╔╝ ██║
|
||||
██║╚██╗██║██╔══╝ ██╔██╗ ██║
|
||||
██║ ╚████║███████╗██╔╝ ██╗ ██║
|
||||
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝
|
||||
========================================
|
||||
NexT version ${version}
|
||||
Documentation: https://theme-next.js.org
|
||||
========================================`);
|
||||
});
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const keys = ['toc', 'reward_settings', 'quicklink'];
|
||||
|
||||
hexo.extend.filter.register('template_locals', locals => {
|
||||
@ -11,7 +10,7 @@ hexo.extend.filter.register('template_locals', locals => {
|
||||
const { i18n } = hexo.theme;
|
||||
// Hexo & NexT version
|
||||
locals.hexo_version = env.version;
|
||||
locals.next_version = require(path.normalize('../../package.json')).version;
|
||||
locals.next_version = require('../../package.json').version;
|
||||
// Language & Config
|
||||
locals.title = __('title') !== 'title' ? __('title') : config.title;
|
||||
locals.subtitle = __('subtitle') !== 'subtitle' ? __('subtitle') : config.subtitle;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user