Merge branch 'master' into production

This commit is contained in:
Cotes Chung 2023-11-10 20:09:30 +08:00
commit bdee5d6b6d
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
21 changed files with 205 additions and 172 deletions

View file

@ -1,5 +0,0 @@
# https://github.com/browserslist/browserslist#browserslistrc
last 2 versions
> 0.2%
not dead

View file

@ -1,8 +0,0 @@
{
"rules": {
"body-max-line-length": [
0,
"always"
]
}
}

View file

@ -7,7 +7,7 @@ updates:
bundler: bundler:
dependency-type: "production" dependency-type: "production"
schedule: schedule:
interval: "weekly" interval: "monthly"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/" directory: "/"
versioning-strategy: increase versioning-strategy: increase
@ -15,7 +15,7 @@ updates:
npm: npm:
dependency-type: "development" dependency-type: "development"
schedule: schedule:
interval: "weekly" interval: "monthly"
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
groups: groups:
@ -23,4 +23,4 @@ updates:
update-types: update-types:
- "major" - "major"
schedule: schedule:
interval: "weekly" interval: "monthly"

View file

@ -19,10 +19,6 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
ruby: [2.7, 3]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -32,11 +28,11 @@ jobs:
- name: Setup Ruby - name: Setup Ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: 3
bundler-cache: true bundler-cache: true
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
- name: Build Assets - name: Build Assets
run: npm i && npm run build run: npm i && npm run build

View file

@ -20,6 +20,6 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
- run: npm i - run: npm i
- run: npm test - run: npm test

View file

@ -1,3 +0,0 @@
{
"trailingComma": "none"
}

View file

@ -1,23 +0,0 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"no-descending-specificity": null,
"shorthand-property-no-redundant-values": null,
"at-rule-no-vendor-prefix": null,
"property-no-vendor-prefix": null,
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null,
"color-function-notation": "legacy",
"alpha-value-notation": "number",
"selector-not-notation": "simple",
"color-hex-length": "long",
"declaration-block-single-line-max-declarations": 3,
"scss/operator-no-newline-after": null,
"rule-empty-line-before": [
"always",
{ "ignore": ["after-comment", "first-nested"] }
],
"value-keyword-case": ["lower", { "ignoreProperties": ["/^\\$/"] }],
"media-feature-range-notation": "prefix"
}
}

View file

@ -1,20 +0,0 @@
{
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
}
]
}

View file

