Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mill413 committed Sep 23, 2024
2 parents 52f0fa3 + 7374906 commit b685bd0
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#f7f7f7">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#1b1b1e">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta
name="viewport"
Expand Down
5 changes: 4 additions & 1 deletion _includes/js-selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
{% if jekyll.environment == 'production' %}
<!-- PWA -->
{% if site.pwa.enabled %}
<script defer src="{{ 'app.min.js' | relative_url }}"></script>
<script
defer
src="{{ 'app.min.js' | relative_url }}?baseurl={{ site.baseurl | default: '' }}&register={{ site.pwa.cache.enabled }}"
></script>
{% endif %}

<!-- Web Analytics -->
Expand Down
12 changes: 8 additions & 4 deletions _javascript/pwa/app.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import { pwa, baseurl } from '../../_config.yml';
import Toast from 'bootstrap/js/src/toast';

if ('serviceWorker' in navigator) {
if (pwa.enabled) {
const swUrl = `${baseurl}/sw.min.js`;
// Get Jekyll config from URL parameters
const src = new URL(document.currentScript.src);
const register = src.searchParams.get('register');
const baseUrl = src.searchParams.get('baseurl');

if (register) {
const swUrl = `${baseUrl}/sw.min.js`;
const notification = document.getElementById('notification');
const btnRefresh = notification.querySelector('.toast-body>button');
const popupWindow = Toast.getOrCreateInstance(notification);

navigator.serviceWorker.register(swUrl).then((registration) => {
// In case the user ignores the notification
// Restore the update window that was last manually closed by the user
if (registration.waiting) {
popupWindow.show();
}
Expand Down
4 changes: 1 addition & 3 deletions _javascript/pwa/sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { baseurl } from '../../_config.yml';

importScripts(`${baseurl}/assets/js/data/swconf.js`);
importScripts('./assets/js/data/swconf.js');

const purge = swconf.purge;
const interceptor = swconf.interceptor;
Expand Down
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [7.1.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.1.0...v7.1.1) (2024-09-23)

### Bug Fixes

* **i18n:** correct fr-FR translations ([#1949](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1949)) ([367262e](https://github.com/cotes2020/jekyll-theme-chirpy/commit/367262e74d1005bddf1328bb2b3a2b9e152c0086))
* **pwa:** site baseurl not passed to `app.js` ([#1955](https://github.com/cotes2020/jekyll-theme-chirpy/issues/1955)) ([5a63244](https://github.com/cotes2020/jekyll-theme-chirpy/commit/5a63244721d21b1ad3a0ae83420723a2f0379e8b))

## [7.1.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v7.0.1...v7.1.0) (2024-08-27)

### Features
Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-chirpy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-theme-chirpy"
spec.version = "7.1.0"
spec.version = "7.1.1"
spec.authors = ["Cotes Chung"]
spec.email = ["[email protected]"]

Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jekyll-theme-chirpy",
"version": "7.1.0",
"version": "7.1.1",
"description": "A minimal, responsive, and feature-rich Jekyll theme for technical writing.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,22 +31,21 @@
"@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",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-yaml": "^4.1.2",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"concurrently": "^8.2.2",
"concurrently": "^9.0.1",
"conventional-changelog-conventionalcommits": "^8.0.0",
"husky": "^9.1.5",
"husky": "^9.1.6",
"purgecss": "^6.0.0",
"rollup": "^4.21.0",
"semantic-release": "^24.1.0",
"stylelint": "^16.8.2",
"rollup": "^4.21.3",
"semantic-release": "^24.1.1",
"stylelint": "^16.9.0",
"stylelint-config-standard-scss": "^13.1.0"
},
"prettier": {
Expand Down
4 changes: 1 addition & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import babel from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import yaml from '@rollup/plugin-yaml';
import fs from 'fs';
import pkg from './package.json';

Expand Down Expand Up @@ -43,7 +42,7 @@ function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) {
format: 'iife',
name: 'Chirpy',
banner,
sourcemap: !isProd
sourcemap: !isProd && !jekyll
},
watch: {
include: `${src}/**`
Expand All @@ -55,7 +54,6 @@ function build(filename, { src = SRC_DEFAULT, jekyll = false } = {}) {
plugins: ['@babel/plugin-transform-class-properties']
}),
nodeResolve(),
yaml(),
isProd && terser(),
jekyll && insertFrontmatter()
]
Expand Down

0 comments on commit b685bd0

Please sign in to comment.