From bc1e2b64dce012230c5db63531de2fc155609ea4 Mon Sep 17 00:00:00 2001 From: Nexmoe <16796652+nexmoe@users.noreply.github.com> Date: Sat, 14 Oct 2023 23:55:34 +0800 Subject: [PATCH] refactor: JSX (#286) --- .eslintignore | 2 + .eslintrc.json | 69 + .github/ISSUE_TEMPLATE/bug_report_en.md | 40 +- .github/ISSUE_TEMPLATE/bug_report_zh.md | 40 +- .github/ISSUE_TEMPLATE/feature_request_en.md | 28 +- .github/ISSUE_TEMPLATE/feature_request_zh.md | 28 +- .github/release-drafter.yml | 62 +- .github/workflows/npm-publish.yml | 44 +- .github/workflows/release-drafter.yml | 64 +- .gitignore | 30 +- LICENSE | 402 +- README.md | 80 +- crowdin.yml | 12 +- include/config.js | 79 +- include/dependency.js | 15 +- include/register.js | 4 +- languages/default.yml | 38 +- languages/en.yml | 34 +- languages/it.yml | 34 +- languages/ja.yml | 34 +- languages/zh-CN.yml | 38 +- languages/zh-HK.yml | 34 +- languages/zh-TW.yml | 34 +- languages/zh.yml | 34 +- layout/_index/list.ejs | 44 +- layout/_layout/nexmoe/body.jsx | 56 +- layout/_layout/nexmoe/content.jsx | 20 +- layout/_layout/nexmoe/footer.jsx | 14 +- layout/_layout/nexmoe/header.ejs | 66 +- layout/_layout/xiaoshu/body.jsx | 56 +- layout/_layout/xiaoshu/content.jsx | 10 +- layout/_layout/xiaoshu/footer.jsx | 46 +- layout/_layout/xiaoshu/header.jsx | 46 +- layout/_partial/_post/copyright.ejs | 22 +- layout/_partial/_post/meta.ejs | 68 +- layout/_partial/_post/tag.ejs | 20 +- layout/_partial/_post/word-count.ejs | 6 +- layout/_partial/background.jsx | 68 +- layout/_partial/head.ejs | 116 +- layout/_partial/paginator.jsx | 32 +- layout/_partial/right.ejs | 40 +- layout/_partial/searchbox.ejs | 32 +- layout/_widget/archive.ejs | 18 +- layout/_widget/category.ejs | 184 +- layout/_widget/hitokoto.ejs | 80 +- layout/_widget/link.ejs | 52 +- layout/_widget/recent_posts.ejs | 26 +- layout/_widget/search.ejs | 64 +- layout/_widget/social.ejs | 36 +- layout/_widget/tag.ejs | 16 +- layout/_widget/tagcloud.ejs | 46 +- layout/archives.ejs | 110 +- layout/index.jsx | 28 +- layout/layout.jsx | 64 +- layout/post.ejs | 70 +- layout/py.jsx | 40 +- package-lock.json | 7309 ++++++++ package.json | 23 +- pnpm-lock.yaml | 5651 ------ renovate.json | 10 +- scripts/helper/css_auto_version.js | 33 +- scripts/helper/image_filter.js | 27 +- scripts/helper/js_auto_version.js | 33 +- scripts/index.js | 3 +- scripts/tag/gallery.js | 54 +- scripts/tag/links.js | 65 +- source/_config.yml | 292 +- source/css/_index/list.styl | 326 +- source/css/_layout/nexmoe/content.styl | 66 +- source/css/_layout/nexmoe/header.styl | 332 +- source/css/_layout/xiaoshu/content.styl | 24 +- source/css/_layout/xiaoshu/footer.styl | 14 +- source/css/_layout/xiaoshu/header.styl | 60 +- source/css/_partial/archives.styl | 296 +- source/css/_partial/article.styl | 1170 +- source/css/_partial/background.styl | 56 +- source/css/_partial/pagination.styl | 60 +- source/css/_partial/py.styl | 178 +- source/css/_partial/searchbox.styl | 194 +- source/css/_widget/hitokoto.styl | 76 +- source/css/_widget/index.styl | 228 +- source/css/style.styl | 638 +- source/js/app.js | 126 +- source/js/copy-codeblock.js | 101 +- source/js/search.js | 22 +- source/lib/fancybox/fancybox.umd.js | 2 +- source/lib/iconfont/demo.css | 1078 +- source/lib/iconfont/demo_index.html | 1952 +- source/lib/iconfont/iconfont.css | 314 +- source/lib/iconfont/iconfont.js | 2 +- source/lib/iconfont/iconfont.json | 508 +- source/lib/iconfont/iconfont.svg | 262 +- source/lib/lax.min.js | 2 +- source/lib/mdui_043tiny/mdui.css | 16078 ++++++++--------- source/lib/mdui_043tiny/mdui.js | 11035 +++++------ source/preset/plain.styl | 36 +- 96 files changed, 26672 insertions(+), 24939 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 package-lock.json delete mode 100644 pnpm-lock.yaml diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..2b4f0de7a --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules/ +source \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..6b4805b3c --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,69 @@ +{ + "extends": [ + "hexo", + "plugin:react/recommended", + "plugin:json/recommended" + ], + "settings": { + "node": { + "tryExtensions": [ + ".js", + ".jsx", + ".json" + ] + }, + "react": { + "version": "16.0" + } + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "sourceType": "module", + "ecmaVersion": "latest" + }, + "plugins": [ + "react" + ], + "rules": { + "react/jsx-uses-vars": "error", + "indent": [ + "error", + 4, + { + "SwitchCase": 1 + } + ], + "react/no-unknown-property": [ + "error", + { + "ignore": [ + "class", + "onclick", + "onload", + "onsubmit", + "crossorigin" + ] + } + ], + "react/react-in-jsx-scope": [ + "off" + ], + "react/prop-types": [ + "off" + ], + "react/display-name": [ + "off" + ], + "react/jsx-key": [ + "off" + ], + "react/jsx-no-target-blank": [ + "error", + { + "allowReferrer": true + } + ] + } +} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report_en.md b/.github/ISSUE_TEMPLATE/bug_report_en.md index 6a982eefc..766cfcfa7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_en.md +++ b/.github/ISSUE_TEMPLATE/bug_report_en.md @@ -1,21 +1,21 @@ ---- -name: 🛠Bug Report -about: Submit discovered bugs ---- - - - -### BUG occurrence address - -### What is expected? - -### What is actually happening? - -### Additional info (logs errors etc) - - + +### BUG occurrence address + +### What is expected? + +### What is actually happening? + +### Additional info (logs errors etc) + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.md b/.github/ISSUE_TEMPLATE/bug_report_zh.md index b4e8c7230..a8d7a4f7e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_zh.md +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.md @@ -1,21 +1,21 @@ ---- -name: 🛠Bug 报告 -about: 早起的虫å­è¢«ä½ æŠ“ ---- - - - -### BUG å‘ç”Ÿåœ°å€ - -### 预期是什么? - -### 实际å‘生了什么? - -### é¢å¤–ä¿¡æ¯ï¼ˆæ—¥å¿—ã€æŠ¥é”™ç­‰ï¼‰ - - + +### BUG å‘ç”Ÿåœ°å€ + +### 预期是什么? + +### 实际å‘生了什么? + +### é¢å¤–ä¿¡æ¯ï¼ˆæ—¥å¿—ã€æŠ¥é”™ç­‰ï¼‰ + + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request_en.md b/.github/ISSUE_TEMPLATE/feature_request_en.md index 2f0332a97..6919449e1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_en.md +++ b/.github/ISSUE_TEMPLATE/feature_request_en.md @@ -1,15 +1,15 @@ ---- -name: 🰠Feature Request -about: Submit a new feature request ---- - - - -### What feature is it? - -### What can this function do? - +--- +name: 🰠Feature Request +about: Submit a new feature request +--- + + + +### What feature is it? + +### What can this function do? + ### Additional description \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request_zh.md b/.github/ISSUE_TEMPLATE/feature_request_zh.md index 91cc3f539..96df2eb14 100644 --- a/.github/ISSUE_TEMPLATE/feature_request_zh.md +++ b/.github/ISSUE_TEMPLATE/feature_request_zh.md @@ -1,15 +1,15 @@ ---- -name: 🰠功能需求 -about: æ交新的功能需求 ---- - - - -### 这是一个什么样的功能? - -### 这个功能å¯ä»¥å¹²ä»€ä¹ˆï¼Ÿ - +--- +name: 🰠功能需求 +about: æ交新的功能需求 +--- + + + +### 这是一个什么样的功能? + +### 这个功能å¯ä»¥å¹²ä»€ä¹ˆï¼Ÿ + ### é¢å¤–æè¿° \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index fcca4ea8a..4055262f4 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,31 +1,31 @@ -name-template: 'v$RESOLVED_VERSION 🌈' -tag-template: 'v$RESOLVED_VERSION' -categories: - - title: '🚀 Features' - labels: - - 'feature' - - 'enhancement' - - title: '🛠Bug Fixes' - labels: - - 'fix' - - 'bugfix' - - 'bug' - - title: '🧰 Maintenance' - label: 'chore' -change-template: '- $TITLE @$AUTHOR (#$NUMBER)' -change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. -version-resolver: - major: - labels: - - 'major' - minor: - labels: - - 'minor' - patch: - labels: - - 'patch' - default: patch -template: | - ## Changes - - $CHANGES +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🛠Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index b9e9cd3eb..056731227 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,22 +1,22 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - -name: Node.js Package - -on: - workflow_dispatch: - release: - types: [published] - -jobs: - publish-npm: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org/ - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Node.js Package + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 618e64dbd..614708ced 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,32 +1,32 @@ -name: Release Drafter - -on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - master - # pull_request event is required only for autolabeler - pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - # pull_request_target: - # types: [opened, reopened, synchronize] - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV - - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + # pull_request_target: + # types: [opened, reopened, synchronize] + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # (Optional) GitHub Enterprise requires GHE_HOST variable set + #- name: Set GHE_HOST + # run: | + # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # with: + # config-name: my-config.yml + # disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index d188590e7..f874c074d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,15 @@ -.DS_Store - -*.log - -node_modules - -.idea - -.directory - -WIKI/.vuepress/dist - -.vscode/ - -.eslintcache +.DS_Store + +*.log + +node_modules + +.idea + +.directory + +WIKI/.vuepress/dist + +.vscode/ + +.eslintcache diff --git a/LICENSE b/LICENSE index 261eeb9e9..29f81d812 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index dd10cdf6c..1f50d57a6 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,40 @@ -| ![Homepage](https://user-images.githubusercontent.com/16796652/134768469-52d2426b-5c7c-4a46-8f0e-064361044d88.png) | ![Archive](https://user-images.githubusercontent.com/16796652/134768465-a578b70e-38f2-4266-97e7-f0b85bd86348.png) | -| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | -| Homepage | Archive | -| ![Links](https://user-images.githubusercontent.com/16796652/134768466-cf580997-1201-48a8-812e-77eb0af6ce59.png) | ![Gallery](https://user-images.githubusercontent.com/16796652/134768468-86751060-b3bf-43f4-970e-4baa8906e29a.png) | -| Links | Gallery | -## 🎓 Docs - -English: -中文: - -## 💻 Preview - -欢迎将你的网站æäº¤åˆ°è¿™é‡Œæ¥ [直接编辑](https://github.com/theme-nexmoe/hexo-theme-nexmoe/edit/master/README.md) - -| 站点 | çŠ¶æ€ | 站点 | çŠ¶æ€ | -| --------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------- | -| [折影轻梦](https://nexmoe.com/) | ![折影轻梦](https://img.shields.io/website?url=https://nexmoe.com/) | [fly6022's Blog](https://blog.fly6022.fun) | ![fly6022's Blog](https://img.shields.io/website?url=https://blog.fly6022.fun) | -| [官方示例](https://hexo-theme-nexmoe-example.vercel.app/) | ![官方示例](https://img.shields.io/website?url=https://hexo-theme-nexmoe-example.vercel.app/) | [LittleDeng](https://lde.ng/) | ![LittleDeng](https://img.shields.io/website?url=https://lde.ng/) | -| [糖羽仙](https://www.tangyuxian.com/) | ![èŒç³–官方网站](https://img.shields.io/website?url=https://www.tangyuxian.com/) | [ç¹åŽæ˜¯å®¢ Blog](https://nexmoe-demo.withkr.xyz) | ![ç¹åŽæ˜¯å®¢ Blog](https://img.shields.io/website?url=https://nexmoe-demo.withkr.xyz) | -| [深海å°æ¶›](https://hexo.xtaolink.cn/) | ![深海å°æ¶›](https://img.shields.io/website?url=https://hexo.xtaolink.cn/) | [DreamCcc](https://note.bequick.run) | ![DreamCcc](https://img.shields.io/website?url=https://note.bequick.run) | -| [西瓜星 ðŸ‰âœ¨](https://suikastar.com/) | ![西瓜星 ðŸ‰âœ¨](https://img.shields.io/website?url=https://suikastar.com/) | [衬线柔骨](http://sxrekord.com) | ![衬线柔骨](https://img.shields.io/website?url=http://sxrekord.com) | -| [Fentaniao](https://fentaniao.github.io) | ![Fentaniao](https://img.shields.io/website?url=https://fentaniao.github.io) | [èŒå°å¿—ã®Blog](https://mengxiaozhi.galigali.club) | ![èŒå°å¿—ã®Blog](https://img.shields.io/website?url=https://mengxiaozhi.galigali.club) | -| [矿快报](https://latestminer.github.io) | ![Fentaniao](https://img.shields.io/website?url=https://latestminer.github.io) | [nukiyoam's blog](https://nukiyoam.github.io) | ![nukiyoam](https://img.shields.io/website?url=https://nukiyoam.github.io) | -| [星月的海](https://hosizuki.github.io/) | ![星月的海](https://img.shields.io/website?url=https://hosizuki.github.io/) | [咔斯ã®å°çª](https://kassama.top) | ![咔斯ã®å°çª](https://img.shields.io/website?url=https://kassama.top) | - -## 💻 Contributors - -![Contributors](https://opencollective.com/hexo-theme-nexmoe/contributors.svg?width=890&button=false) - -## 🎇 Awesome - -- Typecho: -- Hexo-Saigyou_Ayakashi: -- Solo-InkDP: -- Hexo-Dark: -- Typora: - -## 💴 Sponsor - -![微信赞èµç ](https://i.dawnlab.me/e528323511d872bc759128fc9a8c665f.md.png) +| ![Homepage](https://user-images.githubusercontent.com/16796652/134768469-52d2426b-5c7c-4a46-8f0e-064361044d88.png) | ![Archive](https://user-images.githubusercontent.com/16796652/134768465-a578b70e-38f2-4266-97e7-f0b85bd86348.png) | +| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | +| Homepage | Archive | +| ![Links](https://user-images.githubusercontent.com/16796652/134768466-cf580997-1201-48a8-812e-77eb0af6ce59.png) | ![Gallery](https://user-images.githubusercontent.com/16796652/134768468-86751060-b3bf-43f4-970e-4baa8906e29a.png) | +| Links | Gallery | +## 🎓 Docs + +English: +中文: + +## 💻 Preview + +欢迎将你的网站æäº¤åˆ°è¿™é‡Œæ¥ [直接编辑](https://github.com/theme-nexmoe/hexo-theme-nexmoe/edit/master/README.md) + +| 站点 | çŠ¶æ€ | 站点 | çŠ¶æ€ | +| --------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------- | +| [折影轻梦](https://nexmoe.com/) | ![折影轻梦](https://img.shields.io/website?url=https://nexmoe.com/) | [fly6022's Blog](https://blog.fly6022.fun) | ![fly6022's Blog](https://img.shields.io/website?url=https://blog.fly6022.fun) | +| [官方示例](https://hexo-theme-nexmoe-example.vercel.app/) | ![官方示例](https://img.shields.io/website?url=https://hexo-theme-nexmoe-example.vercel.app/) | [LittleDeng](https://lde.ng/) | ![LittleDeng](https://img.shields.io/website?url=https://lde.ng/) | +| [糖羽仙](https://www.tangyuxian.com/) | ![èŒç³–官方网站](https://img.shields.io/website?url=https://www.tangyuxian.com/) | [ç¹åŽæ˜¯å®¢ Blog](https://nexmoe-demo.withkr.xyz) | ![ç¹åŽæ˜¯å®¢ Blog](https://img.shields.io/website?url=https://nexmoe-demo.withkr.xyz) | +| [深海å°æ¶›](https://hexo.xtaolink.cn/) | ![深海å°æ¶›](https://img.shields.io/website?url=https://hexo.xtaolink.cn/) | [DreamCcc](https://note.bequick.run) | ![DreamCcc](https://img.shields.io/website?url=https://note.bequick.run) | +| [西瓜星 ðŸ‰âœ¨](https://suikastar.com/) | ![西瓜星 ðŸ‰âœ¨](https://img.shields.io/website?url=https://suikastar.com/) | [衬线柔骨](http://sxrekord.com) | ![衬线柔骨](https://img.shields.io/website?url=http://sxrekord.com) | +| [Fentaniao](https://fentaniao.github.io) | ![Fentaniao](https://img.shields.io/website?url=https://fentaniao.github.io) | [èŒå°å¿—ã®Blog](https://mengxiaozhi.galigali.club) | ![èŒå°å¿—ã®Blog](https://img.shields.io/website?url=https://mengxiaozhi.galigali.club) | +| [矿快报](https://latestminer.github.io) | ![Fentaniao](https://img.shields.io/website?url=https://latestminer.github.io) | [nukiyoam's blog](https://nukiyoam.github.io) | ![nukiyoam](https://img.shields.io/website?url=https://nukiyoam.github.io) | +| [星月的海](https://hosizuki.github.io/) | ![星月的海](https://img.shields.io/website?url=https://hosizuki.github.io/) | [咔斯ã®å°çª](https://kassama.top) | ![咔斯ã®å°çª](https://img.shields.io/website?url=https://kassama.top) | + +## 💻 Contributors + +![Contributors](https://opencollective.com/hexo-theme-nexmoe/contributors.svg?width=890&button=false) + +## 🎇 Awesome + +- Typecho: +- Hexo-Saigyou_Ayakashi: +- Solo-InkDP: +- Hexo-Dark: +- Typora: + +## 💴 Sponsor + +![微信赞èµç ](https://i.dawnlab.me/e528323511d872bc759128fc9a8c665f.md.png) diff --git a/crowdin.yml b/crowdin.yml index 6e2fc0b35..87be9c86c 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,6 +1,6 @@ -project_id: '490491' -files: - - source: /languages/zh-CN.yml - translation: /languages/%two_letters_code%.yml - - source: /languages/zh-CN.yml - translation: /languages/%locale%.yml +project_id: '490491' +files: + - source: /languages/zh-CN.yml + translation: /languages/%two_letters_code%.yml + - source: /languages/zh-CN.yml + translation: /languages/%locale%.yml diff --git a/include/config.js b/include/config.js index a93ef9715..49281cd3a 100644 --- a/include/config.js +++ b/include/config.js @@ -1,38 +1,37 @@ /* eslint no-process-exit: "off" */ const fs = require('fs'); const path = require('path'); -const util = require('util'); -const crypto = require('crypto'); -const logger = require('hexo-log')(); -const yaml = require('hexo-component-inferno/lib/util/yaml'); +// const util = require('util'); +// const crypto = require('crypto'); +// const yaml = require('hexo-component-inferno/lib/util/yaml'); // const { Migrator } = require('hexo-component-inferno/lib/core/migrate'); // const { SchemaLoader } = require('hexo-component-inferno/lib/core/schema'); const { yellow } = require('./util/console'); -function loadThemeConfig(hexo, cfgPaths) { - const configs = cfgPaths.map(cfgPath => fs.readFileSync(cfgPath)) - .map(cfgPath => yaml.parse(cfgPath)); - return Object.assign({}, ...configs, hexo.config.theme_config); -} +// function loadThemeConfig(hexo, cfgPaths) { +// const configs = cfgPaths.map(cfgPath => fs.readFileSync(cfgPath)) +// .map(cfgPath => yaml.parse(cfgPath)); +// return Object.assign({}, ...configs, hexo.config.theme_config); +// } -function generateThemeConfigFile(schema, cfgPath) { - const defaultValue = schema.getDefaultValue(); - fs.writeFileSync(cfgPath, defaultValue.toYaml()); -} +// function generateThemeConfigFile(schema, cfgPath) { +// const defaultValue = schema.getDefaultValue(); +// fs.writeFileSync(cfgPath, defaultValue.toYaml()); +// } -function hashConfigFile(cfgPath) { - const content = fs.readFileSync(cfgPath); - return crypto.createHash('md5').update(content).digest('hex'); -} +// function hashConfigFile(cfgPath) { +// const content = fs.readFileSync(cfgPath); +// return crypto.createHash('md5').update(content).digest('hex'); +// } function checkConfig(hexo) { if (!process.argv.includes('--nexmoe-dont-check-config')) { - logger.info('[Nexmoe] Checking theme configurations'); + console.info('[Nexmoe] Checking theme configurations'); const themeSiteCfg = path.join(hexo.base_dir, '_config.nexmoe.yml'); const themeDirCfg = path.join(hexo.theme_dir, '_config.yml'); const themeCfgPaths = [themeDirCfg, themeSiteCfg].filter(cfgPath => fs.existsSync(cfgPath)); - const themeSiteCfgExample = themeSiteCfg + '.example'; + // const themeSiteCfgExample = themeSiteCfg + '.example'; // const schemaDir = path.join(hexo.theme_dir, 'include/schema/'); // const loader = SchemaLoader.load(require(path.join(schemaDir, 'config.json')), schemaDir); @@ -40,15 +39,15 @@ function checkConfig(hexo) { if (!process.argv.includes('--nexmoe-dont-generate-config')) { if (!themeCfgPaths.length) { - logger.warn('None of the following configuration files is found:'); - logger.warn(`- ${yellow(themeSiteCfg)}`); - logger.warn(`- ${yellow(themeDirCfg)}`); - logger.info('Generating theme configuration file...'); + console.warn('None of the following configuration files is found:'); + console.warn(`- ${yellow(themeSiteCfg)}`); + console.warn(`- ${yellow(themeDirCfg)}`); + console.info('Generating theme configuration file...'); // generateThemeConfigFile(schema, themeSiteCfg); - fs.writeFileSync(themeSiteCfg, fs.readFileSync(path.join(hexo.theme_dir, 'source/_config.yml'))) + fs.writeFileSync(themeSiteCfg, fs.readFileSync(path.join(hexo.theme_dir, 'source/_config.yml'))); themeCfgPaths.push(themeSiteCfg); - logger.info(`${yellow(themeSiteCfg)} created successfully.`); - logger.info('To skip configuration generation, use "--nexmoe-dont-generate-config".'); + console.info(`${yellow(themeSiteCfg)} created successfully.`); + console.info('To skip configuration generation, use "--nexmoe-dont-generate-config".'); } } @@ -57,34 +56,34 @@ function checkConfig(hexo) { // if (!process.argv.includes('--nexmoe-dont-upgrade-config')) { // const migrator = new Migrator(require(path.join(hexo.theme_dir, 'include/migration/head'))); // if (cfg.version && migrator.isOudated(cfg.version)) { - // logger.warn(`Your theme configuration is outdated (${cfg.version} < ${migrator.getLatestVersion()}).`); - // logger.info('To skip the configuration upgrade, use "--nexmoe-dont-upgrade-config".'); + // console.warn(`Your theme configuration is outdated (${cfg.version} < ${migrator.getLatestVersion()}).`); + // console.info('To skip the configuration upgrade, use "--nexmoe-dont-upgrade-config".'); - // logger.info('Backing up theme configuration files...'); + // console.info('Backing up theme configuration files...'); // for (const cfgPath of themeCfgPaths) { // const backupPath = cfgPath + '.' + hashConfigFile(cfgPath); // const relCfgPath = path.relative(hexo.base_dir, cfgPath); // const relBackupPath = path.relative(hexo.base_dir, backupPath); // fs.renameSync(cfgPath, backupPath); - // logger.info(`${yellow(relCfgPath)} => ${yellow(relBackupPath)}`); + // console.info(`${yellow(relCfgPath)} => ${yellow(relBackupPath)}`); // } - // logger.info('Upgrading theme configurations...'); + // console.info('Upgrading theme configurations...'); // cfg = migrator.migrate(cfg); // fs.writeFileSync(themeSiteCfg, yaml.stringify(cfg)); - // logger.info(`Theme configurations are written to ${yellow(themeSiteCfg)}.`); + // console.info(`Theme configurations are written to ${yellow(themeSiteCfg)}.`); // generateThemeConfigFile(schema, themeSiteCfgExample); - // logger.info(`Example configurations is at ${yellow(themeSiteCfgExample)}.`); + // console.info(`Example configurations is at ${yellow(themeSiteCfgExample)}.`); // } // } // const validation = schema.validate(cfg); // if (validation !== true) { - // logger.warn('Theme configurations failed one or more checks.'); - // logger.warn('nexmoe may still run, but you will encounter unexcepted results.'); - // logger.warn('Here is some information for you to correct the configuration file.'); - // logger.warn(util.inspect(validation)); + // console.warn('Theme configurations failed one or more checks.'); + // console.warn('nexmoe may still run, but you will encounter unexcepted results.'); + // console.warn('Here is some information for you to correct the configuration file.'); + // console.warn(util.inspect(validation)); // } } @@ -94,9 +93,9 @@ module.exports = hexo => { try { checkConfig(hexo); } catch (e) { - logger.error(e); - logger.error('Theme configuration checking failed.'); - logger.info('You may use \'--nexmoe-dont-check-config\' to skip configuration checking.'); + console.error(e); + console.error('Theme configuration checking failed.'); + console.info('You may use \'--nexmoe-dont-check-config\' to skip configuration checking.'); process.exit(-1); } }; diff --git a/include/dependency.js b/include/dependency.js index 38bd23453..0ac761bc2 100644 --- a/include/dependency.js +++ b/include/dependency.js @@ -1,6 +1,5 @@ /* eslint no-process-exit: "off" */ const semver = require('semver'); -const logger = require('hexo-log')(); const packageInfo = require('../package.json'); const { yellow, red, green } = require('./util/console'); @@ -10,25 +9,25 @@ module.exports = hexo => { require.resolve(name); const version = require(name + '/package.json').version; if (!semver.satisfies(version, reqVer)) { - logger.error(`Package ${yellow(name)}'s version (${yellow(version)}) does not satisfy the required version (${red(reqVer)}).`); + console.error(`Package ${yellow(name)}'s version (${yellow(version)}) does not satisfy the required version (${red(reqVer)}).`); return false; } return true; } catch (e) { - logger.error(`Package ${yellow(name)} is not installed.`); + console.error(`Package ${yellow(name)} is not installed.`); } return false; } - logger.info('[Nexmoe] Checking package dependencies'); + console.info('[Nexmoe] Checking package dependencies'); const dependencies = Object.assign({}, packageInfo.dependencies); const missingDeps = Object.keys(dependencies) .filter(name => !checkDependency(name, dependencies[name])); if (missingDeps && missingDeps.length) { - logger.error('Please install the missing dependencies your Hexo site root directory:'); - logger.error(green('npm install --save ' + missingDeps.map(name => `${name}@${dependencies[name]}`).join(' '))); - logger.error('or:'); - logger.error(green('yarn add ' + missingDeps.map(name => `${name}@${dependencies[name]}`).join(' '))); + console.error('Please install the missing dependencies your Hexo site root directory:'); + console.error(green('npm install --save ' + missingDeps.map(name => `${name}@${dependencies[name]}`).join(' '))); + console.error('or:'); + console.error(green('yarn add ' + missingDeps.map(name => `${name}@${dependencies[name]}`).join(' '))); process.exit(-1); } }; diff --git a/include/register.js b/include/register.js index 06b2e4c91..8e1a8b622 100644 --- a/include/register.js +++ b/include/register.js @@ -1,7 +1,5 @@ -const logger = require('hexo-log')(); - module.exports = hexo => { - logger.info('=== Registering Hexo extensions ==='); + console.info('=== Registering Hexo extensions ==='); require('hexo-component-inferno/lib/hexo/filter/locals')(hexo); require('hexo-component-inferno/lib/hexo/generator/assets')(hexo); require('hexo-component-inferno/lib/hexo/generator/insight')(hexo); diff --git a/languages/default.yml b/languages/default.yml index 1630d2d22..04200ba4e 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -1,20 +1,20 @@ -continue: More -nav: - home: Home - -search: Search -archive: Archive -recent_posts: Recent Posts -categories: Categories -hitokoto: Hitokoto -tagcloud: Tagcloud -social: Social - -count: - articles: Articles - tags: Tags - categories: Categories - -copyright: - author: Author +continue: More +nav: + home: Home + +search: Search +archive: Archive +recent_posts: Recent Posts +categories: Categories +hitokoto: Hitokoto +tagcloud: Tagcloud +social: Social + +count: + articles: Articles + tags: Tags + categories: Categories + +copyright: + author: Author permalink: Link \ No newline at end of file diff --git a/languages/en.yml b/languages/en.yml index 427629bb8..410f12992 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -1,17 +1,17 @@ -continue: View More... -nav: - home: Home -search: Search -archive: Archive -recent_posts: Recent Posts -categories: Categories -hitokoto: 一言 -tagcloud: Tag Cloud -social: Social Button -count: - articles: Articles - tags: Tags - categories: Categories -copyright: - author: Author - permalink: Link +continue: View More... +nav: + home: Home +search: Search +archive: Archive +recent_posts: Recent Posts +categories: Categories +hitokoto: 一言 +tagcloud: Tag Cloud +social: Social Button +count: + articles: Articles + tags: Tags + categories: Categories +copyright: + author: Author + permalink: Link diff --git a/languages/it.yml b/languages/it.yml index e80510566..bb68d7f94 100644 --- a/languages/it.yml +++ b/languages/it.yml @@ -1,17 +1,17 @@ -continue: Mostra di più -nav: - home: Home -search: Cerca -archive: Archivio -recent_posts: Post recenti -categories: Categorie -hitokoto: 一言 -tagcloud: Tagcloud -social: Social -count: - articles: Articoli - tags: Tags - categories: Categorie -copyright: - author: Autore - permalink: Link +continue: Mostra di più +nav: + home: Home +search: Cerca +archive: Archivio +recent_posts: Post recenti +categories: Categorie +hitokoto: 一言 +tagcloud: Tagcloud +social: Social +count: + articles: Articoli + tags: Tags + categories: Categorie +copyright: + author: Autore + permalink: Link diff --git a/languages/ja.yml b/languages/ja.yml index e48c62b15..db07472eb 100644 --- a/languages/ja.yml +++ b/languages/ja.yml @@ -1,17 +1,17 @@ -continue: ã‚‚ã£ã¨è¦‹ã‚‹ -nav: - home: ホームã«æˆ»ã‚‹ -search: 検索 -archive: 記事ã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ– -recent_posts: 最新記事 -categories: ã‚«ãƒ†ã‚´ãƒªç®¡ç† -hitokoto: 一言 -tagcloud: タグクラウド -social: ソーシャルボタン -count: - articles: 記事 - tags: ã‚¿ã‚° - categories: カテゴリ -copyright: - author: オリジナルã®æŠ•ç¨¿è€… - permalink: 本文リンク +continue: ã‚‚ã£ã¨è¦‹ã‚‹ +nav: + home: ホームã«æˆ»ã‚‹ +search: 検索 +archive: 記事ã®ã‚¢ãƒ¼ã‚«ã‚¤ãƒ– +recent_posts: 最新記事 +categories: ã‚«ãƒ†ã‚´ãƒªç®¡ç† +hitokoto: 一言 +tagcloud: タグクラウド +social: ソーシャルボタン +count: + articles: 記事 + tags: ã‚¿ã‚° + categories: カテゴリ +copyright: + author: オリジナルã®æŠ•ç¨¿è€… + permalink: 本文リンク diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 2285aebfc..e20c373bc 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -1,20 +1,20 @@ -continue: 查看更多 -nav: - home: 回到首页 - -search: æœç´¢ -archive: 文章归档 -recent_posts: 最新文章 -categories: 文章分类 -hitokoto: 一言 -tagcloud: 标签云 -social: 社交按钮 - -count: - articles: 文章 - tags: 标签 - categories: 分类 - -copyright: - author: 本文作者 +continue: 查看更多 +nav: + home: 回到首页 + +search: æœç´¢ +archive: 文章归档 +recent_posts: 最新文章 +categories: 文章分类 +hitokoto: 一言 +tagcloud: 标签云 +social: 社交按钮 + +count: + articles: 文章 + tags: 标签 + categories: 分类 + +copyright: + author: 本文作者 permalink: 本文链接 \ No newline at end of file diff --git a/languages/zh-HK.yml b/languages/zh-HK.yml index 9bad61cb5..13b9f9cce 100644 --- a/languages/zh-HK.yml +++ b/languages/zh-HK.yml @@ -1,17 +1,17 @@ -continue: 查看更多 -nav: - home: 回到首页 -search: æœç´¢ -archive: 文章归档 -recent_posts: 最新文章 -categories: 文章分类 -hitokoto: 壹言 -tagcloud: 标签云 -social: 社交按钮 -count: - articles: 文章 - tags: 标签 - categories: 分类 -copyright: - author: 本文作者 - permalink: 本文链接 +continue: 查看更多 +nav: + home: 回到首页 +search: æœç´¢ +archive: 文章归档 +recent_posts: 最新文章 +categories: 文章分类 +hitokoto: 壹言 +tagcloud: 标签云 +social: 社交按钮 +count: + articles: 文章 + tags: 标签 + categories: 分类 +copyright: + author: 本文作者 + permalink: 本文链接 diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index ba0d074d3..5c62dcaaa 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -1,17 +1,17 @@ -continue: 查看更多 -nav: - home: å›žåˆ°é¦–é  -search: æœå°‹ -archive: 所有文章 -recent_posts: 最新文章 -categories: 文章分類 -hitokoto: 壹言 -tagcloud: 標籤雲 -social: ç¤¾äº¤å¹³å° -count: - articles: 文章 - tags: 標籤 - categories: 分類 -copyright: - author: 本文作者 - permalink: æœ¬æ–‡é€£çµ +continue: 查看更多 +nav: + home: å›žåˆ°é¦–é  +search: æœå°‹ +archive: 所有文章 +recent_posts: 最新文章 +categories: 文章分類 +hitokoto: 壹言 +tagcloud: 標籤雲 +social: ç¤¾äº¤å¹³å° +count: + articles: 文章 + tags: 標籤 + categories: 分類 +copyright: + author: 本文作者 + permalink: æœ¬æ–‡é€£çµ diff --git a/languages/zh.yml b/languages/zh.yml index f178b4064..563f1bb66 100644 --- a/languages/zh.yml +++ b/languages/zh.yml @@ -1,17 +1,17 @@ -continue: 查看更多 -nav: - home: å›žåˆ°é¦–é  -search: æœå°‹ -archive: 文章歸檔 -recent_posts: 最新文章 -categories: 文章分類 -hitokoto: 一言 -tagcloud: 標簽雲 -social: 社交按鈕 -count: - articles: 文章 - tags: 標籤 - categories: 類別 -copyright: - author: åšä¸» - permalink: æ–‡ç« é€£çµ +continue: 查看更多 +nav: + home: å›žåˆ°é¦–é  +search: æœå°‹ +archive: 文章歸檔 +recent_posts: 最新文章 +categories: 文章分類 +hitokoto: 一言 +tagcloud: 標簽雲 +social: 社交按鈕 +count: + articles: 文章 + tags: 標籤 + categories: 類別 +copyright: + author: åšä¸» + permalink: æ–‡ç« é€£çµ diff --git a/layout/_index/list.ejs b/layout/_index/list.ejs index 0b28118e1..efb4f3ea2 100644 --- a/layout/_index/list.ejs +++ b/layout/_index/list.ejs @@ -1,23 +1,23 @@ -<% page.posts.each(function (page) { %> -
- - <% if (page.cover){ %> -
- <%= page.title %> -

<%= page.title %>

-
- <%} else{ %> -
- <%= page.title %> -

<%= page.title %>

-
- <% } %> -
- - <%- partial('_partial/_post/meta', {page: page}) %> - -
- <%- page.excerpt %> -
-
+<% page.posts.each(function (page) { %> +
+ + <% if (page.cover){ %> +
+ <%= page.title %> +

<%= page.title %>

+
+ <%} else{ %> +
+ <%= page.title %> +

<%= page.title %>

+
+ <% } %> +
+ + <%- partial('_partial/_post/meta', {page: page}) %> + +
+ <%- page.excerpt %> +
+
<% }) %> \ No newline at end of file diff --git a/layout/_layout/nexmoe/body.jsx b/layout/_layout/nexmoe/body.jsx index 7ee6be4fa..f40443635 100644 --- a/layout/_layout/nexmoe/body.jsx +++ b/layout/_layout/nexmoe/body.jsx @@ -1,33 +1,33 @@ -const { Component } = require("inferno"); +const { Component, Fragment } = require('inferno'); module.exports = class extends Component { - render() { - const { partial } = this.props; - const Content = require(`./content`); - const Footer = require(`./footer`); + render() { + const { partial } = this.props; + const Content = require('./content'); + const Footer = require('./footer'); - return ( - <> -
-
- -
-
+ return ( + +
+
+ +
+
- - - ); - } + +
+ ); + } }; diff --git a/layout/_layout/nexmoe/content.jsx b/layout/_layout/nexmoe/content.jsx index c29292d23..1d3428c88 100644 --- a/layout/_layout/nexmoe/content.jsx +++ b/layout/_layout/nexmoe/content.jsx @@ -1,14 +1,14 @@ -const { Component } = require("inferno"); +const { Component } = require('inferno'); module.exports = class extends Component { - render() { - const { body } = this.props; + render() { + const { body } = this.props; - return ( -
- ); - } + return ( +
+ ); + } }; diff --git a/layout/_layout/nexmoe/footer.jsx b/layout/_layout/nexmoe/footer.jsx index d98c90d28..e42ab95b7 100644 --- a/layout/_layout/nexmoe/footer.jsx +++ b/layout/_layout/nexmoe/footer.jsx @@ -1,11 +1,11 @@ -const { Component } = require("inferno"); +const { Component, Fragment } = require('inferno'); module.exports = class extends Component { - render() { - const { body } = this.props; + render() { + // const { body } = this.props; - return ( - <> - ); - } + return ( + + ); + } }; diff --git a/layout/_layout/nexmoe/header.ejs b/layout/_layout/nexmoe/header.ejs index d2d3c37fc..799ff1f1c 100644 --- a/layout/_layout/nexmoe/header.ejs +++ b/layout/_layout/nexmoe/header.ejs @@ -1,34 +1,34 @@ -
-
- - <%= config.author || config.title %> - -
-
-
<%= __('count.articles') %><%= site.posts.length %>
-
<%= __('count.tags') %><%= site.tags.length %>
-
<%= __('count.categories') %><%= site.categories.length %>
-
-
- <% for (name in theme.menu) { %> - - -
- <%= name %> -
-
- <% } %> -
- - <% theme.widgets.forEach(function(widget){ %> - <% if(widget.enable){ %> - <%- partial('_widget/' + widget.name, {options: widget.options}) %> - <% }}) %> - - +
+
+ + <%= config.author || config.title %> + +
+
+
<%= __('count.articles') %><%= site.posts.length %>
+
<%= __('count.tags') %><%= site.tags.length %>
+
<%= __('count.categories') %><%= site.categories.length %>
+
+
+ <% for (name in theme.menu) { %> + + +
+ <%= name %> +
+
+ <% } %> +
+ + <% theme.widgets.forEach(function(widget){ %> + <% if(widget.enable){ %> + <%- partial('_widget/' + widget.name, {options: widget.options}) %> + <% }}) %> + +
\ No newline at end of file diff --git a/layout/_layout/xiaoshu/body.jsx b/layout/_layout/xiaoshu/body.jsx index 9f0ff376d..465cb2f1c 100644 --- a/layout/_layout/xiaoshu/body.jsx +++ b/layout/_layout/xiaoshu/body.jsx @@ -1,33 +1,33 @@ -const { Component } = require("inferno"); +const { Component, Fragment } = require('inferno'); module.exports = class extends Component { - render() { - const { partial } = this.props; - const Header = require(`./header`); - const Content = require(`./content`); - const Footer = require(`./footer`); + render() { + const { partial } = this.props; + const Header = require('./header'); + const Content = require('./content'); + const Footer = require('./footer'); - return ( - <> -
-
-
-
-
- -
-
-
+ return ( + +
+
+
+
+
+ +
+
+
- - - ); - } + +
+ ); + } }; diff --git a/layout/_layout/xiaoshu/content.jsx b/layout/_layout/xiaoshu/content.jsx index 7d8f6d070..4826be713 100644 --- a/layout/_layout/xiaoshu/content.jsx +++ b/layout/_layout/xiaoshu/content.jsx @@ -1,9 +1,9 @@ -const { Component } = require("inferno"); +const { Component } = require('inferno'); module.exports = class extends Component { - render() { - const { body } = this.props; + render() { + const { body } = this.props; - return
; - } + return
; + } }; diff --git a/layout/_layout/xiaoshu/footer.jsx b/layout/_layout/xiaoshu/footer.jsx index 0cbfed41f..a5c5b3eb9 100644 --- a/layout/_layout/xiaoshu/footer.jsx +++ b/layout/_layout/xiaoshu/footer.jsx @@ -1,30 +1,30 @@ -const { Component } = require("inferno"); +const { Component, Fragment } = require('inferno'); module.exports = class extends Component { - render() { - const { config, date, theme, __ } = this.props; + render() { + const { config, date, theme, __ } = this.props; - return ( - <> -
- © {date(new Date(), "YYYY")}{" "} - {config.author || config.title} - {__("Powered by")} - + return ( + + - - ); - } + +
+
+ + ); + } }; diff --git a/layout/_layout/xiaoshu/header.jsx b/layout/_layout/xiaoshu/header.jsx index 0cbfed41f..a5c5b3eb9 100644 --- a/layout/_layout/xiaoshu/header.jsx +++ b/layout/_layout/xiaoshu/header.jsx @@ -1,30 +1,30 @@ -const { Component } = require("inferno"); +const { Component, Fragment } = require('inferno'); module.exports = class extends Component { - render() { - const { config, date, theme, __ } = this.props; + render() { + const { config, date, theme, __ } = this.props; - return ( - <> -
- © {date(new Date(), "YYYY")}{" "} - {config.author || config.title} - {__("Powered by")} - + return ( + + - - ); - } + +
+
+ + ); + } }; diff --git a/layout/_partial/_post/copyright.ejs b/layout/_partial/_post/copyright.ejs index fbf320bb2..be63e5e51 100644 --- a/layout/_partial/_post/copyright.ejs +++ b/layout/_partial/_post/copyright.ejs @@ -1,11 +1,11 @@ -<% if (page.hide_copyright !== true && theme.slotCopyright || page.copyright) { %> -
- <%- __('copyright.author') %>:<%= config.author %>
- <%- __('copyright.permalink') %>:<%- link_to(page.permalink, page.permalink, {external: true}) %>
- <% if (page.copyright) { %> - <%- page.copyright %> - <% } else { %> - <%- theme.slotCopyright %> - <% } %> -
-<% } %> +<% if (page.hide_copyright !== true && theme.slotCopyright || page.copyright) { %> +
+ <%- __('copyright.author') %>:<%= config.author %>
+ <%- __('copyright.permalink') %>:<%- link_to(page.permalink, page.permalink, {external: true}) %>
+ <% if (page.copyright) { %> + <%- page.copyright %> + <% } else { %> + <%- theme.slotCopyright %> + <% } %> +
+<% } %> diff --git a/layout/_partial/_post/meta.ejs b/layout/_partial/_post/meta.ejs index edcbc2ae0..4062b2d43 100644 --- a/layout/_partial/_post/meta.ejs +++ b/layout/_partial/_post/meta.ejs @@ -1,35 +1,35 @@ -