Skip to content

Commit

Permalink
fix(check): Check environment first
Browse files Browse the repository at this point in the history
  • Loading branch information
MHuiG committed May 24, 2022
1 parent cde5289 commit f5692dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
11 changes: 5 additions & 6 deletions scripts/events/lib/check-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ module.exports =(hexo) => {
return `title 未配置!
请在站点配置 _config.yml 中配置 title
see: https://hexo.io/zh-cn/docs/configuration
title not configured!
see: https://hexo.io/zh-cn/docs/configuration`
title is not configured!`
}
if (!config.description) {
return `description 未配置!
请在站点配置 _config.yml 中配置 description
description主要用于SEO,告诉搜索引擎一个关于您站点的简单描述,通常建议在其中包含您网站的关键词。
see: https://hexo.io/zh-cn/docs/configuration
description not configured!
see: https://hexo.io/zh-cn/docs/configuration`
description is not configured!`
}
if (themeConfig?.search?.service===`google`||themeConfig?.search?.service===`algolia`||themeConfig?.search?.service===`azure`||themeConfig?.search?.service===`baidu`) {
return `原 google, algolia, azure, baidu 站内搜索 系祖传代码, 且文档丢失, 不便后续维护 在 5.0 版本被移除
Expand All @@ -29,15 +27,16 @@ see: https://volantis.js.org/v5/theme-settings/#幻灯片背景-视差滚动效
}
if ("valinecount" in themeConfig?.article?.body?.top_meta||"valinecount" in themeConfig?.article?.body?.bottom_meta||"valinecount" in themeConfig?.article?.body?.meta_library) {
return `ValineCount 在 5.0 版本被移除
ValineCount has been removed in 5.0 version
ValineCount has been removed in version 5.0
see: https://volantis.js.org/v5/theme-settings/#文章布局配置`
}
if (themeConfig?.comments?.service=="valine"||themeConfig?.comments?.service=="minivaline") {
return `Valine 在 5.0 版本被移除
Valine has been removed in 5.0 version
Valine has been removed in version 5.0
see: https://volantis.js.org/v5/theme-settings/#选择评论系统`
}
} catch (error) {}
hexo.log.info(`Check environment configuration success!`);
return true;
};

12 changes: 5 additions & 7 deletions scripts/events/lib/check-environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ module.exports =(hexo) => {
hexo.checkEnvironment=1;
hexo.log.info(`Checking environment configuration...`);

// Checking configuration
let checkConfiguration = require('./check-configuration')(hexo);
if (checkConfiguration!==true) {
CheckConfError(hexo,checkConfiguration);
}

// Checking environment
exec('node -v', (err, stdout, stderr) => {
if (err) {
Expand All @@ -38,7 +32,11 @@ module.exports =(hexo) => {
hexo.log.info(`hexo-cli 版本:${stdout}`);
CheckError(hexo,`hexo-cli 版本过低,请升级至 4.1 以上版本!`);
}else{
hexo.log.info(`Check environment configuration success!`);
// Checking configuration
let checkConfiguration = require('./check-configuration')(hexo);
if (checkConfiguration!==true) {
CheckConfError(hexo,checkConfiguration);
}
}
}
});
Expand Down

0 comments on commit f5692dd

Please sign in to comment.