@ -2,7 +2,7 @@
# Chirpy Jekyll Theme # Chirpy Jekyll Theme
A minimal, responsive and feature-rich Jekyll theme for technical writing. 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]  [![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]  [![CI](https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml/badge.svg?branch=master&event=push)][ci] 
@ -55,9 +55,9 @@ For details, see the "[Contributing Guidelines][contribute-guide]".
## Credits ## Credits
This project is mainly built with [Jekyll][jekyllrb] ecosystem, This project was built primarily with the [Jekyll][jekyllrb] ecosystem,
[Bootstrap][bootstrap], [Font Awesome][icons], and some other [wonderful tools][lib]. [Bootstrap][bootstrap], [Font Awesome][icons], and some other [wonderful tools][lib].
The avatar and favicon design come from [Clipart Max][image]. The avatar and favicon design from [Clipart Max][image].
Many thanks to the [contributors][contributors] who participated in the development Many thanks to the [contributors][contributors] who participated in the development
and to the folks who reported bugs or shared ideas. and to the folks who reported bugs or shared ideas.

View file

@ -40,7 +40,7 @@ copyright:
Except where otherwise noted, the blog posts on this site are licensed Except where otherwise noted, the blog posts on this site are licensed
under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author. under the Creative Commons Attribution 4.0 International (CC BY 4.0) License by the author.
meta: Using the :THEME theme for :PLATFORM meta: Using the :THEME theme for :PLATFORM.
not_found: not_found:
statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. statment: Sorry, we've misplaced that URL or it's pointing to something that doesn't exist.

View file

@ -23,8 +23,8 @@ bootstrap:
js: https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js js: https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js
toc: toc:
css: https://cdn.jsdelivr.net/npm/tocbot@4.21.2/dist/tocbot.min.css css: https://cdn.jsdelivr.net/npm/tocbot@4.21.3/dist/tocbot.min.css
js: https://cdn.jsdelivr.net/npm/tocbot@4.21.2/dist/tocbot.min.js js: https://cdn.jsdelivr.net/npm/tocbot@4.21.3/dist/tocbot.min.js
fontawesome: fontawesome:
css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css
@ -33,7 +33,7 @@ search:
js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js
mermaid: mermaid:
js: https://cdn.jsdelivr.net/npm/mermaid@10.5.0/dist/mermaid.min.js js: https://cdn.jsdelivr.net/npm/mermaid@10.6.0/dist/mermaid.min.js
dayjs: dayjs:
js: js:

View file

@ -23,3 +23,16 @@ platforms:
# - type: Weibo # - type: Weibo
# icon: "fab fa-weibo" # icon: "fab fa-weibo"
# link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL" # link: "http://service.weibo.com/share/share.php?title=TITLE&url=URL"
#
# - type: Mastodon
# icon: "fa-brands fa-mastodon"
# # See: https://github.com/justinribeiro/share-to-mastodon#properties
# instances:
# - label: mastodon.social
# link: "https://mastodon.social/"
# - label: mastodon.online
# link: "https://mastodon.online/"
# - label: fosstodon.org
# link: "https://fosstodon.org/"
# - label: photog.social
# link: "https://photog.social/"

View file

@ -1,5 +1,6 @@
<iframe <iframe
class="embed-video twitch" class="embed-video twitch"
loading="lazy"
src="https://player.twitch.tv/?video={{ include.id }}&parent={{ site.url | split: '://' | last | remove: '/' }}" src="https://player.twitch.tv/?video={{ include.id }}&parent={{ site.url | split: '://' | last | remove: '/' }}"
frameborder="0" frameborder="0"
allowfullscreen="true" allowfullscreen="true"

View file

@ -1,23 +1,38 @@
<!-- Post sharing snippet --> <!-- Post sharing snippet -->
<div class="share-wrapper d-flex align-items-center"> <div class="share-wrapper d-flex align-items-center">
<span class="share-label text-muted me-1">{{ site.data.locales[include.lang].post.share }}</span> <span class="share-label text-muted">{{ site.data.locales[include.lang].post.share }}</span>
<span class="share-icons"> <span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign title = title | uri_escape %} {% assign title = title | uri_escape %}
{% assign url = page.url | absolute_url | url_encode %} {% assign url = page.url | absolute_url | url_encode %}
{% for share in site.data.share.platforms %} {% for share in site.data.share.platforms -%}
{%- capture tooltip -%}
data-bs-toggle="tooltip" data-bs-placement="top" title="{{ share.type }}" aria-label="{{ share.type }}"
{%- endcapture -%}
{% if share.type == 'Mastodon' %}
<script defer type="module" src="https://cdn.jsdelivr.net/npm/@justinribeiro/share-to-mastodon/+esm"></script>
<button class="btn text-start" {{ tooltip }}>
<share-to-mastodon
class="share-mastodon"
message="{{ title }}"
url="{{ url }}"
{%- if share.instances -%}
customInstanceList="{{ share.instances | jsonify | xml_escape }}"
{%- endif %}
>
<i class="fa-fw {{ share.icon }}"></i>
</share-to-mastodon>
</button>
{% continue %}
{% endif %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %} {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}
<a
href="{{ link }}" <a href="{{ link }}" target="_blank" rel="noopener" {{ tooltip }}>
data-bs-toggle="tooltip"
data-bs-placement="top"
title="{{ share.type }}"
target="_blank"
rel="noopener"
aria-label="{{ share.type }}"
>
<i class="fa-fw {{ share.icon }}"></i> <i class="fa-fw {{ share.icon }}"></i>
</a> </a>
{% endfor %} {% endfor %}
@ -31,7 +46,7 @@
title="{{ site.data.locales[include.lang].post.button.share_link.title }}" title="{{ site.data.locales[include.lang].post.button.share_link.title }}"
data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}" data-title-succeed="{{ site.data.locales[include.lang].post.button.share_link.succeed }}"
> >
<i class="fa-fw fas fa-link pe-none"></i> <i class="fa-fw fas fa-link pe-none fs-6"></i>
</button> </button>
</span> </span>
</div> </div>

