1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 21:53:26 +00:00

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.
This commit is contained in:
Cotes Chung
2024-06-05 23:51:10 +08:00
committed by GitHub
parent 250880c088
commit 7ca9c59784
10 changed files with 35 additions and 58 deletions

View File

@@ -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() {

View File

@@ -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)