From 0102abae062be24ec289fb7facb11950aca79e3f Mon Sep 17 00:00:00 2001 From: Jason <50330957+itsjason-net@users.noreply.github.com> Date: Sat, 18 May 2024 06:05:09 -0500 Subject: [PATCH 01/42] feat: add Bluesky social links (#1759) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index 1ed228a01..d6819e0de 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -26,3 +26,7 @@ # - type: stack-overflow # icon: 'fab fa-stack-overflow' # url: '' # Fill with your stackoverflow homepage +# +# - type: bluesky +# icon: 'fa-brands fa-bluesky' +# url: '' # Fill with your Bluesky profile link diff --git a/_data/share.yml b/_data/share.yml index b1d077dca..0aa28fd42 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -36,3 +36,7 @@ platforms: # link: "https://fosstodon.org/" # - label: photog.social # link: "https://photog.social/" + # + # - type: Bluesky + # icon: "fa-brands fa-bluesky" + # link: "https://bsky.app/intent/compose?text=TITLE%20URL" From 64ae7a3671335409e11a9b467d5a89847528b812 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 30 May 2024 03:33:35 +0800 Subject: [PATCH 02/42] docs: correct markdown syntax of tutorial (#1787) --- _posts/2019-08-08-write-a-new-post.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index e6259ba3b..3ad1438b5 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -433,8 +433,6 @@ If you want to display the **Liquid** snippet, surround the liquid code with `{% Or adding `render_with_liquid: false` (Requires Jekyll 4.0 or higher) to the post's YAML block. -``` - ## Mathematics We use [**MathJax**][mathjax] to generate mathematics. For website performance reasons, the mathematical feature won't be loaded by default. But it can be enabled by: From 1c5fa0880d3bb21c7a3a5f53d0e7d3bab146baba Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 1 Jun 2024 04:11:01 +0800 Subject: [PATCH 03/42] refactor: restore shell script extensions Without an extension, the shell script configuration in `.gitattribute` will not work. --- .github/workflows/ci.yml | 2 +- _posts/2019-08-09-getting-started.md | 2 +- package.json | 4 ++-- tools/{init => init.sh} | 0 tools/{release => release.sh} | 2 +- tools/{run => run.sh} | 0 tools/{test => test.sh} | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename tools/{init => init.sh} (100%) rename tools/{release => release.sh} (98%) rename tools/{run => run.sh} (100%) rename tools/{test => test.sh} (97%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa8d0c9ee..ca60bd679 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,4 +42,4 @@ jobs: run: npm i && npm run build - name: Test Site - run: bash tools/test + run: bash tools/test.sh diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 1cea5be96..3e0327a7e 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -35,7 +35,7 @@ Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme Next, clone the repository to your local machine, make sure it has [Node.js][nodejs] installed, then go to the root directory of the repo and run the following command: ```console -$ bash tools/init +$ bash tools/init.sh ``` > If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. diff --git a/package.json b/package.json index 8600aa4ee..2c065bb67 100644 --- a/package.json +++ b/package.json @@ -156,8 +156,8 @@ [ "@semantic-release/exec", { - "prepareCmd": "bash tools/release --prepare", - "publishCmd": "bash tools/release" + "prepareCmd": "bash tools/release.sh --prepare", + "publishCmd": "bash tools/release.sh" } ], [ diff --git a/tools/init b/tools/init.sh similarity index 100% rename from tools/init rename to tools/init.sh diff --git a/tools/release b/tools/release.sh similarity index 98% rename from tools/release rename to tools/release.sh index c2ea59e1d..6d010b631 100755 --- a/tools/release +++ b/tools/release.sh @@ -37,7 +37,7 @@ help() { echo " 2. Merge the release branch into the default branch" echo echo "Usage:" - echo " bash ./tools/release [options]" + echo " bash $0 [options]" echo echo "Options:" echo " --prepare Preparation for release" diff --git a/tools/run b/tools/run.sh similarity index 100% rename from tools/run rename to tools/run.sh diff --git a/tools/test b/tools/test.sh similarity index 97% rename from tools/test rename to tools/test.sh index fe47d446d..331de1c34 100755 --- a/tools/test +++ b/tools/test.sh @@ -19,7 +19,7 @@ help() { echo echo "Usage:" echo - echo " bash ./tools/test [options]" + echo " bash $0 [options]" echo echo "Options:" echo ' -c, --config "" Specify config file(s)' From 1e3d4a6323ba3eed06a57f8bf1b2edefd890b127 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:12:54 +0800 Subject: [PATCH 04/42] feat(dev): support vscode dev-container (#1781) --- .devcontainer/devcontainer.json | 31 +++++++++++++++++++++++++++++++ .devcontainer/post-create.sh | 10 ++++++++++ .github/dependabot.yml | 4 ++++ .gitignore | 2 +- .vscode/extensions.json | 12 +----------- .vscode/settings.json | 6 +++--- README.md | 9 +++++---- tools/run.sh | 4 ++++ 8 files changed, 59 insertions(+), 19 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/post-create.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..a891b7ee5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +{ + "name": "Jekyll", + "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", + "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postCreateCommand": "bash .devcontainer/post-create.sh", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh", + // Speed up extension installation + "extensions.verifySignature": false + }, + "extensions": [ + // Liquid tags auto-complete + "killalau.vscode-liquid-snippets", + // Liquid syntax highlighting and formatting + "Shopify.theme-check-vscode", + // Shell + "timonwong.shellcheck", + "mkhl.shfmt", + // Common formatter + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "stylelint.vscode-stylelint", + "yzhang.markdown-all-in-one", + // Git + "mhutchie.git-graph" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 000000000..14422cbf0 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if [ -f package.json ]; then + bash -i -c "nvm install --lts && nvm install-latest-npm" + npm i + npm run build +fi + +# Install dependencies for shfmt extension +curl -sS https://webi.sh/shfmt | sh &>/dev/null diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 393fa9803..82bf3f777 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,3 +23,7 @@ updates: - "major" schedule: interval: "weekly" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.gitignore b/.gitignore index d6bf50964..e7803e6e6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ package-lock.json # IDE configurations .idea -.vscode +.vscode/* !.vscode/settings.json !.vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 52bd6fbd0..082bc94c0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,13 +1,3 @@ { - "recommendations": [ - // Liquid tags auto-complete - "killalau.vscode-liquid-snippets", - // Liquid syntax highlighting and formatting - "Shopify.theme-check-vscode", - // Common formatter - "esbenp.prettier-vscode", - "foxundermoon.shell-format", - "stylelint.vscode-stylelint", - "yzhang.markdown-all-in-one" - ] + "recommendations": ["ms-vscode-remote.remote-containers"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index b0e2e099d..787a0c844 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,13 +15,13 @@ "editor.defaultFormatter": "Shopify.theme-check-vscode" }, "[shellscript]": { - "editor.defaultFormatter": "foxundermoon.shell-format" + "editor.defaultFormatter": "mkhl.shfmt" }, // Disable vscode built-in stylelint "css.validate": false, "scss.validate": false, "less.validate": false, // Stylint extension settings - "stylelint.snippet": ["css", "less", "postcss", "scss"], - "stylelint.validate": ["css", "less", "postcss", "scss"] + "stylelint.snippet": ["css", "scss"], + "stylelint.validate": ["css", "scss"] } diff --git a/README.md b/README.md index 747b8bc1d..6f3b158e7 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?color=brightgreen)][gem]  - [![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=gainsboro&label=gem&color=brightgreen)][gem]  + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github&logoColor=gainsboro)][ci]  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  - [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy.svg)][license]  - [![996.icu](https://img.shields.io/badge/link-996.icu-%23FF4D5B.svg)](https://996.icu) + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  + [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&logoColor=gainsboro&message=Open&color=deepskyblue)][open-container] [**Live Demo** →][demo] @@ -72,6 +72,7 @@ This project is published under [MIT License][license]. [ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster [codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade [license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE +[open-container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/cotes2020/jekyll-theme-chirpy [jekyllrb]: https://jekyllrb.com/ [clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ [demo]: https://cotes2020.github.io/chirpy-demo/ diff --git a/tools/run.sh b/tools/run.sh index 04f23f5e7..0efc452d3 100755 --- a/tools/run.sh +++ b/tools/run.sh @@ -46,5 +46,9 @@ if $prod; then command="JEKYLL_ENV=production $command" fi +if [ -e /proc/1/cgroup ] && grep -q docker /proc/1/cgroup; then + command="$command --force_polling" +fi + echo -e "\n> $command\n" eval "$command" From 3b46629dc0c4bf401cc4775121adfa2cdd342043 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 01:36:27 +0800 Subject: [PATCH 05/42] build(deps-dev): bump the npm group across 1 directory with 8 updates Updates the requirements on [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core), [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties), [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env), [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog/tree/HEAD/packages/conventional-changelog-conventionalcommits), [rollup](https://github.com/rollup/rollup), [rollup-plugin-license](https://github.com/mjeanroy/rollup-plugin-license), [semantic-release](https://github.com/semantic-release/semantic-release) and [stylelint](https://github.com/stylelint/stylelint) to permit the latest version. Updates `@babel/core` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-core) Updates `@babel/plugin-transform-class-properties` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-plugin-transform-class-properties) Updates `@babel/preset-env` to 7.24.6 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-preset-env) Updates `conventional-changelog-conventionalcommits` from 7.0.2 to 8.0.0 - [Release notes](https://github.com/conventional-changelog/conventional-changelog/releases) - [Changelog](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-conventionalcommits/CHANGELOG.md) - [Commits](https://github.com/conventional-changelog/conventional-changelog/commits/conventional-changelog-conventionalcommits-v8.0.0/packages/conventional-changelog-conventionalcommits) Updates `rollup` to 4.18.0 - [Release notes](https://github.com/rollup/rollup/releases) - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md) - [Commits](https://github.com/rollup/rollup/compare/v4.17.2...v4.18.0) Updates `rollup-plugin-license` to 3.4.0 - [Changelog](https://github.com/mjeanroy/rollup-plugin-license/blob/master/CHANGELOG.md) - [Commits](https://github.com/mjeanroy/rollup-plugin-license/compare/v3.3.1...v3.4.0) Updates `semantic-release` from 23.1.1 to 24.0.0 - [Release notes](https://github.com/semantic-release/semantic-release/releases) - [Commits](https://github.com/semantic-release/semantic-release/compare/v23.1.1...v24.0.0) Updates `stylelint` to 16.6.1 - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/16.5.0...16.6.1) --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 2c065bb67..574898657 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.5", - "@babel/plugin-transform-class-properties": "^7.24.1", - "@babel/preset-env": "^7.24.5", + "@babel/core": "^7.24.6", + "@babel/plugin-transform-class-properties": "^7.24.6", + "@babel/preset-env": "^7.24.6", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", @@ -39,13 +39,13 @@ "@semantic-release/exec": "^6.0.3", "@semantic-release/git": "^10.0.1", "concurrently": "^8.2.2", - "conventional-changelog-conventionalcommits": "^7.0.2", + "conventional-changelog-conventionalcommits": "^8.0.0", "husky": "^9.0.11", "purgecss": "^6.0.0", - "rollup": "^4.17.2", - "rollup-plugin-license": "^3.3.1", - "semantic-release": "^23.1.1", - "stylelint": "^16.5.0", + "rollup": "^4.18.0", + "rollup-plugin-license": "^3.4.0", + "semantic-release": "^24.0.0", + "stylelint": "^16.6.1", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From 88b844ce80a4aada081ec919d652c2fddb2fa77e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:26:17 +0800 Subject: [PATCH 06/42] build(deps): improve dependency grouping --- .github/dependabot.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 82bf3f777..a51f37eb0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,11 +8,10 @@ updates: directory: "/" versioning-strategy: increase groups: - npm: - update-types: - - "major" - - "minor" - - "patch" + prod-deps: + dependency-type: production + dev-deps: + dependency-type: development schedule: interval: "weekly" - package-ecosystem: "github-actions" From 250880c088955f7d2f09129edc69ae7b9486d1ef Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:28:02 +0800 Subject: [PATCH 07/42] docs: change ordering of badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6f3b158e7..2cc38073e 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=gainsboro&label=gem&color=brightgreen)][gem]  - [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github&logoColor=gainsboro)][ci]  - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy]  + [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&message=Open&color=deepskyblue)][open-container]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  - [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&logoColor=gainsboro&message=Open&color=deepskyblue)][open-container] + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  + [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy] [**Live Demo** →][demo] From 7ca9c5978425d2ca052ce14cc0592c16436b8174 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:51:10 +0800 Subject: [PATCH 08/42] build(deps-dev): remove package `rollup-plugin-license` (#1796) The `rollup-plugin-license` has been using too many deprecated dependencies, so it is necessary to remove it. As an alternative, this changes uses Rollup `output.banner` to insert copyright information. Since `terser` runs after `output`, it is not possible to insert the Front Matter defining permlink for `sw.js` through the same way (Jekyll Front Matter is YAML rather than JS, which would cause errors with terser). Therefore, _Jekyll Collection_ is now used to add permlink to `sw.js`, with the collection named `app`, and the directory placed in `_app`. This directory is not tracked by git, but it will be included when building the gem. --- .gitignore | 1 + _config.yml | 7 +++-- _includes/js-selector.html | 7 +++-- _javascript/_copyright | 1 - _javascript/pwa/_frontmatter | 3 --- jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- rollup.config.js | 50 +++++++++++++++++------------------- tools/init.sh | 2 +- tools/release.sh | 18 ++----------- 10 files changed, 35 insertions(+), 58 deletions(-) delete mode 100644 _javascript/_copyright delete mode 100644 _javascript/pwa/_frontmatter diff --git a/.gitignore b/.gitignore index e7803e6e6..104d05318 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Gemfile.lock .jekyll-cache .jekyll-metadata _site +_app # RubyGems *.gem diff --git a/_config.yml b/_config.yml index 613b043b2..8e54ea7f7 100644 --- a/_config.yml +++ b/_config.yml @@ -168,6 +168,9 @@ collections: tabs: output: true sort_by: order + app: + output: true + permalink: /:name defaults: - scope: @@ -190,10 +193,6 @@ defaults: values: layout: page permalink: /:title/ - - scope: - path: assets/js/dist - values: - swcache: true sass: style: compressed diff --git a/_includes/js-selector.html b/_includes/js-selector.html index b229b70d7..996510765 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -6,8 +6,6 @@ -{% assign js_dist = '/assets/js/dist/' %} - {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} {% assign urls = urls | append: ',' | append: site.data.origin[type]['lazy-polyfill'].js %} @@ -62,7 +60,8 @@ {% assign js = 'commons' %} {% endcase %} -{% capture script %}{{ js_dist }}{{ js }}.min.js{% endcapture %} +{% capture script %}/assets/js/dist/{{ js }}.min.js{% endcapture %} + {% if page.math %} @@ -93,7 +92,7 @@ {% if jekyll.environment == 'production' %} {% if site.pwa.enabled %} - + {% endif %} diff --git a/_javascript/_copyright b/_javascript/_copyright deleted file mode 100644 index 60a706be6..000000000 --- a/_javascript/_copyright +++ /dev/null @@ -1 +0,0 @@ -Chirpy v<%= pkg.version %> | © 2019 <%= pkg.author %> | <%= pkg.license %> Licensed | <%= pkg.homepage %> diff --git a/_javascript/pwa/_frontmatter b/_javascript/pwa/_frontmatter deleted file mode 100644 index 97ecf0a6b..000000000 --- a/_javascript/pwa/_frontmatter +++ /dev/null @@ -1,3 +0,0 @@ ---- -permalink: /:basename ---- diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 91d618c15..2c77572bc 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| - f.match(%r!^((_(includes|layouts|sass|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) + f.match(%r!^((_(includes|layouts|sass|app|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) } spec.metadata = { diff --git a/package.json b/package.json index 574898657..21cab3643 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "author": "Cotes Chung", "license": "MIT", + "since": 2019, "bugs": { "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" }, @@ -43,7 +44,6 @@ "husky": "^9.0.11", "purgecss": "^6.0.0", "rollup": "^4.18.0", - "rollup-plugin-license": "^3.4.0", "semantic-release": "^24.0.0", "stylelint": "^16.6.1", "stylelint-config-standard-scss": "^13.1.0" diff --git a/rollup.config.js b/rollup.config.js index 823401e0d..94507b925 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,38 +1,43 @@ import babel from '@rollup/plugin-babel'; import terser from '@rollup/plugin-terser'; -import license from 'rollup-plugin-license'; import { nodeResolve } from '@rollup/plugin-node-resolve'; -import fs from 'fs'; -import path from 'path'; import yaml from '@rollup/plugin-yaml'; +import fs from 'fs'; +import pkg from './package.json'; const SRC_DEFAULT = '_javascript'; const DIST_DEFAULT = 'assets/js/dist'; + const SRC_PWA = `${SRC_DEFAULT}/pwa`; +const DIST_PWA = '_app'; + +const banner = `/*! + * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} + */`; const isProd = process.env.BUILD === 'production'; -if (fs.existsSync(DIST_DEFAULT)) { - fs.rm(DIST_DEFAULT, { recursive: true, force: true }, (err) => { - if (err) { - throw err; - } - }); +function cleanup(...directories) { + for (const dir of directories) { + fs.rm(dir, { recursive: true, force: true }, (err) => { + if (err) { + console.error(`Failed to remove directory ${dir}: ${err}`); + } + }); + } } function build(filename, opts = {}) { const src = opts.src || SRC_DEFAULT; const dist = opts.dist || DIST_DEFAULT; - const bannerUrl = - opts.bannerUrl || path.join(__dirname, SRC_DEFAULT, '_copyright'); - const commentStyle = opts.commentStyle || 'ignored'; return { - input: [`${src}/${filename}.js`], + input: `${src}/${filename}.js`, output: { file: `${dist}/${filename}.min.js`, format: 'iife', name: 'Chirpy', + banner, sourcemap: !isProd }, watch: { @@ -46,18 +51,13 @@ function build(filename, opts = {}) { }), nodeResolve(), yaml(), - isProd && commentStyle === 'none' && terser(), - license({ - banner: { - commentStyle, - content: { file: bannerUrl } - } - }), - isProd && commentStyle !== 'none' && terser() + isProd && terser() ] }; } +cleanup(DIST_DEFAULT, DIST_PWA); + export default [ build('commons'), build('home'), @@ -65,10 +65,6 @@ export default [ build('page'), build('post'), build('misc'), - build('app', { src: SRC_PWA }), - build('sw', { - src: SRC_PWA, - bannerUrl: path.join(__dirname, SRC_PWA, '_frontmatter'), - commentStyle: 'none' - }) + build('app', { src: SRC_PWA, dist: DIST_PWA }), + build('sw', { src: SRC_PWA, dist: DIST_PWA }) ]; diff --git a/tools/init.sh b/tools/init.sh index ed478d793..c0c4e183b 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -92,7 +92,7 @@ init_files() { npm i && npm run build # track the CSS/JS output - _sedi "/.*\/dist$/d" .gitignore + _sedi "/.*\/dist$/d;/^_app$/d" .gitignore } commit() { diff --git a/tools/release.sh b/tools/release.sh index 6d010b631..e505f1a28 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -17,6 +17,7 @@ CONFIG="_config.yml" CSS_DIST="_sass/dist" JS_DIST="assets/js/dist" +PWA_DIST="_app" FILES=( "$GEM_SPEC" @@ -111,20 +112,13 @@ prepare() { ## Build a Gem package build_gem() { - if $opt_pkg; then - BACKUP_PATH="$(mktemp -d)" - mkdir -p "$BACKUP_PATH"/css "$BACKUP_PATH"/js - [[ -d $CSS_DIST ]] && cp "$CSS_DIST"/* "$BACKUP_PATH"/css - [[ -d $JS_DIST ]] && cp "$JS_DIST"/* "$BACKUP_PATH"/js - fi - # Remove unnecessary theme settings sed -i -E "s/(^timezone:).*/\1/;s/(^cdn:).*/\1/;s/(^avatar:).*/\1/" $CONFIG rm -f ./*.gem npm run build # add CSS/JS distribution files to gem package - git add "$CSS_DIST" "$JS_DIST" -f + git add "$CSS_DIST" "$JS_DIST" "$PWA_DIST" -f echo -e "\n> gem build $GEM_SPEC\n" gem build "$GEM_SPEC" @@ -132,14 +126,6 @@ build_gem() { echo -e "\n> Resume file changes ...\n" git reset git checkout . - - if $opt_pkg; then - # restore the dist files for future development - mkdir -p "$CSS_DIST" "$JS_DIST" - cp "$BACKUP_PATH"/css/* "$CSS_DIST" - cp "$BACKUP_PATH"/js/* "$JS_DIST" - rm -rf "$BACKUP_PATH" - fi } # Push the gem to RubyGems.org (using $GEM_HOST_API_KEY) From cf853f14e4acb3deb097c57ef151b20f47ed84cb Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:27:54 +0800 Subject: [PATCH 09/42] chore: upgrade `husky` v9 settings --- .husky/commit-msg | 5 +---- package.json | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 100755 => 100644 .husky/commit-msg diff --git a/.husky/commit-msg b/.husky/commit-msg old mode 100755 new mode 100644 index 7f23494bf..0a4b97de5 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx --no -- commitlint --edit ${1} +npx --no -- commitlint --edit $1 diff --git a/package.json b/package.json index 21cab3643..d6f442b61 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "watch:js": "rollup -c --bundleConfigAsCjs -w", "lint:scss": "stylelint _sass/**/*.scss", "lint:fix:scss": "npm run lint:scss -- --fix", - "test": "npm run lint:scss" + "test": "npm run lint:scss", + "prepare": "husky" }, "dependencies": { "@popperjs/core": "^2.11.8", From f1d35832f425814cf0ee5dd3513597999bb31fc0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:45:59 +0800 Subject: [PATCH 10/42] build(devcontainer): add omz plugins & verify extension signature VSCode fixed signature validation hangs in v1.90 --- .devcontainer/devcontainer.json | 4 +--- .devcontainer/post-create.sh | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a891b7ee5..39c428df4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,9 +6,7 @@ "customizations": { "vscode": { "settings": { - "terminal.integrated.defaultProfile.linux": "zsh", - // Speed up extension installation - "extensions.verifySignature": false + "terminal.integrated.defaultProfile.linux": "zsh" }, "extensions": [ // Liquid tags auto-complete diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 14422cbf0..a4bc28257 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -8,3 +8,11 @@ fi # Install dependencies for shfmt extension curl -sS https://webi.sh/shfmt | sh &>/dev/null + +# Add OMZ plugins +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +sed -i -E "s/^(plugins=\()(git)(\))/\1\2 zsh-syntax-highlighting zsh-autosuggestions\3/" ~/.zshrc + +# Avoid git log use less +echo -e "\nunset LESS" >>~/.zshrc From 0709854dc8f6099d38c2578967a02f73b4be0dc8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 16 Jun 2024 22:25:41 +0800 Subject: [PATCH 11/42] fix: adapt the giscus localization parameter (#1810) --- _includes/comments/giscus.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_includes/comments/giscus.html b/_includes/comments/giscus.html index c8d48e67d..f9becfe96 100644 --- a/_includes/comments/giscus.html +++ b/_includes/comments/giscus.html @@ -17,6 +17,12 @@ initTheme = darkTheme; } + let lang = '{{ site.comments.giscus.lang | default: lang }}'; + {%- comment -%} https://github.com/giscus/giscus/tree/main/locales {%- endcomment -%} + if (lang.length > 2 && !lang.startsWith('zh')) { + lang = lang.slice(0, 2); + } + let giscusAttributes = { src: 'https://giscus.app/client.js', 'data-repo': '{{ site.comments.giscus.repo}}', @@ -29,7 +35,7 @@ 'data-emit-metadata': '0', 'data-theme': initTheme, 'data-input-position': '{{ site.comments.giscus.input_position | default: 'bottom' }}', - 'data-lang': '{{ site.comments.giscus.lang | default: lang }}', + 'data-lang': lang, 'data-loading': 'lazy', crossorigin: 'anonymous', async: '' From 9ca7519239d878258300814a5b201fd5b926a192 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 27 Jun 2024 05:30:53 +0800 Subject: [PATCH 12/42] docs: unify the style of badges --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2cc38073e..32210f532 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&logo=visualstudiocode&message=Open&color=deepskyblue)][open-container]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=visualstudiocode)][open-container]  [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  - [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4e556876a3c54d5e8f2d2857c4f43894)][codacy] + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy] [**Live Demo** →][demo] From c876731901784a72ef9d2e9e2936df65ddff5f61 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 1 Jul 2024 07:02:36 +0800 Subject: [PATCH 13/42] feat(ui): improve visibility of inline code (#1831) --- _sass/addon/syntax.scss | 2 +- _sass/colors/syntax-dark.scss | 2 +- _sass/colors/syntax-light.scss | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index 68796f281..73c66aae5 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -102,7 +102,7 @@ code { &.highlighter-rouge { font-size: $code-font-size; - padding: 3px 5px; + padding: 3px 6px; word-break: break-word; border-radius: 4px; background-color: var(--inline-code-bg); diff --git a/_sass/colors/syntax-dark.scss b/_sass/colors/syntax-dark.scss index d898c651f..eb92204dd 100644 --- a/_sass/colors/syntax-dark.scss +++ b/_sass/colors/syntax-dark.scss @@ -7,7 +7,7 @@ --highlight-bg-color: #151515; --highlighter-rouge-color: #c9def1; --highlight-lineno-color: #808080; - --inline-code-bg: #323238; + --inline-code-bg: rgba(255, 255, 255, 0.05); --code-color: #b0b0b0; --code-header-text-color: #6a6a6a; --code-header-muted-color: #353535; diff --git a/_sass/colors/syntax-light.scss b/_sass/colors/syntax-light.scss index 6562c76f2..76aa66916 100644 --- a/_sass/colors/syntax-light.scss +++ b/_sass/colors/syntax-light.scss @@ -8,17 +8,13 @@ --highlight-bg-color: #f6f8fa; --highlighter-rouge-color: #3f596f; --highlight-lineno-color: #9e9e9e; - --inline-code-bg: #f6f6f7; + --inline-code-bg: rgba(25, 25, 28, 0.05); --code-color: #3a3a3a; --code-header-text-color: #a3a3a3; --code-header-muted-color: #e5e5e5; --code-header-icon-color: #c9c8c8; --clipboard-checked-color: #43c743; - [class^='prompt-'] { - --inline-code-bg: #fbfafa; - } - /* --- Syntax highlight theme from `rougify style github` --- */ .highlight table td { From fbba0a4204f6aea9816b92b357ccd0969d41c53f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 2 Jul 2024 06:00:39 +0800 Subject: [PATCH 14/42] chore: fix typos in project files and docs --- _config.yml | 24 +++++------ .../modules/components/search-display.js | 2 +- _posts/2019-08-08-text-and-typography.md | 8 ++-- _posts/2019-08-08-write-a-new-post.md | 14 +++---- _posts/2019-08-09-getting-started.md | 40 +++++++++---------- _sass/addon/module.scss | 2 +- _sass/colors/typography-dark.scss | 2 +- _sass/colors/typography-light.scss | 2 +- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/_config.yml b/_config.yml index 8e54ea7f7..d862178cf 100644 --- a/_config.yml +++ b/_config.yml @@ -16,20 +16,20 @@ timezone: Asia/Shanghai title: Chirpy # the main title -tagline: A text-focused Jekyll theme # it will display as the sub-title +tagline: A text-focused Jekyll theme # it will display as the subtitle description: >- # used by seo meta and the atom feed A minimal, responsive and feature-rich Jekyll theme for technical writing. # Fill in the protocol & hostname for your site. -# e.g. 'https://username.github.io', note that it does not end with a '/'. +# E.g. 'https://username.github.io', note that it does not end with a '/'. url: "" github: - username: github_username # change to your github username + username: github_username # change to your GitHub username twitter: - username: twitter_username # change to your twitter username + username: twitter_username # change to your Twitter username social: # Change to your full name. @@ -38,8 +38,8 @@ social: email: example@domain.com # change to your email address links: # The first element serves as the copyright owner's link - - https://twitter.com/username # change to your twitter homepage - - https://github.com/username # change to your github homepage + - https://twitter.com/username # change to your Twitter homepage + - https://github.com/username # change to your GitHub homepage # Uncomment below to add more social links # - https://www.facebook.com/username # - https://www.linkedin.com/in/username @@ -71,7 +71,7 @@ analytics: cloudflare: id: # fill in your Cloudflare Web Analytics token -# Pageviews settings +# Page views settings pageviews: provider: # now only supports 'goatcounter' @@ -83,8 +83,8 @@ pageviews: # # Available options: # -# light - Use the light color scheme -# dark - Use the dark color scheme +# light — Use the light color scheme +# dark — Use the dark color scheme # theme_mode: # [light | dark] @@ -106,7 +106,7 @@ social_preview_image: # string, local or CORS resources toc: true comments: - # Global switch for the post comment system. Keeping it empty means disabled. + # Global switch for the post-comment system. Keeping it empty means disabled. provider: # [disqus | utterances | giscus] # The provider options are as follows: disqus: @@ -136,9 +136,9 @@ assets: env: # [development | production] pwa: - enabled: true # the option for PWA feature (installable) + enabled: true # The option for PWA feature (installable) cache: - enabled: true # the option for PWA offline cache + enabled: true # The option for PWA offline cache # Paths defined here will be excluded from the PWA cache. # Usually its value is the `baseurl` of another website that # shares the same domain name as the current website. diff --git a/_javascript/modules/components/search-display.js b/_javascript/modules/components/search-display.js index 21d634efd..40059ac10 100644 --- a/_javascript/modules/components/search-display.js +++ b/_javascript/modules/components/search-display.js @@ -1,5 +1,5 @@ /** - * This script make #search-result-wrapper switch to unloaded or shown automatically. + * This script make #search-result-wrapper switch to unload or shown automatically. */ const btnSbTrigger = document.getElementById('sidebar-trigger'); diff --git a/_posts/2019-08-08-text-and-typography.md b/_posts/2019-08-08-text-and-typography.md index 7064d5d4a..a8db26a00 100644 --- a/_posts/2019-08-08-text-and-typography.md +++ b/_posts/2019-08-08-text-and-typography.md @@ -18,16 +18,16 @@ image: -# H1 - heading +# H1 — heading {: .mt-4 .mb-0 } -## H2 - heading +## H2 — heading {: data-toc-skip='' .mt-4 .mb-0 } -### H3 - heading +### H3 — heading {: data-toc-skip='' .mt-4 .mb-0 } -#### H4 - heading +#### H4 — heading {: data-toc-skip='' .mt-4 } diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index 3ad1438b5..69eaf34ac 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -31,7 +31,7 @@ tags: [TAG] # TAG names should always be lowercase ### Timezone of Date -In order to accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. +To accurately record the release date of a post, you should not only set up the `timezone` of `_config.yml`{: .filepath} but also provide the post's timezone in variable `date` of its Front Matter block. Format: `+/-TTTT`, e.g. `+0800`. ### Categories and Tags @@ -147,7 +147,7 @@ _Image Caption_ #### Size -In order to prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. +To prevent the page content layout from shifting when the image is loaded, we should set the width and height for each image. ```markdown ![Desktop View](/assets/img/sample/mockup.png){: width="700" height="400" } @@ -284,7 +284,7 @@ If you want to embed a video file directly, use the following syntax: {% include embed/video.html src='{URL}' %} ``` -Where `URL` is an URL to a video file e.g. `/path/to/sample/video.mp4`. +Where `URL` is a URL to a video file e.g. `/path/to/sample/video.mp4`. You can also specify additional attributes for the embedded video file. Here is a full list of attributes allowed. @@ -295,7 +295,7 @@ You can also specify additional attributes for the embedded video file. Here is - `muted=true` — audio will be initially silenced - `types` — specify the extensions of additional video formats separated by `|`. Ensure these files exist in the same directory as your primary video file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -318,14 +318,14 @@ If you want to embed an audio file directly, use the following syntax: {% include embed/audio.html src='{URL}' %} ``` -Where `URL` is an URL to an audio file e.g. `/path/to/audio.mp3`. +Where `URL` is a URL to an audio file e.g. `/path/to/audio.mp3`. You can also specify additional attributes for the embedded audio file. Here is a full list of attributes allowed. - `title='Text'` — title for an audio that appears below the audio and looks same as for images - `types` — specify the extensions of additional audio formats separated by `|`. Ensure these files exist in the same directory as your primary audio file. -Consider an example utilizing all of the above: +Consider an example using all of the above: ```liquid {% @@ -365,7 +365,7 @@ There are several types of prompts: `tip`, `info`, `warning`, and `danger`. They ``` {: .nolineno } -### Filepath Hightlight +### Filepath Highlight ```md `/path/to/a/file.extend`{: .filepath} diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 3e0327a7e..3cad3839a 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -60,7 +60,7 @@ $ bundle ### Configuration -Update the variables of `_config.yml`{: .filepath} as needed. Some of them are typical options: +Update the variables in `_config.yml`{: .filepath} as needed. Some typical options include: - `url` - `avatar` @@ -69,17 +69,17 @@ Update the variables of `_config.yml`{: .filepath} as needed. Some of them are t ### Social Contact Options -Social contact options are displayed at the bottom of the sidebar. You can turn on/off the specified contacts in file `_data/contact.yml`{: .filepath }. +Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing Stylesheet +### Customizing the Stylesheet -If you need to customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} to the same path on your Jekyll site, and then add the custom style at the end of it. +To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. -Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main sass file `_sass/main.scss`{: .filepath} into the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign new value. +Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customing Static Assets +### Customizing Static Assets -Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined by file `_data/origin/cors.yml`{: .filepath }, and you can replace some of them according to the network conditions in the region where your website is published. +Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on to the network conditions in the region where your website is published. Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme). @@ -95,42 +95,42 @@ After a few seconds, the local service will be published at _ Date: Thu, 4 Jul 2024 01:42:29 +0800 Subject: [PATCH 15/42] refactor: fix typos in locale variable statment -> statement --- _data/locales/ar.yml | 2 +- _data/locales/bg-BG.yml | 2 +- _data/locales/cs-CZ.yml | 2 +- _data/locales/de-DE.yml | 4 ++-- _data/locales/el-GR.yml | 2 +- _data/locales/en.yml | 2 +- _data/locales/es-ES.yml | 2 +- _data/locales/fi-FI.yml | 2 +- _data/locales/fr-FR.yml | 2 +- _data/locales/hu-HU.yml | 2 +- _data/locales/id-ID.yml | 2 +- _data/locales/it-IT.yml | 2 +- _data/locales/ko-KR.yml | 2 +- _data/locales/my-MM.yml | 2 +- _data/locales/pt-BR.yml | 2 +- _data/locales/ru-RU.yml | 4 ++-- _data/locales/sl-SI.yml | 2 +- _data/locales/sv-SE.yml | 2 +- _data/locales/th.yml | 2 +- _data/locales/tr-TR.yml | 2 +- _data/locales/uk-UA.yml | 2 +- _data/locales/vi-VN.yml | 2 +- _data/locales/zh-CN.yml | 2 +- _data/locales/zh-TW.yml | 2 +- assets/404.html | 2 +- 25 files changed, 27 insertions(+), 27 deletions(-) diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml index c60829813..a79e02009 100644 --- a/_data/locales/ar.yml +++ b/_data/locales/ar.yml @@ -43,7 +43,7 @@ copyright: meta: باستخدام :PLATFORM السمة :THEME not_found: - statment: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. + statement: عذرا, الرابط التالي غير صالح أو انه يشير إلى صفحة غير موجودة. notification: update_found: يتوفر اصدار جديد للمحتوى. diff --git a/_data/locales/bg-BG.yml b/_data/locales/bg-BG.yml index 3e049938b..3fb060fda 100644 --- a/_data/locales/bg-BG.yml +++ b/_data/locales/bg-BG.yml @@ -43,7 +43,7 @@ copyright: meta: Създадено чрез :PLATFORM и :THEME тема not_found: - statment: Съжалявам, но на този URL адрес няма налично съдържание. + statement: Съжалявам, но на този URL адрес няма налично съдържание. notification: update_found: Налична е нова версия на съдържанието. diff --git a/_data/locales/cs-CZ.yml b/_data/locales/cs-CZ.yml index e515c08ff..cf93f614a 100644 --- a/_data/locales/cs-CZ.yml +++ b/_data/locales/cs-CZ.yml @@ -43,7 +43,7 @@ copyright: meta: Použití :PLATFORM s motivem :THEME not_found: - statment: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. + statement: Omlouváme se, adresu URL jsme špatně umístili nebo odkazuje na něco, co neexistuje. notification: update_found: Je k dispozici nová verze obsahu. diff --git a/_data/locales/de-DE.yml b/_data/locales/de-DE.yml index 6b187b4c6..6c9d91d46 100644 --- a/_data/locales/de-DE.yml +++ b/_data/locales/de-DE.yml @@ -42,7 +42,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. + statement: Entschuldigung, dieser Link verweist auf keine vorhandene Ressource. notification: update_found: Eine neue Version ist verfügbar. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/el-GR.yml b/_data/locales/el-GR.yml index ab5fb0e7c..b6d2a8663 100644 --- a/_data/locales/el-GR.yml +++ b/_data/locales/el-GR.yml @@ -43,7 +43,7 @@ copyright: meta: Αξιοποιώντας την :PLATFORM theme :THEME not_found: - statment: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. + statement: Συγνώμη, έχουμε τοποθετήσει λάθος αυτήν την διεύθυνση URL ή υποδεικνύει κάτι που δεν υπάρχει. notification: update_found: Υπάρχει διαθέσιμη μια νέα έκδοση του περιεχομένου. diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 0dbe7136c..152d090ac 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -43,7 +43,7 @@ copyright: meta: Using the :THEME theme for :PLATFORM. not_found: - statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: A new version of content is available. diff --git a/_data/locales/es-ES.yml b/_data/locales/es-ES.yml index 552923086..8f8d149ea 100644 --- a/_data/locales/es-ES.yml +++ b/_data/locales/es-ES.yml @@ -43,7 +43,7 @@ copyright: meta: Hecho con :PLATFORM usando el tema :THEME not_found: - statment: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. + statement: Lo sentimos, hemos perdido esa URL o apunta a algo que no existe. notification: update_found: Hay una nueva versión de contenido disponible. diff --git a/_data/locales/fi-FI.yml b/_data/locales/fi-FI.yml index c817d2b85..60c986205 100644 --- a/_data/locales/fi-FI.yml +++ b/_data/locales/fi-FI.yml @@ -42,7 +42,7 @@ copyright: meta: Käytetään :PLATFORM iä Teema :THEME not_found: - statment: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. + statement: Valitettavasti tällä URL-osoitteella ei ole saatavilla sisältöä. notification: update_found: Uusi versio sisällöstä on saatavilla. diff --git a/_data/locales/fr-FR.yml b/_data/locales/fr-FR.yml index 72b034db2..3f3c9a0c9 100644 --- a/_data/locales/fr-FR.yml +++ b/_data/locales/fr-FR.yml @@ -43,7 +43,7 @@ copyright: meta: Propulsé par :PLATFORM avec le thème :THEME not_found: - statment: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. + statement: Désolé, nous avons égaré cette URL ou elle pointe vers quelque chose qui n'existe pas. notification: update_found: Une nouvelle version du contenu est disponible. diff --git a/_data/locales/hu-HU.yml b/_data/locales/hu-HU.yml index b09f2cdc9..53d88e96e 100644 --- a/_data/locales/hu-HU.yml +++ b/_data/locales/hu-HU.yml @@ -45,7 +45,7 @@ copyright: meta: Készítve :PLATFORM motorral :THEME témával not_found: - statment: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. + statement: Sajnáljuk, az URL-t rosszul helyeztük el, vagy valami nem létezőre mutat. notification: update_found: Elérhető a tartalom új verziója. diff --git a/_data/locales/id-ID.yml b/_data/locales/id-ID.yml index 29ad15695..d772ec34f 100644 --- a/_data/locales/id-ID.yml +++ b/_data/locales/id-ID.yml @@ -43,7 +43,7 @@ copyright: meta: Didukung oleh :PLATFORM dengan tema :THEME not_found: - statment: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. + statement: Maaf, kami gagal menemukan URL itu atau memang mengarah ke sesuatu yang tidak ada. notification: update_found: Versi konten baru tersedia. diff --git a/_data/locales/it-IT.yml b/_data/locales/it-IT.yml index cf7b691bc..c8dfb447c 100644 --- a/_data/locales/it-IT.yml +++ b/_data/locales/it-IT.yml @@ -42,7 +42,7 @@ copyright: meta: Servizio offerto da :PLATFORM con tema :THEME not_found: - statment: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. + statement: Ci scusiamo, non è stato possibile trovare l'URL in questione. Potrebbe puntare ad una pagina non esistente. notification: update_found: Nuova versione del contenuto disponibile. diff --git a/_data/locales/ko-KR.yml b/_data/locales/ko-KR.yml index 4dd221b9b..82976349c 100644 --- a/_data/locales/ko-KR.yml +++ b/_data/locales/ko-KR.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: 해당 URL은 존재하지 않습니다. + statement: 해당 URL은 존재하지 않습니다. notification: update_found: 새 버전의 콘텐츠를 사용할 수 있습니다. diff --git a/_data/locales/my-MM.yml b/_data/locales/my-MM.yml index 98848d59b..d5bf728f9 100644 --- a/_data/locales/my-MM.yml +++ b/_data/locales/my-MM.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ + statement: ဝမ်းနည်းပါသည်၊ ကျွန်ုပ်တို့သည် အဆိုပါ URL ကို မှားယွင်းစွာ နေရာချထားခြင်း သို့မဟုတ် ၎င်းသည် မရှိသောအရာကို ညွှန်ပြနေပါသည်။ notification: update_found: အကြောင်းအရာဗားရှင်းအသစ်ကို ရနိုင်ပါပြီ။ diff --git a/_data/locales/pt-BR.yml b/_data/locales/pt-BR.yml index 4cef833d2..7ca60a74b 100644 --- a/_data/locales/pt-BR.yml +++ b/_data/locales/pt-BR.yml @@ -43,7 +43,7 @@ copyright: meta: Feito com :PLATFORM usando o tema :THEME not_found: - statment: Desculpe, a página não foi encontrada. + statement: Desculpe, a página não foi encontrada. notification: update_found: Uma nova versão do conteúdo está disponível. diff --git a/_data/locales/ru-RU.yml b/_data/locales/ru-RU.yml index 185407c13..868ba9578 100644 --- a/_data/locales/ru-RU.yml +++ b/_data/locales/ru-RU.yml @@ -42,7 +42,7 @@ copyright: meta: Использует тему :THEME для :PLATFORM not_found: - statment: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. + statement: Извините, мы перепутали URL-адрес или он указывает на что-то несуществующее. notification: update_found: Доступна новая версия контента. @@ -76,7 +76,7 @@ df: post: strftime: "%d.%m.%Y" dayjs: "DD.MM.YYYY" - + # categories page categories: category_measure: diff --git a/_data/locales/sl-SI.yml b/_data/locales/sl-SI.yml index 7ab18b1de..4d9434d44 100644 --- a/_data/locales/sl-SI.yml +++ b/_data/locales/sl-SI.yml @@ -43,7 +43,7 @@ copyright: meta: Uporabljena :PLATFORM tema :THEME #Using the :PLATFORM theme :THEME not_found: - statment: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. + statement: Oprostite, hiperpovezava je neustrezna ali vsebina ne obstajata. #Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. notification: update_found: Novejša različica vsebine je na voljo. #A new version of content is available. diff --git a/_data/locales/sv-SE.yml b/_data/locales/sv-SE.yml index 7ec2ee233..decb59cf3 100644 --- a/_data/locales/sv-SE.yml +++ b/_data/locales/sv-SE.yml @@ -43,7 +43,7 @@ copyright: meta: Byggd med :PLATFORM och temat :THEME not_found: - statment: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. + statement: Ursäkta, vi har tappat bort den här webbadressen eller så pekar den på något som inte längre finns. notification: update_found: Det finns en ny version av innehållet. diff --git a/_data/locales/th.yml b/_data/locales/th.yml index 22cb00aa5..a3f41a0e1 100644 --- a/_data/locales/th.yml +++ b/_data/locales/th.yml @@ -43,7 +43,7 @@ copyright: meta: กำลังใช้ธีมของ :PLATFORM ชื่อ :THEME not_found: - statment: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ + statement: ขออภัย เราวาง URL นั้นไว้ผิดที่ หรือมันชี้ไปยังสิ่งที่ไม่มีอยู่ notification: update_found: มีเวอร์ชันใหม่ของเนื้อหา diff --git a/_data/locales/tr-TR.yml b/_data/locales/tr-TR.yml index 50d81102f..768f57cd1 100644 --- a/_data/locales/tr-TR.yml +++ b/_data/locales/tr-TR.yml @@ -43,7 +43,7 @@ copyright: meta: :PLATFORM ve :THEME teması not_found: - statment: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. + statement: Üzgünüz, bu linki yanlış yerleştirdik veya var olmayan bir şeye işaret ediyor. notification: update_found: İçeriğin yeni bir sürümü mevcut. diff --git a/_data/locales/uk-UA.yml b/_data/locales/uk-UA.yml index b60507380..8fef52e85 100644 --- a/_data/locales/uk-UA.yml +++ b/_data/locales/uk-UA.yml @@ -43,7 +43,7 @@ copyright: meta: Powered by :PLATFORM with :THEME theme not_found: - statment: Вибачте, це посилання вказує на ресурс, що не існує. + statement: Вибачте, це посилання вказує на ресурс, що не існує. notification: update_found: Доступна нова версія вмісту. diff --git a/_data/locales/vi-VN.yml b/_data/locales/vi-VN.yml index 617431a0b..6c2ceffde 100644 --- a/_data/locales/vi-VN.yml +++ b/_data/locales/vi-VN.yml @@ -42,7 +42,7 @@ copyright: meta: Trang web này được tạo bởi :PLATFORM với chủ đề :THEME not_found: - statment: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. + statement: Xin lỗi, chúng tôi đã đặt nhầm URL hoặc đường dẫn trỏ đến một trang nào đó không tồn tại. notification: update_found: Đã có phiên bản mới của nội dung. diff --git a/_data/locales/zh-CN.yml b/_data/locales/zh-CN.yml index f82813467..5c1341018 100644 --- a/_data/locales/zh-CN.yml +++ b/_data/locales/zh-CN.yml @@ -42,7 +42,7 @@ copyright: meta: 本站采用 :PLATFORM 主题 :THEME not_found: - statment: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 + statement: 抱歉,我们放错了该 URL,或者它指向了不存在的内容。 notification: update_found: 发现新版本的内容。 diff --git a/_data/locales/zh-TW.yml b/_data/locales/zh-TW.yml index 911253b6a..33a4330bb 100644 --- a/_data/locales/zh-TW.yml +++ b/_data/locales/zh-TW.yml @@ -42,7 +42,7 @@ copyright: meta: 本網站使用 :PLATFORM 產生,採用 :THEME 主題 not_found: - statment: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 + statement: 抱歉,您可能正在存取一個已被移動的 URL,或者它從未存在。 notification: update_found: 發現新版本更新。 diff --git a/assets/404.html b/assets/404.html index 5b46cc8c8..af89d6d1a 100644 --- a/assets/404.html +++ b/assets/404.html @@ -11,4 +11,4 @@ redirect_from: {% include lang.html %} -

{{ site.data.locales[lang].not_found.statment }}

+

{{ site.data.locales[lang].not_found.statement }}

From db9e58bab23f5cc4993efa36d90ae390be7d6e3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:49:30 +0800 Subject: [PATCH 16/42] build(deps-dev): bump the dev-deps group with 3 updates (#1824) Updates the requirements on [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core), [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties) and [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) to permit the latest version. Updates `@babel/core` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-core) Updates `@babel/plugin-transform-class-properties` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-plugin-transform-class-properties) Updates `@babel/preset-env` to 7.24.7 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.7/packages/babel-preset-env) --- updated-dependencies: - dependency-name: "@babel/core" dependency-type: direct:development dependency-group: dev-deps - dependency-name: "@babel/plugin-transform-class-properties" dependency-type: direct:development dependency-group: dev-deps - dependency-name: "@babel/preset-env" dependency-type: direct:development dependency-group: dev-deps ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d6f442b61..7d4835f37 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.6", - "@babel/plugin-transform-class-properties": "^7.24.6", - "@babel/preset-env": "^7.24.6", + "@babel/core": "^7.24.7", + "@babel/plugin-transform-class-properties": "^7.24.7", + "@babel/preset-env": "^7.24.7", "@commitlint/cli": "^19.3.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", From a07a57ec922249d3a22da56fbcb30d83eadef728 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 4 Jul 2024 02:21:22 +0800 Subject: [PATCH 17/42] feat(ui): make `info-prompt` icon looks like the letter "i" (#1835) --- _sass/addon/commons.scss | 4 ++-- _sass/addon/module.scss | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index e6cf7c269..4087d241f 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -107,8 +107,8 @@ blockquote { } } - @include prompt('tip', '\f0eb', 'regular'); - @include prompt('info', '\f06a'); + @include prompt('tip', '\f0eb', $fa-style: 'regular'); + @include prompt('info', '\f06a', $rotate: 180); @include prompt('warning', '\f06a'); @include prompt('danger', '\f071'); } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index edc5f3ef6..9e85adc0d 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -187,7 +187,7 @@ transform: translateX(-50%); } -@mixin prompt($type, $fa-content, $fa-style: 'solid') { +@mixin prompt($type, $fa-content, $fa-style: 'solid', $rotate: 0) { &.prompt-#{$type} { background-color: var(--prompt-#{$type}-bg); @@ -195,6 +195,10 @@ content: $fa-content; color: var(--prompt-#{$type}-icon-color); font: var(--fa-font-#{$fa-style}); + + @if $rotate != 0 { + transform: rotate(#{$rotate}deg); + } } } } From 8673e1335f0771eac364d0a2866f27476d61a58b Mon Sep 17 00:00:00 2001 From: Daniel Singleton <48238314+goodnightdaniel@users.noreply.github.com> Date: Fri, 5 Jul 2024 05:03:01 -0700 Subject: [PATCH 18/42] feat: add Reddit social option (#1836) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index d6819e0de..87df46067 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -30,3 +30,7 @@ # - type: bluesky # icon: 'fa-brands fa-bluesky' # url: '' # Fill with your Bluesky profile link +# +# - type: reddit +# icon: 'fa-brands fa-reddit' +# url: '' # Fill with your Reddit profile link diff --git a/_data/share.yml b/_data/share.yml index 0aa28fd42..04bac44c6 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -40,3 +40,7 @@ platforms: # - type: Bluesky # icon: "fa-brands fa-bluesky" # link: "https://bsky.app/intent/compose?text=TITLE%20URL" + # + # - type: Reddit + # icon: "fa-brands fa-square-reddit" + # link: "https://www.reddit.com/submit?url=URL&title=TITLE" From e3a78b6243f7056105d72185bb6e94b436834e5b Mon Sep 17 00:00:00 2001 From: Daniel Singleton <48238314+goodnightdaniel@users.noreply.github.com> Date: Fri, 5 Jul 2024 13:53:02 -0700 Subject: [PATCH 19/42] feat: add Threads social links (#1837) --- _data/contact.yml | 4 ++++ _data/share.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/_data/contact.yml b/_data/contact.yml index 87df46067..ed40acb7e 100644 --- a/_data/contact.yml +++ b/_data/contact.yml @@ -34,3 +34,7 @@ # - type: reddit # icon: 'fa-brands fa-reddit' # url: '' # Fill with your Reddit profile link +# +# - type: threads +# icon: 'fa-brands fa-threads' +# url: '' # Fill with your Threads profile link diff --git a/_data/share.yml b/_data/share.yml index 04bac44c6..6f9756804 100644 --- a/_data/share.yml +++ b/_data/share.yml @@ -44,3 +44,7 @@ platforms: # - type: Reddit # icon: "fa-brands fa-square-reddit" # link: "https://www.reddit.com/submit?url=URL&title=TITLE" + # + # - type: Threads + # icon: "fa-brands fa-square-threads" + # link: "https://www.threads.net/intent/post?text=TITLE%20URL" From e4db1a176f3f69f676cbc0bf27b1d5a657ece05e Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Thu, 11 Jul 2024 00:14:47 +0400 Subject: [PATCH 20/42] feat(dev): add vscode tasks (#1843) --- .gitignore | 1 + .vscode/tasks.json | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index 104d05318..5d05699cf 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ package-lock.json .vscode/* !.vscode/settings.json !.vscode/extensions.json +!.vscode/tasks.json # Misc _sass/dist diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..99ed5c5b7 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,64 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Jekyll Server", + "type": "shell", + "command": "./tools/run.sh", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "detail": "Runs the Jekyll server with live reload." + }, + { + "label": "Build Jekyll Site", + "type": "shell", + "command": "./tools/test.sh", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build the Jekyll site for production." + }, + { + "label": "Build JS (watch)", + "type": "shell", + "command": "npm run watch:js", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS files in watch mode." + }, + { + "label": "Build CSS", + "type": "shell", + "command": "npm run build:css", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build CSS files." + }, + { + "label": "Build JS & CSS", + "type": "shell", + "command": "npm run build", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS & CSS for production." + }, + { + "label": "Run Jekyll Server + Build JS (watch)", + "dependsOn": ["Run Jekyll Server", "Build JS (watch)"], + "group": { + "kind": "build" + }, + "detail": "Runs both the Jekyll server with live reload and build JS files in watch mode." + } + ] +} From 8c30f0a9c349eb039bc7fa151ed140e2eb26a643 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 12 Jul 2024 02:03:52 +0800 Subject: [PATCH 21/42] build(dev): support for running tasks in macOS --- .vscode/settings.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 787a0c844..1d784c0e4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,5 +23,9 @@ "less.validate": false, // Stylint extension settings "stylelint.snippet": ["css", "scss"], - "stylelint.validate": ["css", "scss"] + "stylelint.validate": ["css", "scss"], + // Run tasks in macOS + "terminal.integrated.profiles.osx": { + "zsh": { "path": "/bin/zsh", "args": ["-l", "-i"] } + } } From 979f86cf64e1fcace4231fb070c7e6398fd4e5ec Mon Sep 17 00:00:00 2001 From: Alexander Fuks Date: Wed, 17 Jul 2024 19:32:48 +0400 Subject: [PATCH 22/42] fix: avoid caching pageviews data (#1849) --- _javascript/pwa/sw.js | 16 ++++++++++++++-- assets/js/data/swconf.js | 26 ++++++++++++++++++-------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/_javascript/pwa/sw.js b/_javascript/pwa/sw.js index bc67bd830..94b64bf7c 100644 --- a/_javascript/pwa/sw.js +++ b/_javascript/pwa/sw.js @@ -3,11 +3,23 @@ import { baseurl } from '../../_config.yml'; importScripts(`${baseurl}/assets/js/data/swconf.js`); const purge = swconf.purge; +const interceptor = swconf.interceptor; function verifyUrl(url) { - const requestPath = new URL(url).pathname; + const requestUrl = new URL(url); + const requestPath = requestUrl.pathname; - for (const path of swconf.denyPaths) { + if (!requestUrl.protocol.startsWith('http')) { + return false; + } + + for (const prefix of interceptor.urlPrefixes) { + if (requestUrl.href.startsWith(prefix)) { + return false; + } + } + + for (const path of interceptor.paths) { if (requestPath.startsWith(path)) { return false; } diff --git a/assets/js/data/swconf.js b/assets/js/data/swconf.js index 5c1ed2920..798888a99 100644 --- a/assets/js/data/swconf.js +++ b/assets/js/data/swconf.js @@ -22,14 +22,24 @@ const swconf = { {% endfor %} ], - {%- comment -%} The request url with below path will not be cached. {%- endcomment -%} - denyPaths: [ - {% for path in site.pwa.cache.deny_paths %} - {% unless path == empty %} - '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} - {% endunless %} - {% endfor %} - ], + interceptor: { + {%- comment -%} URLs containing the following paths will not be cached. {%- endcomment -%} + paths: [ + {% for path in site.pwa.cache.deny_paths %} + {% unless path == empty %} + '{{ path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%} + {% endunless %} + {% endfor %} + ], + + {%- comment -%} URLs containing the following prefixes will not be cached. {%- endcomment -%} + urlPrefixes: [ + {% if site.analytics.goatcounter.id != nil and site.pageviews.provider == 'goatcounter' %} + 'https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/' + {% endif %} + ] + }, + purge: false {% else %} purge: true From b641b364809ea15c46d16ce1379a267d395d55d0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 18 Jul 2024 01:20:17 +0800 Subject: [PATCH 23/42] ci: set node version to LTS There are some problems with the latest version. See: https://github.com/cotes2020/jekyll-theme-chirpy/actions/runs/9977150040 --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/style-lint.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d0cc84a36..4f2da0e36 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm install - run: npx semantic-release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca60bd679..50a158b10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - name: Build Assets run: npm i && npm run build diff --git a/.github/workflows/style-lint.yml b/.github/workflows/style-lint.yml index a2cf4f69b..f84f3bcc4 100644 --- a/.github/workflows/style-lint.yml +++ b/.github/workflows/style-lint.yml @@ -18,6 +18,6 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: latest + node-version: lts/* - run: npm i - run: npm test From 5c5910f1fc661ec3dce203ac961c7f64f1991895 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 29 Jul 2024 12:17:11 +0800 Subject: [PATCH 24/42] fix: remove extra dual-mode images from lightbox (#1883) --- _javascript/modules/components/img-popup.js | 41 +++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index b5c7c6eae..6c3e733ad 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -4,12 +4,47 @@ * Dependencies: https://github.com/biati-digital/glightbox */ -const IMG_CLASS = 'popup'; +const html = document.documentElement; +const lightImages = '.popup:not(.dark)'; +const darkImages = '.popup:not(.light)'; +let selector = lightImages; + +function updateImages(lightbox) { + if (selector === lightImages) { + selector = darkImages; + } else { + selector = lightImages; + } + + lightbox.destroy(); + lightbox = GLightbox({ selector: `${selector}` }); +} export function imgPopup() { - if (document.getElementsByClassName(IMG_CLASS).length === 0) { + if (document.querySelector('.popup') === null) { return; } - GLightbox({ selector: `.${IMG_CLASS}` }); + if ( + (html.hasAttribute('data-mode') && + html.getAttribute('data-mode') === 'dark') || + (!html.hasAttribute('data-mode') && + window.matchMedia('(prefers-color-scheme: dark)').matches) + ) { + selector = darkImages; + } + + let lightbox = GLightbox({ selector: `${selector}` }); + + if (document.getElementById('mode-toggle')) { + window.addEventListener('message', (event) => { + if ( + event.source === window && + event.data && + event.data.direction === ModeToggle.ID + ) { + updateImages(lightbox); + } + }); + } } From 35fdea0c4fa6faa927dd1346b1def9d6531ce003 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:25:55 +0800 Subject: [PATCH 25/42] docs: add devcontainers tutorial (#1844) --- _posts/2019-08-09-getting-started.md | 100 ++++++++++++++------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 3cad3839a..6cbd4e694 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -11,50 +11,59 @@ pin: true media_subpath: '/posts/20180809' --- -## Prerequisites +## Creating a site repository -Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. [Git](https://git-scm.com/) also needs to be installed. +There are two methods to create a site repository for **Chirpy**: -## Installation +- [**Using the starter**](#option-1-using-the-starter) — This approach simplifies upgrades and isolates unnecessary project files, enabling you to concentrate on your content. It's ideal for those who want a hassle-free setup focused primarily on writing. +- [**Forking the theme**](#option-2-forking-the-theme) — This method allows for customization and development but presents challenges during upgrades. It is not recommended to use this approach unless you are familiar with Jekyll and plan to modify this project. -### Creating a New Site +### Option 1: using the starter -There are two ways to create a new repository for this theme: +1. Sign in to GitHub and navigate to the [**starter**][starter]. +2. Click the Use this template button and then select Create a new repository. -- [**Using the Chirpy Starter**](#option-1-using-the-chirpy-starter) — Easy to upgrade, isolates irrelevant project files so you can focus on writing. -- [**GitHub Fork**](#option-2-github-fork) — Convenient for custom development, but difficult to upgrade. Unless you are familiar with Jekyll and are determined to tweak or contribute to this project, this approach is not recommended. +### Option 2: forking the theme -#### Option 1. Using the Chirpy Starter +Sign in to GitHub and [fork the theme](https://github.com/cotes2020/jekyll-theme-chirpy/fork). -Sign in to GitHub and browse to [**Chirpy Starter**][starter], click the button Use this template > Create a new repository, and name the new repository `USERNAME.github.io`, where `USERNAME` represents your GitHub username. +## Name your new repository -#### Option 2. GitHub Fork +Rename your repository to `.github.io`. The `username` represents your lowercase GitHub username. -Sign in to GitHub to [fork **Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/fork), and then rename it to `USERNAME.github.io` (`USERNAME` means your username). +## Setting up the environment -Next, clone the repository to your local machine, make sure it has [Node.js][nodejs] installed, then go to the root directory of the repo and run the following command: +The easiest way to set up the runtime environment, especially on Windows, is by using [Dev Containers](#setting-up-in-dev-containers). This method installs all packages within a Docker container, isolating them from the host machine and ensuring no interference with existing settings. + +For Unix-like systems, besides using Dev Containers, you can also [natively set up](#setting-up-natively) the runtime environment to achieve optimal performance. + +### Setting up in Dev Containers + +1. Install Docker: + - On Windows/macOS, install [Docker Desktop][docker-desktop]. + - On Linux, install [Docker Engine][docker-engine]. +2. Install [VS Code][vscode] and the [Dev Containers extension][dev-containers]. +3. Clone your repository: + - For Docker Desktop: Start VS Code and [clone your repo in a container volume][dc-clone-in-vol]. + - For Docker Engine: Clone your repo to the local disk, then launch VS Code and [open your repo in the container][dc-open-in-container]. +4. Wait a few minutes for Dev Containers to finish installing. + +### Setting up natively + +1. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. Ensure that [Git](https://git-scm.com/) is also installed. +2. Clone your repository to a local disk. +3. If your site is created by forking the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory. This will initialize the repository files and create a commit to save the changes. +4. Install the dependencies by running `bundle`. + +### Start the local server + +To run the site locally, use the following command: ```console -$ bash tools/init.sh +$ bundle exec jekyll s ``` -> If you don't want to deploy your site on GitHub Pages, append option `--no-gh` at the end of the above command. -{: .prompt-info } - -The above command will: - -1. Check out the code to the [latest tag][latest-tag] (to ensure the stability of your site: as the code for the default branch is under development). -2. Remove non-essential sample files and take care of GitHub-related files. -3. Build CSS/JS assets files and then make them tracked by Git. -4. Automatically create a new commit to save the changes above. - -### Installing Dependencies - -Before running local server for the first time, go to the root directory of your site and run: - -```console -$ bundle -``` +After a few seconds, the local server will be available at . ## Usage @@ -67,31 +76,21 @@ Update the variables in `_config.yml`{: .filepath} as needed. Some typical optio - `timezone` - `lang` -### Social Contact Options +### Social contact options Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing the Stylesheet +### Customizing the stylesheet To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customizing Static Assets +### Customizing static assets -Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on to the network conditions in the region where your website is published. +Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. -Also, if you'd like to self-host the static assets, please refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme). - -### Running Local Server - -You may want to preview the site contents before publishing, so just run it by: - -```console -$ bundle exec jekyll s -``` - -After a few seconds, the local service will be published at __. +If you prefer to self-host the static assets, refer to the [_chirpy-static-assets_](https://github.com/cotes2020/chirpy-static-assets#readme) repository. ## Deployment @@ -99,7 +98,7 @@ Before deploying, check the `_config.yml`{: .filepath} file and ensure the `url` Now you can choose _ONE_ of the following methods to deploy your Jekyll site. -### Deploy Using GitHub Actions +### Deploy using GitHub Actions Prepare the following: @@ -120,7 +119,7 @@ Next, configure the _Pages_ service: You can now visit the URL provided by GitHub to access your site. -### Manual Build and Deployment +### Manual build and deployment For self-hosted servers, you will need to build the site on your local machine and then upload the site files to the server. @@ -135,4 +134,9 @@ Unless you specified the output path, the generated site files will be placed in [nodejs]: https://nodejs.org/ [starter]: https://github.com/cotes2020/chirpy-starter [pages-workflow-src]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow -[latest-tag]: https://github.com/cotes2020/jekyll-theme-chirpy/tags +[docker-desktop]: https://www.docker.com/products/docker-desktop/ +[docker-engine]: https://docs.docker.com/engine/install/ +[vscode]: https://code.visualstudio.com/ +[dev-containers]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers +[dc-clone-in-vol]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume +[dc-open-in-container]: https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container From e347d0632f063b514a030f85f9900bee8397f1cc Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:43:38 +0800 Subject: [PATCH 26/42] build: update ruby version requirements `html-proofer` 5.x requires Ruby `>= 3.1, < 4.0` --- jekyll-theme-chirpy.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 2c77572bc..a1b97cc2c 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| "plugin_type" => "theme" } - spec.required_ruby_version = ">= 3.0" + spec.required_ruby_version = "~> 3.1" spec.add_runtime_dependency "jekyll", "~> 4.3" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" From 23729c9c8f2c803a839d5579d954efd85abf82c5 Mon Sep 17 00:00:00 2001 From: Andrew <18502096+classicrocker883@users.noreply.github.com> Date: Fri, 9 Aug 2024 01:24:30 -0400 Subject: [PATCH 27/42] refactor: update the sass mixed declarations (#1872) See: https://sass-lang.com/d/mixed-decls --- _sass/addon/commons.scss | 22 +++++++++++----------- _sass/addon/syntax.scss | 6 +++--- _sass/colors/typography-dark.scss | 12 ++++++------ _sass/colors/typography-light.scss | 16 ++++++++-------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 4087d241f..c4c68e787 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -1,6 +1,8 @@ /* The common styles */ html { + font-size: 16px; + @media (prefers-color-scheme: light) { &:not([data-mode]), &[data-mode='light'] { @@ -22,8 +24,6 @@ html { @include light-scheme; } } - - font-size: 16px; } body { @@ -218,13 +218,13 @@ i { #access-lastmod { a { + color: inherit; + &:hover { @extend %link-hover; } @extend %no-bottom-border; - - color: inherit; } } @@ -682,15 +682,15 @@ $btn-mb: 0.5rem; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border-color); + /* Hide scrollbar for IE, Edge and Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ + /* Hide scrollbar for Chrome, Safari and Opera */ &::-webkit-scrollbar { display: none; } - /* Hide scrollbar for IE, Edge and Firefox */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ - %sidebar-link-hover { &:hover { color: var(--sidebar-active-color); @@ -1036,6 +1036,9 @@ search { padding-bottom: 3rem; a { + font-size: 1.4rem; + line-height: 2.5rem; + &:hover { @extend %link-hover; } @@ -1043,9 +1046,6 @@ search { @extend %link-color; @extend %no-bottom-border; @extend %heading; - - font-size: 1.4rem; - line-height: 2.5rem; } > article { diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index 73c66aae5..b0efd202d 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -50,13 +50,13 @@ html { @extend %rounded; @extend %code-snippet-bg; + overflow: auto; + padding-bottom: 0.75rem; + @at-root figure#{&} { @extend %code-snippet-bg; } - overflow: auto; - padding-bottom: 0.75rem; - pre { margin-bottom: 0; font-size: $code-font-size; diff --git a/_sass/colors/typography-dark.scss b/_sass/colors/typography-dark.scss index 7d0fd302e..12427ec49 100644 --- a/_sass/colors/typography-dark.scss +++ b/_sass/colors/typography-dark.scss @@ -84,27 +84,29 @@ --prompt-danger-bg: rgb(86, 28, 8, 0.8); --prompt-danger-icon-color: #cd0202; - /* tags */ + /* Tags */ --tag-border: rgb(59, 79, 88); --tag-shadow: rgb(32, 33, 33); --dash-color: rgb(63, 65, 68); --search-tag-bg: #292828; - /* categories */ + /* Categories */ --categories-border: rgb(64, 66, 69, 0.5); --categories-hover-bg: rgb(73, 75, 76); --categories-icon-hover-color: white; - /* archives */ + /* Archive */ --timeline-node-bg: rgb(150, 152, 156); --timeline-color: rgb(63, 65, 68); --timeline-year-dot-color: var(--timeline-color); + color-scheme: dark; + .light { display: none; } - /* categories */ + /* Categories */ .categories.card, .list-group-item { background-color: var(--card-bg); @@ -138,8 +140,6 @@ ); } - color-scheme: dark; - /* stylelint-disable-next-line selector-id-pattern */ #disqus_thread { color-scheme: none; diff --git a/_sass/colors/typography-light.scss b/_sass/colors/typography-light.scss index 557f937dc..780007469 100644 --- a/_sass/colors/typography-light.scss +++ b/_sass/colors/typography-light.scss @@ -92,14 +92,6 @@ --tag-hover: rgb(222, 226, 230); --search-tag-bg: #f8f9fa; - [class^='prompt-'] { - --link-underline-color: rgb(219, 216, 216); - } - - .dark { - display: none; - } - /* Categories */ --categories-border: rgba(0, 0, 0, 0.125); --categories-hover-bg: var(--btn-border-color); @@ -109,4 +101,12 @@ --timeline-color: rgba(0, 0, 0, 0.075); --timeline-node-bg: #c2c6cc; --timeline-year-dot-color: #ffffff; + + [class^='prompt-'] { + --link-underline-color: rgb(219, 216, 216); + } + + .dark { + display: none; + } } /* light-scheme */ From d74bfaeda25f5b75d665b99b38b44f6f8dc98df1 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 13 Aug 2024 13:50:40 +0800 Subject: [PATCH 28/42] chore(tools): improve the init-script --- tools/init.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/init.sh b/tools/init.sh index c0c4e183b..603e51752 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -80,13 +80,13 @@ init_files() { rm -rf .github && mkdir -p .github/workflows mv "$temp/$ACTIONS_WORKFLOW" .github/workflows/"$ACTIONS_WORKFLOW" rm -rf "$temp" - - ## Cleanup image settings in site config - _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml fi + # Cleanup image settings in site config + _sedi "s/(^timezone:).*/\1/;s/(^.*cdn:).*/\1/;s/(^avatar:).*/\1/" _config.yml + # remove the other files - rm -rf _posts/* + rm -rf tools/init.sh tools/release.sh _posts/* # build assets npm i && npm run build From 7f83c3d00dd2a535c847d162d6c17d695f45eb0d Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:05:39 +0800 Subject: [PATCH 29/42] refactor: improve the efficiency of `GLightbox` switching Repeatedly using `GLightbox.destroy()` (>= 4 times) will cause `GLightbox` to fail to generate new objects --- _javascript/modules/components/img-popup.js | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/_javascript/modules/components/img-popup.js b/_javascript/modules/components/img-popup.js index 6c3e733ad..ac1204355 100644 --- a/_javascript/modules/components/img-popup.js +++ b/_javascript/modules/components/img-popup.js @@ -9,15 +9,18 @@ const lightImages = '.popup:not(.dark)'; const darkImages = '.popup:not(.light)'; let selector = lightImages; -function updateImages(lightbox) { +function updateImages(current, reverse) { if (selector === lightImages) { selector = darkImages; } else { selector = lightImages; } - lightbox.destroy(); - lightbox = GLightbox({ selector: `${selector}` }); + if (reverse === null) { + reverse = GLightbox({ selector: `${selector}` }); + } + + [current, reverse] = [reverse, current]; } export function imgPopup() { @@ -25,6 +28,11 @@ export function imgPopup() { return; } + const hasDualImages = !( + document.querySelector('.popup.light') === null && + document.querySelector('.popup.dark') === null + ); + if ( (html.hasAttribute('data-mode') && html.getAttribute('data-mode') === 'dark') || @@ -34,16 +42,18 @@ export function imgPopup() { selector = darkImages; } - let lightbox = GLightbox({ selector: `${selector}` }); + let current = GLightbox({ selector: `${selector}` }); + + if (hasDualImages && document.getElementById('mode-toggle')) { + let reverse = null; - if (document.getElementById('mode-toggle')) { window.addEventListener('message', (event) => { if ( event.source === window && event.data && event.data.direction === ModeToggle.ID ) { - updateImages(lightbox); + updateImages(current, reverse); } }); } From efd2941ce08f8bb2a56e543ee04da7525c2bacc7 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:28:14 +0800 Subject: [PATCH 30/42] build: resume platform-specific dependencies --- Gemfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 672e9e4b6..66f9337db 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,11 @@ source "https://rubygems.org" gemspec -group :test do - gem "html-proofer", "~> 5.0" +gem "html-proofer", "~> 5.0", group: :test + +platforms :mingw, :x64_mingw, :mswin, :jruby do + gem "tzinfo", ">= 1", "< 3" + gem "tzinfo-data" end + +gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] From 99eaf6089ecc663730f638c699969250d0f406b5 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:28:57 +0800 Subject: [PATCH 31/42] chore: remove duplicate config --- .vscode/settings.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1d784c0e4..5e8a04f39 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,6 @@ // Prettier "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, - "prettier.trailingComma": "none", // Shopify Liquid "files.associations": { "*.html": "liquid" From bf6c996c4ea69c2be2deda4d8606de776f6689b5 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:31:22 +0800 Subject: [PATCH 32/42] chore: move entries in git-ignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5d05699cf..b528d6d10 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ Gemfile.lock .jekyll-cache .jekyll-metadata _site -_app # RubyGems *.gem @@ -26,3 +25,4 @@ package-lock.json # Misc _sass/dist assets/js/dist +_app From befc4ce9c5026f67f99bce66e223d056229f0bdb Mon Sep 17 00:00:00 2001 From: Julius Gamanyi <85777+juliusgb@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:21:29 +0200 Subject: [PATCH 33/42] feat(analytics): add fathom analytics (#1913) --- _config.yml | 2 ++ _includes/analytics/fathom.html | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 _includes/analytics/fathom.html diff --git a/_config.yml b/_config.yml index d862178cf..fea93d3f8 100644 --- a/_config.yml +++ b/_config.yml @@ -70,6 +70,8 @@ analytics: domain: # fill in your Matomo domain cloudflare: id: # fill in your Cloudflare Web Analytics token + fathom: + id: # fill in your Fathom Site ID # Page views settings pageviews: diff --git a/_includes/analytics/fathom.html b/_includes/analytics/fathom.html new file mode 100644 index 000000000..4b603d3ae --- /dev/null +++ b/_includes/analytics/fathom.html @@ -0,0 +1,7 @@ + + + From 80bd7928a02c75c843a550bd377d11b574e8bfda Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 24 Aug 2024 22:27:35 +0800 Subject: [PATCH 34/42] feat(ui): improve block quote layout --- _sass/addon/commons.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index c4c68e787..5412b92f8 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -80,9 +80,10 @@ img { } blockquote { - border-left: 5px solid var(--blockquote-border-color); + border-left: 0.125rem solid var(--blockquote-border-color); padding-left: 1rem; color: var(--blockquote-text-color); + margin-top: 0.5rem; > p:last-child { margin-bottom: 0; From 707a209424f3a82868935dd46591c318e700355c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:12:00 +0800 Subject: [PATCH 35/42] refactor: improve heading layout --- _sass/addon/commons.scss | 21 +++++++++++++++------ _sass/addon/module.scss | 11 ----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 5412b92f8..2735eb87e 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -42,20 +42,29 @@ body { @extend %heading; @if $i > 1 { - @extend %section; @extend %anchor; } @if $i < 5 { - $factor: 0.18rem; + $size-factor: 0.25rem; - @if $i == 1 { - $factor: 0.23rem; + @if $i > 1 { + $size-factor: 0.18rem; + + main & { + @if $i == 2 { + margin: 2.5rem 0 1.25rem; + } @else { + margin: 2rem 0 1rem; + } + } } - font-size: 1rem + (5 - $i) * $factor; + & { + font-size: 1rem + (5 - $i) * $size-factor; + } } @else { - font-size: 1rem; + font-size: 1.05rem; } } } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 9e85adc0d..77fecca41 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -10,17 +10,6 @@ font-family: $font-family-heading; } -%section { - main & { - margin-top: 2.5rem; - margin-bottom: 1.25rem; - - &:focus { - outline: none; /* avoid outline in Safari */ - } - } -} - %anchor { .anchor { font-size: 80%; From 64c7262245e878534971a2e3a2630b614daf72f3 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:12:28 +0800 Subject: [PATCH 36/42] feat(ui): set `` font to 'Lato' --- _sass/addon/commons.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index 2735eb87e..c6aa02fec 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -124,7 +124,7 @@ blockquote { } kbd { - font-family: inherit; + font-family: Lato, sans-serif; display: inline-block; vertical-align: middle; line-height: 1.3rem; From 8cfd7214943806925342613d9107473de53f6524 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 00:25:29 +0800 Subject: [PATCH 37/42] build(deps-dev): bump the dev-deps --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 7d4835f37..a73fee71f 100644 --- a/package.json +++ b/package.json @@ -28,10 +28,10 @@ "bootstrap": "^5.3.3" }, "devDependencies": { - "@babel/core": "^7.24.7", - "@babel/plugin-transform-class-properties": "^7.24.7", - "@babel/preset-env": "^7.24.7", - "@commitlint/cli": "^19.3.0", + "@babel/core": "^7.25.2", + "@babel/plugin-transform-class-properties": "^7.25.4", + "@babel/preset-env": "^7.25.4", + "@commitlint/cli": "^19.4.0", "@commitlint/config-conventional": "^19.2.2", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-node-resolve": "^15.2.3", @@ -42,11 +42,11 @@ "@semantic-release/git": "^10.0.1", "concurrently": "^8.2.2", "conventional-changelog-conventionalcommits": "^8.0.0", - "husky": "^9.0.11", + "husky": "^9.1.5", "purgecss": "^6.0.0", - "rollup": "^4.18.0", - "semantic-release": "^24.0.0", - "stylelint": "^16.6.1", + "rollup": "^4.21.0", + "semantic-release": "^24.1.0", + "stylelint": "^16.8.2", "stylelint-config-standard-scss": "^13.1.0" }, "prettier": { From 5f4dab1745059929b04d7e998e8dbccd2a741b9c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 01:18:34 +0800 Subject: [PATCH 38/42] build: upgrade dependencies --- _data/origin/basic.yml | 6 +++--- _data/origin/cors.yml | 16 ++++++++-------- assets/lib | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/_data/origin/basic.yml b/_data/origin/basic.yml index 9027e6e4e..2d5298229 100644 --- a/_data/origin/basic.yml +++ b/_data/origin/basic.yml @@ -20,9 +20,9 @@ mermaid: dayjs: js: common: /assets/lib/dayjs/dayjs.min.js - locale: /assets/lib/dayjs/locale/en.min.js - relativeTime: /assets/lib/dayjs/plugin/relativeTime.min.js - localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.min.js + locale: /assets/lib/dayjs/locale/en.js + relativeTime: /assets/lib/dayjs/plugin/relativeTime.js + localizedFormat: /assets/lib/dayjs/plugin/localizedFormat.js glightbox: css: /assets/lib/glightbox/glightbox.min.css diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index 188066656..aff32f71d 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,24 +20,24 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.27.20/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@11.0.2/dist/mermaid.min.js dayjs: js: - common: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/dayjs.min.js - locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/locale/:LOCALE.min.js - relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/relativeTime.min.js - localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.11/plugin/localizedFormat.min.js + common: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js + locale: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/locale/:LOCALE.js + relativeTime: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/relativeTime.js + localizedFormat: https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/localizedFormat.js glightbox: css: https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css diff --git a/assets/lib b/assets/lib index b9c58cf48..8d23eb0c9 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit b9c58cf485a7dcbc833e698d67dd1850bdc93eb3 +Subproject commit 8d23eb0c91f38ff0162be118bb9c9517f8675cd6 From 31e19c6d0ff0e4c11dfbf39caf0f49ad83f4074e Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:17:38 +0800 Subject: [PATCH 39/42] refactor(ui): standardize the border radius (#1920) Impact: - Increase the border radius of inline code and `` tags - Variable `$base-radius` renamed to `$radius-lg` --- _sass/addon/commons.scss | 2 +- _sass/addon/module.scss | 2 +- _sass/addon/syntax.scss | 6 +++--- _sass/addon/variables.scss | 3 ++- _sass/layout/categories.scss | 2 +- _sass/layout/home.scss | 4 ++-- _sass/layout/post.scss | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss index c6aa02fec..465cb0859 100644 --- a/_sass/addon/commons.scss +++ b/_sass/addon/commons.scss @@ -134,7 +134,7 @@ kbd { padding-top: 0.1rem; color: var(--kbd-text-color); background-color: var(--kbd-bg-color); - border-radius: 0.25rem; + border-radius: $radius-sm; border: solid 1px var(--kbd-wrap-color); box-shadow: inset 0 -2px 0 var(--kbd-wrap-color); } diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss index 77fecca41..42db4e2d9 100644 --- a/_sass/addon/module.scss +++ b/_sass/addon/module.scss @@ -81,7 +81,7 @@ } %rounded { - border-radius: $base-radius; + border-radius: $radius-lg; } %img-caption { diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index b0efd202d..6bd7b4063 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -102,9 +102,9 @@ code { &.highlighter-rouge { font-size: $code-font-size; - padding: 3px 6px; + padding: 3px 5px; word-break: break-word; - border-radius: 4px; + border-radius: $radius-sm; background-color: var(--inline-code-bg); } @@ -261,7 +261,7 @@ div { .content > & { @include ml-mr(0); - border-radius: $base-radius; + border-radius: $radius-lg; } .code-header { diff --git a/_sass/addon/variables.scss b/_sass/addon/variables.scss index 8924a00b2..1d51cb14e 100644 --- a/_sass/addon/variables.scss +++ b/_sass/addon/variables.scss @@ -16,7 +16,8 @@ $search-max-width: 200px !default; $footer-height: 5rem !default; $footer-height-large: 6rem !default; /* screen width: < 850px */ $main-content-max-width: 1250px !default; -$base-radius: 0.625rem !default; +$radius-sm: 6px !default; +$radius-lg: 10px !default; $back2top-size: 2.75rem !default; /* syntax highlight */ diff --git a/_sass/layout/categories.scss b/_sass/layout/categories.scss index 330d3d350..f12b96336 100644 --- a/_sass/layout/categories.scss +++ b/_sass/layout/categories.scss @@ -16,7 +16,7 @@ } .card-header { - $radius: calc($base-radius - 1px); + $radius: calc($radius-lg - 1px); padding: 0.75rem; border-radius: $radius; diff --git a/_sass/layout/home.scss b/_sass/layout/home.scss index 7f9fd2e8b..0d95d7ba6 100644 --- a/_sass/layout/home.scss +++ b/_sass/layout/home.scss @@ -20,7 +20,7 @@ background: none; %img-radius { - border-radius: $base-radius $base-radius 0 0; + border-radius: $radius-lg $radius-lg 0 0; } .preview-img { @@ -131,7 +131,7 @@ /* Tablet */ @media all and (min-width: 768px) { %img-radius { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; } #post-list { diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 112541db3..815db9331 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -173,12 +173,12 @@ header { } &:first-child { - border-radius: $base-radius 0 0 $base-radius; + border-radius: $radius-lg 0 0 $radius-lg; left: 0.5px; } &:last-child { - border-radius: 0 $base-radius $base-radius 0; + border-radius: 0 $radius-lg $radius-lg 0; right: 0.5px; } } From 604e01eb3670c380a4c610552c02a607d12552f8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 26 Aug 2024 00:49:05 +0800 Subject: [PATCH 40/42] chore(deps): correct `Tocbot` version number --- _data/origin/cors.yml | 4 ++-- assets/lib | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index aff32f71d..afdb3d9ed 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,8 +20,8 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.29.20/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js fontawesome: css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css diff --git a/assets/lib b/assets/lib index 8d23eb0c9..a231bc7e2 160000 --- a/assets/lib +++ b/assets/lib @@ -1 +1 @@ -Subproject commit 8d23eb0c91f38ff0162be118bb9c9517f8675cd6 +Subproject commit a231bc7e2c67198e604950cb2be9147a0b2020c0 From fc3d1012584e70db572f72894c427ecef20cdfa0 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:49:48 +0800 Subject: [PATCH 41/42] build: improve the JS build for PWA (#1923) --- .gitignore | 1 - _config.yml | 3 --- jekyll-theme-chirpy.gemspec | 2 +- rollup.config.js | 44 +++++++++++++++++++++---------------- tools/init.sh | 2 +- tools/release.sh | 3 +-- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index b528d6d10..0082d9004 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,3 @@ package-lock.json # Misc _sass/dist assets/js/dist -_app diff --git a/_config.yml b/_config.yml index fea93d3f8..7a9b11a37 100644 --- a/_config.yml +++ b/_config.yml @@ -170,9 +170,6 @@ collections: tabs: output: true sort_by: order - app: - output: true - permalink: /:name defaults: - scope: diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index a1b97cc2c..76ebe6734 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0").select { |f| - f.match(%r!^((_(includes|layouts|sass|app|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) + f.match(%r!^((_(includes|layouts|sass|(data\/(locales|origin)))|assets)\/|README|LICENSE)!i) } spec.metadata = { diff --git a/rollup.config.js b/rollup.config.js index 94507b925..22016b04a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,35 +6,40 @@ import fs from 'fs'; import pkg from './package.json'; const SRC_DEFAULT = '_javascript'; -const DIST_DEFAULT = 'assets/js/dist'; - const SRC_PWA = `${SRC_DEFAULT}/pwa`; -const DIST_PWA = '_app'; +const DIST = 'assets/js/dist'; const banner = `/*! * ${pkg.name} v${pkg.version} | © ${pkg.since} ${pkg.author} | ${pkg.license} Licensed | ${pkg.homepage} */`; +const frontmatter = `---\npermalink: /:basename\n---\n`; + const isProd = process.env.BUILD === 'production'; -function cleanup(...directories) { - for (const dir of directories) { - fs.rm(dir, { recursive: true, force: true }, (err) => { - if (err) { - console.error(`Failed to remove directory ${dir}: ${err}`); - } - }); - } +function cleanup() { + fs.rmSync(DIST, { recursive: true, force: true }); + console.log(`> Directory "${DIST}" has been cleaned.`); } -function build(filename, opts = {}) { - const src = opts.src || SRC_DEFAULT; - const dist = opts.dist || DIST_DEFAULT; +function insertFrontmatter() { + return { + name: 'insert-frontmatter', + generateBundle(_, bundle) { + for (const chunkOrAsset of Object.values(bundle)) { + if (chunkOrAsset.type === 'chunk') { + chunkOrAsset.code = frontmatter + chunkOrAsset.code; + } + } + } + }; +} +function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) { return { input: `${src}/${filename}.js`, output: { - file: `${dist}/${filename}.min.js`, + file: `${DIST}/${filename}.min.js`, format: 'iife', name: 'Chirpy', banner, @@ -51,12 +56,13 @@ function build(filename, opts = {}) { }), nodeResolve(), yaml(), - isProd && terser() + isProd && terser(), + jekyll && insertFrontmatter() ] }; } -cleanup(DIST_DEFAULT, DIST_PWA); +cleanup(); export default [ build('commons'), @@ -65,6 +71,6 @@ export default [ build('page'), build('post'), build('misc'), - build('app', { src: SRC_PWA, dist: DIST_PWA }), - build('sw', { src: SRC_PWA, dist: DIST_PWA }) + build('app', { src: SRC_PWA, jekyll: true }), + build('sw', { src: SRC_PWA, jekyll: true }) ]; diff --git a/tools/init.sh b/tools/init.sh index 603e51752..2ad72ab9b 100755 --- a/tools/init.sh +++ b/tools/init.sh @@ -92,7 +92,7 @@ init_files() { npm i && npm run build # track the CSS/JS output - _sedi "/.*\/dist$/d;/^_app$/d" .gitignore + _sedi "/.*\/dist$/d" .gitignore } commit() { diff --git a/tools/release.sh b/tools/release.sh index e505f1a28..522c892c8 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -17,7 +17,6 @@ CONFIG="_config.yml" CSS_DIST="_sass/dist" JS_DIST="assets/js/dist" -PWA_DIST="_app" FILES=( "$GEM_SPEC" @@ -118,7 +117,7 @@ build_gem() { npm run build # add CSS/JS distribution files to gem package - git add "$CSS_DIST" "$JS_DIST" "$PWA_DIST" -f + git add "$CSS_DIST" "$JS_DIST" -f echo -e "\n> gem build $GEM_SPEC\n" gem build "$GEM_SPEC" From 8b7dba71e34531bfa38d6a3b2d1118a83bbf959a Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:18:52 +0800 Subject: [PATCH 42/42] docs: update tutorial and readme Change Dev Containers logo in README: Simple Icons has removed all Microsoft icons due to copyright restrictions, see --- README.md | 8 ++-- _posts/2019-08-09-getting-started.md | 67 ++++++++++++++++------------ 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 32210f532..7e57b2a52 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ A minimal, responsive, and feature-rich Jekyll theme for technical writing. - [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=visualstudiocode)][open-container]  - [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=tomato)][gem]  - [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy)][license]  [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  - [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy] + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy]  + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy?color=goldenrod)][license]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=orange)][gem]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=linuxcontainers)][open-container] [**Live Demo** →][demo] diff --git a/_posts/2019-08-09-getting-started.md b/_posts/2019-08-09-getting-started.md index 6cbd4e694..3b41a3cab 100644 --- a/_posts/2019-08-09-getting-started.md +++ b/_posts/2019-08-09-getting-started.md @@ -11,33 +11,35 @@ pin: true media_subpath: '/posts/20180809' --- -## Creating a site repository +## Creating a Site Repository -There are two methods to create a site repository for **Chirpy**: +When creating your site repository, you have two options depending on your needs: -- [**Using the starter**](#option-1-using-the-starter) — This approach simplifies upgrades and isolates unnecessary project files, enabling you to concentrate on your content. It's ideal for those who want a hassle-free setup focused primarily on writing. -- [**Forking the theme**](#option-2-forking-the-theme) — This method allows for customization and development but presents challenges during upgrades. It is not recommended to use this approach unless you are familiar with Jekyll and plan to modify this project. +### Option 1. Using the Starter (Recommended) -### Option 1: using the starter +This approach simplifies upgrades, isolates unnecessary files, and is perfect for users who want to focus on writing with minimal configuration. 1. Sign in to GitHub and navigate to the [**starter**][starter]. 2. Click the Use this template button and then select Create a new repository. +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -### Option 2: forking the theme +### Option 2. Forking the Theme -Sign in to GitHub and [fork the theme](https://github.com/cotes2020/jekyll-theme-chirpy/fork). +This approach is convenient for modifying features or UI design, but presents challenges during upgrades. So don't try this unless you are familiar with Jekyll and plan to heavily modify this theme. -## Name your new repository +1. Sign in to GitHub. +2. [Fork the theme repository](https://github.com/cotes2020/jekyll-theme-chirpy/fork). +3. Name the new repository `.github.io`, replacing `username` with your lowercase GitHub username. -Rename your repository to `.github.io`. The `username` represents your lowercase GitHub username. +## Setting up the Environment -## Setting up the environment +Once your repository is created, it's time to set up your development environment. There are two primary methods: -The easiest way to set up the runtime environment, especially on Windows, is by using [Dev Containers](#setting-up-in-dev-containers). This method installs all packages within a Docker container, isolating them from the host machine and ensuring no interference with existing settings. +### Using Dev Containers (Recommended for Windows) -For Unix-like systems, besides using Dev Containers, you can also [natively set up](#setting-up-natively) the runtime environment to achieve optimal performance. +Dev Containers offer an isolated environment using Docker, which prevents conflicts with your system and ensures all dependencies are managed within the container. -### Setting up in Dev Containers +**Steps**: 1. Install Docker: - On Windows/macOS, install [Docker Desktop][docker-desktop]. @@ -45,27 +47,34 @@ For Unix-like systems, besides using Dev Containers, you can also [natively set 2. Install [VS Code][vscode] and the [Dev Containers extension][dev-containers]. 3. Clone your repository: - For Docker Desktop: Start VS Code and [clone your repo in a container volume][dc-clone-in-vol]. - - For Docker Engine: Clone your repo to the local disk, then launch VS Code and [open your repo in the container][dc-open-in-container]. -4. Wait a few minutes for Dev Containers to finish installing. + - For Docker Engine: Clone your repo locally, then [open it in a container][dc-open-in-container] via VS Code. +4. Wait for the Dev Containers setup to complete. -### Setting up natively +### Setting up Natively (Recommended for Unix-like OS) -1. Follow the instructions in the [Jekyll Docs](https://jekyllrb.com/docs/installation/) to complete the installation of the basic environment. Ensure that [Git](https://git-scm.com/) is also installed. -2. Clone your repository to a local disk. -3. If your site is created by forking the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory. This will initialize the repository files and create a commit to save the changes. -4. Install the dependencies by running `bundle`. +For Unix-like systems, you can set up the environment natively for optimal performance, though you can also use Dev Containers as an alternative. -### Start the local server +**Steps**: + +1. Follow the [Jekyll installation guide](https://jekyllrb.com/docs/installation/) to install Jekyll and ensure [Git](https://git-scm.com/) is installed. +2. Clone your repository to your local machine. +3. If you forked the theme, install [Node.js][nodejs] and run `bash tools/init.sh` in the root directory to initialize the repository. +4. Run command `bundle` in the root of your repository to install the dependencies. + +## Usage + +### Start the Jekyll Server To run the site locally, use the following command: -```console +```terminal $ bundle exec jekyll s ``` -After a few seconds, the local server will be available at . +> If you are using Dev Containers, you must run that command in the **VS Code** Terminal. +{: .prompt-info } -## Usage +After a few seconds, the local server will be available at . ### Configuration @@ -76,17 +85,17 @@ Update the variables in `_config.yml`{: .filepath} as needed. Some typical optio - `timezone` - `lang` -### Social contact options +### Social Contact Options Social contact options are displayed at the bottom of the sidebar. You can enable or disable specific contacts in the `_data/contact.yml`{: .filepath} file. -### Customizing the stylesheet +### Customizing the Stylesheet To customize the stylesheet, copy the theme's `assets/css/jekyll-theme-chirpy.scss`{: .filepath} file to the same path in your Jekyll site, and add your custom styles at the end of the file. Starting with version `6.2.0`, if you want to overwrite the SASS variables defined in `_sass/addon/variables.scss`{: .filepath}, copy the main SASS file `_sass/main.scss`{: .filepath} to the `_sass`{: .filepath} directory in your site's source, then create a new file `_sass/variables-hook.scss`{: .filepath} and assign your new values there. -### Customizing static assets +### Customizing Static Assets Static assets configuration was introduced in version `5.1.0`. The CDN of the static assets is defined in `_data/origin/cors.yml`{: .filepath }. You can replace some of them based on the network conditions in the region where your website is published. @@ -98,7 +107,7 @@ Before deploying, check the `_config.yml`{: .filepath} file and ensure the `url` Now you can choose _ONE_ of the following methods to deploy your Jekyll site. -### Deploy using GitHub Actions +### Deploy Using Github Actions Prepare the following: @@ -119,7 +128,7 @@ Next, configure the _Pages_ service: You can now visit the URL provided by GitHub to access your site. -### Manual build and deployment +### Manual Build and Deployment For self-hosted servers, you will need to build the site on your local machine and then upload the site files to the server.