View file

@ -309,7 +309,6 @@ sup {
.preview-img { .preview-img {
aspect-ratio: 40 / 21; aspect-ratio: 40 / 21;
width: 100%; width: 100%;
height: 100%;
overflow: hidden; overflow: hidden;
@extend %rounded; @extend %rounded;
@ -324,6 +323,10 @@ sup {
object-fit: cover; object-fit: cover;
@extend %rounded; @extend %rounded;
@at-root #post-list & {
width: 100%;
}
} }
} }

View file

@ -63,7 +63,8 @@
/* Posts */ /* Posts */
--toc-highlight: #0550ae; --toc-highlight: #0550ae;
--btn-share-hover-color: var(--link-color); --btn-share-color: gray;
--btn-share-hover-color: #0d6efd;
--card-bg: white; --card-bg: white;
--card-hovor-bg: #e2e2e2; --card-hovor-bg: #e2e2e2;
--card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0, --card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0,

View file

@ -2,14 +2,6 @@
Post-specific style Post-specific style
*/ */
@mixin btn-sharing-color($light-color, $important: false) {
@if $important {
color: var(--btn-share-color, $light-color) !important;
} @else {
color: var(--btn-share-color, $light-color);
}
}
%btn-post-nav { %btn-post-nav {
width: 50%; width: 50%;
position: relative; position: relative;
@ -72,11 +64,23 @@ h1 + .post-meta {
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
%icon-size {
font-size: 1.125rem;
}
.share-icons { .share-icons {
font-size: 1.2rem; display: flex;
i {
color: var(--btn-share-color);
@extend %icon-size;
}
> * { > * {
margin-left: 0.25rem; @extend %icon-size;
margin-left: 0.5rem;
&:hover { &:hover {
i { i {
@ -86,44 +90,29 @@ h1 + .post-meta {
} }
button { button {
position: relative;
bottom: 2px;
padding: 0; padding: 0;
border: none;
line-height: inherit;
@extend %cursor-pointer; @extend %cursor-pointer;
} }
a :hover {
text-decoration: none;
}
.fa-square-x-twitter {
@include btn-sharing-color(black);
}
.fa-facebook-square {
@include btn-sharing-color(rgb(66, 95, 156));
}
.fa-telegram {
@include btn-sharing-color(rgb(39, 159, 217));
}
.fa-linkedin {
@include btn-sharing-color(rgb(0, 119, 181));
}
.fa-weibo {
@include btn-sharing-color(rgb(229, 20, 43));
}
} /* .share-icons */ } /* .share-icons */
.fas.fa-link {
@include btn-sharing-color(rgb(171, 171, 171));
}
} /* .share-wrapper */ } /* .share-wrapper */
} }
.share-mastodon {
/* See: https://github.com/justinribeiro/share-to-mastodon#properties */
--wc-stm-font-family: $font-family-base;
--wc-stm-dialog-background-color: var(--card-bg);
--wc-stm-form-button-border: 1px solid var(--btn-border-color);
--wc-stm-form-submit-background-color: var(--sidebar-btn-bg);
--wc-stm-form-cancel-background-color: var(--sidebar-btn-bg);
--wc-stm-form-button-background-color-hover: #007bff;
--wc-stm-form-button-color-hover: white;
font-size: 1rem;
}
.post-tags { .post-tags {
line-height: 2rem; line-height: 2rem;

@ -1 +1 @@
Subproject commit 6e3fa734685f099195b02da912ffa25c04913e41 Subproject commit 97d95fdb5ed9c445a372d110776fc354beff6128

View file

@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.authors = ["Cotes Chung"] spec.authors = ["Cotes Chung"]
spec.email = ["cotes.chung@gmail.com"] spec.email = ["cotes.chung@gmail.com"]
spec.summary = "A minimal, responsive and feature-rich Jekyll theme for technical writing." spec.summary = "A minimal, responsive, and feature-rich Jekyll theme for technical writing."
spec.homepage = "https://github.com/cotes2020/jekyll-theme-chirpy" spec.homepage = "https://github.com/cotes2020/jekyll-theme-chirpy"
spec.license = "MIT" spec.license = "MIT"
@ -23,12 +23,12 @@ Gem::Specification.new do |spec|
"plugin_type" => "theme" "plugin_type" => "theme"
} }
spec.required_ruby_version = ">= 2.6" spec.required_ruby_version = ">= 3.0"
spec.add_runtime_dependency "jekyll", "~> 4.3" spec.add_runtime_dependency "jekyll", "~> 4.3"
spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" spec.add_runtime_dependency "jekyll-paginate", "~> 1.1"
spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16" spec.add_runtime_dependency "jekyll-redirect-from", "~> 0.16"
spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.7" spec.add_runtime_dependency "jekyll-seo-tag", "~> 2.8"
spec.add_runtime_dependency "jekyll-archives", "~> 2.2" spec.add_runtime_dependency "jekyll-archives", "~> 2.2"
spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4" spec.add_runtime_dependency "jekyll-sitemap", "~> 1.4"
spec.add_runtime_dependency "jekyll-include-cache", "~> 0.2" spec.add_runtime_dependency "jekyll-include-cache", "~> 0.2"

View file

@ -1,7 +1,7 @@
{ {
"name": "jekyll-theme-chirpy", "name": "jekyll-theme-chirpy",
"version": "6.2.3", "version": "6.2.3",
"description": "A minimal, responsive and feature-rich Jekyll theme for technical writing.", "description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/cotes2020/jekyll-theme-chirpy.git" "url": "git+https://github.com/cotes2020/jekyll-theme-chirpy.git"
@ -21,15 +21,86 @@
"fixlint": "npm run test -- --fix" "fixlint": "npm run test -- --fix"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.0", "@babel/core": "^7.23.2",
"@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.22.20", "@babel/preset-env": "^7.23.2",
"@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.3", "@rollup/plugin-terser": "^0.4.4",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"rollup": "^3.29.4", "rollup": "^4.3.0",
"rollup-plugin-license": "^3.1.0", "rollup-plugin-license": "^3.2.0",
"stylelint": "^15.10.3", "stylelint": "^15.11.0",
"stylelint-config-standard-scss": "^11.0.0" "stylelint-config-standard-scss": "^11.1.0"
},
"prettier": {
"trailingComma": "none"
},
"browserslist": [
"last 2 versions",
"> 0.2%",
"not dead"
],
"commitlint": {
"rules": {
"body-max-line-length": [
0,
"always"
]
}
},
"stylelint": {
"extends": "stylelint-config-standard-scss",
"rules": {
"no-descending-specificity": null,
"shorthand-property-no-redundant-values": null,
"at-rule-no-vendor-prefix": null,
"property-no-vendor-prefix": null,
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null,
"color-function-notation": "legacy",
"alpha-value-notation": "number",
"selector-not-notation": "simple",
"color-hex-length": "long",
"declaration-block-single-line-max-declarations": 3,
"scss/operator-no-newline-after": null,
"rule-empty-line-before": [
"always",
{
"ignore": [
"after-comment",
"first-nested"
]
}
],
"value-keyword-case": [
"lower",
{
"ignoreProperties": [
"/^\\$/"
]
}
],
"media-feature-range-notation": "prefix"
}
},
"standard-version": {
"skip": {
"commit": true,
"tag": true
},
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Improvements"
}
]
} }
} }

