Skip to content

Commit

Permalink
Display warning message only once
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jun 5, 2023
1 parent b9ba532 commit 824885e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/events/lib/vendors.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ module.exports = hexo => {
if (typeof internal === 'function') {
internal(hexo, dependencies);
}
let { plugins = 'cdnjs' } = vendors;
if (plugins === 'local' && typeof internal === 'undefined') {
hexo.log.warn('Dependencies for `plugins: local` not found. The default CDN provider CDNJS is used instead.');
hexo.log.warn('Run `npm install @next-theme/plugins` in Hexo site root directory to install the plugin.');
plugins = 'cdnjs';
}
for (const [key, value] of Object.entries(dependencies)) {
// This script will be executed repeatedly when Hexo listens file changes
// But the variable vendors[key] only needs to be modified once
Expand All @@ -41,12 +47,6 @@ module.exports = hexo => {
local : url_for.call(hexo, `lib/${name}/${file}`),
custom : vendors.custom_cdn_url
});
let { plugins = 'cdnjs' } = vendors;
if (plugins === 'local' && typeof internal === 'undefined') {
hexo.log.warn('Dependencies for `plugins: local` not found. The default CDN provider CDNJS is used instead.');
hexo.log.warn('Run `npm install @next-theme/plugins` in Hexo site root directory to install the plugin.');
plugins = 'cdnjs';
}
vendors[key] = {
url : links[plugins] || links.cdnjs,
integrity: value.integrity
Expand Down

0 comments on commit 824885e

Please sign in to comment.