From d932e308d4a360077469707214fcdb1ff86ab444 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Sun, 22 May 2022 01:53:07 +0800 Subject: [PATCH] Update docs & warning --- README.md | 7 +++---- docs/ru/README.md | 7 +++---- docs/zh-CN/README.md | 7 +++---- scripts/events/lib/vendors.js | 10 +++++++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d8389dc..e9d3f12 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Linter?label=test&logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Tester?logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) [![Coverage Status](https://img.shields.io/coveralls/github/next-theme/hexo-theme-next?logo=coveralls&style=flat-square)](https://coveralls.io/github/next-theme/hexo-theme-next) -[![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/hexo-theme-next?logo=jsdelivr&logoColor=white&style=flat-square)](https://www.jsdelivr.com/package/npm/hexo-theme-next) ## Live Preview @@ -74,7 +73,7 @@ pjax: true ### Configure CDN -Third-party plugins are loaded from [jsDelivr](https://www.jsdelivr.com) CDN by default. We also provide other optional CDNs, including the famous [UNPKG](https://unpkg.com) and [CDNJS](https://cdnjs.com). +Third-party plugins are loaded from [CDNJS](https://cdnjs.com) CDN by default. We also provide other optional CDNs, including the famous [UNPKG](https://unpkg.com) and [jsDelivr](https://www.jsdelivr.com). For example, if you want to use `unpkg` instead of `jsdelivr` as the default CDN provider, you need to edit the following settings in NexT config file: @@ -141,9 +140,9 @@ Also, we welcome Issue or PR to our [official-plugins][official-plugins-url]. > Crowdin allows us to translate conveniently the documentation. - + -> Thanks jsDelivr for providing public CDN service. +> Thanks CDNJS for providing public CDN service. [docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html [docs-configuration-url]: https://theme-next.js.org/docs/getting-started/configuration.html diff --git a/docs/ru/README.md b/docs/ru/README.md index d6e53f8..9dc4e09 100644 --- a/docs/ru/README.md +++ b/docs/ru/README.md @@ -19,7 +19,6 @@ [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Linter?label=test&logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Tester?logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) [![Coverage Status](https://img.shields.io/coveralls/github/next-theme/hexo-theme-next?logo=coveralls&style=flat-square)](https://coveralls.io/github/next-theme/hexo-theme-next) -[![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/hexo-theme-next?logo=jsdelivr&logoColor=white&style=flat-square)](https://www.jsdelivr.com/package/npm/hexo-theme-next) ## Демо @@ -74,7 +73,7 @@ pjax: true ### Configure CDN -Third-party plugins are loaded from [jsDelivr](https://www.jsdelivr.com) CDN by default. We also provide other optional CDNs, including the famous [UNPKG](https://unpkg.com) and [CDNJS](https://cdnjs.com). +Third-party plugins are loaded from [CDNJS](https://cdnjs.com) CDN by default. We also provide other optional CDNs, including the famous [UNPKG](https://unpkg.com) and [jsDelivr](https://www.jsdelivr.com). For example, if you want to use `unpkg` instead of `jsdelivr` as the default CDN provider, you need to edit the following settings in NexT config file: @@ -141,9 +140,9 @@ Also, we welcome Issue or PR to our [official-plugins][official-plugins-url]. > Crowdin allows us to translate conveniently the documentation. - + -> Thanks jsDelivr for providing public CDN service. +> Thanks CDNJS for providing public CDN service. [docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html [docs-configuration-url]: https://theme-next.js.org/docs/getting-started/configuration.html diff --git a/docs/zh-CN/README.md b/docs/zh-CN/README.md index d6d4a32..ed4a966 100644 --- a/docs/zh-CN/README.md +++ b/docs/zh-CN/README.md @@ -19,7 +19,6 @@ [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Linter?label=test&logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) [![Build Status](https://img.shields.io/github/workflow/status/next-theme/hexo-theme-next/Tester?logo=github&style=flat-square)](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) [![Coverage Status](https://img.shields.io/coveralls/github/next-theme/hexo-theme-next?logo=coveralls&style=flat-square)](https://coveralls.io/github/next-theme/hexo-theme-next) -[![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/hexo-theme-next?logo=jsdelivr&logoColor=white&style=flat-square)](https://www.jsdelivr.com/package/npm/hexo-theme-next) ## 即时预览 @@ -74,7 +73,7 @@ pjax: true ### 设置 CDN -第三方插件默认通过 [jsDelivr](https://www.jsdelivr.com) CDN 服务加载。我们也提供了其它的 CDN 服务供选择,包括著名的 [UNPKG](https://unpkg.com) 和 [CDNJS](https://cdnjs.com)。 +第三方插件默认通过 [CDNJS](https://cdnjs.com) CDN 服务加载。我们也提供了其它的 CDN 服务供选择,包括著名的 [UNPKG](https://unpkg.com) 和 [jsDelivr](https://www.jsdelivr.com)。 例如,你想要使用 `unpkg` 代替 `jsdelivr` 作为默认的 CDN 提供商,你需要在 NexT 配置文件中进行如下设置: @@ -141,9 +140,9 @@ $ git pull > Crowdin 容许我们方便地翻译文档。 - + -> jsDelivr 提供了 CDN 服务。 +> 感谢 CDNJS 提供的 CDN 服务。 [docs-installation-url]: https://theme-next.js.org/docs/getting-started/installation.html [docs-configuration-url]: https://theme-next.js.org/docs/getting-started/configuration.html diff --git a/scripts/events/lib/vendors.js b/scripts/events/lib/vendors.js index e727bad..af47027 100644 --- a/scripts/events/lib/vendors.js +++ b/scripts/events/lib/vendors.js @@ -41,10 +41,14 @@ module.exports = hexo => { local : url_for.call(hexo, `lib/${name}/${file}`), custom : vendors.custom_cdn_url }); - let { plugins = 'jsdelivr' } = vendors; - if (plugins === 'local' && typeof internal === 'undefined') plugins = 'jsdelivr'; + 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.jsdelivr, + url : links[plugins] || links.cdnjs, integrity: value.integrity }; }