View file

@ -8,7 +8,7 @@
# and production branch. # and production branch.
# #
# #
# Usage: run on main branch or the patch branch # Usage: run on the default, release or the patch branch
# #
# Requires: Git, NPM and RubyGems # Requires: Git, NPM and RubyGems
@ -18,8 +18,7 @@ opt_pre=false # preview mode option
working_branch="$(git branch --show-current)" working_branch="$(git branch --show-current)"
# AKA the default branch, main/master branch DEFAULT_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
STAGING_BRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
PROD_BRANCH="production" PROD_BRANCH="production"
@ -65,15 +64,16 @@ _check_cli() {
} }
_check_git() { _check_git() {
# ensure nothing is uncommitted # ensure that changes have been committed
if [[ -n $(git status . -s) ]]; then if [[ -n $(git status . -s) ]]; then
echo "> Abort: Commit the staged files first, and then run this tool again." echo "> Abort: Commit the staged files first, and then run this tool again."
exit 1 exit 1
fi fi
# ensure the working branch is the default/patch branch if [[ $working_branch != "$DEFAULT_BRANCH" &&
if [[ $working_branch != "$STAGING_BRANCH" && $working_branch != hotfix/* ]]; then $working_branch != hotfix/* &&
echo "> Abort: Please run on the $STAGING_BRANCH branch or a patch branche." $working_branch != "$PROD_BRANCH" ]]; then
echo "> Abort: Please run on the default, release or patch branch."
exit 1 exit 1
fi fi
} }
@ -101,14 +101,16 @@ check() {
_check_node_packages _check_node_packages
} }
# auto-generate a new version number to the file 'package.json' and # Auto-generate a new version number to the file 'package.json'
bump_node() { bump_node() {
bump="standard-version -i $CHANGE_LOG"
if $opt_pre; then if $opt_pre; then
standard-version -i "$CHANGE_LOG" -p rc bump="$bump -p rc"
else
standard-version -i "$CHANGE_LOG"
fi fi
eval "$bump"
# Change heading of Patch version to heading level 2 (a bug from `standard-version`) # Change heading of Patch version to heading level 2 (a bug from `standard-version`)
sed -i "s/^### \[/## \[/g" "$CHANGE_LOG" sed -i "s/^### \[/## \[/g" "$CHANGE_LOG"
# Replace multiple empty lines with a single empty line # Replace multiple empty lines with a single empty line
@ -117,29 +119,34 @@ bump_node() {
## Bump new version to gem config file ## Bump new version to gem config file
bump_gem() { bump_gem() {
sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$1/" "$GEM_SPEC" _ver="$1"
if $opt_pre; then
_ver="${1/-/.}"
fi
sed -i "s/[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/$_ver/" "$GEM_SPEC"
} }
# Update the git branches, create a new tag, and then build the gem package. # Creates a new tag on the production branch with the given version number.
release() { # Also commits the changes and merges the production branch into the default branch.
branch() {
_version="$1" # X.Y.Z _version="$1" # X.Y.Z
_latest_commit="$(git rev-parse HEAD)"
git add .
git commit -m "chore(release): $_version"
# Create a new tag on production branch # Create a new tag on production branch
echo -e "> Create tag v$_version\n" echo -e "> Create tag v$_version\n"
git tag "v$_version" git tag "v$_version"
git checkout "$STAGING_BRANCH" git checkout "$DEFAULT_BRANCH"
git merge --no-ff --no-edit "$PROD_BRANCH"
if [[ $working_branch == hotfix/* ]]; then if [[ $working_branch == hotfix/* ]]; then
git merge --no-ff --no-edit "$working_branch"
# delete the patch branch # delete the patch branch
git branch -D "$working_branch" git branch -D "$working_branch"
fi fi
# cherry-pick the latest commit from production branch to default branch
git cherry-pick "$_latest_commit"
} }
## Build a gem package ## Build a gem package
@ -164,7 +171,7 @@ build_gem() {
main() { main() {
check check
if [[ $opt_pre = false ]]; then if [[ $opt_pre = false && $working_branch != "$PROD_BRANCH" ]]; then
git checkout "$PROD_BRANCH" git checkout "$PROD_BRANCH"
git merge --no-ff --no-edit "$working_branch" git merge --no-ff --no-edit "$working_branch"
fi fi
@ -175,16 +182,12 @@ main() {
bump_gem "$_version" bump_gem "$_version"
echo -e "> Build the gem package for v$_version\n"
if [[ $opt_pre = false ]]; then if [[ $opt_pre = false ]]; then
echo -e "> Bumped version number to $_version\n" branch "$_version"
git add .
git commit -m "chore(release): $_version"
release "$_version"
fi fi
echo -e "> Build the gem package for v$_version\n"
build_gem build_gem
} }