Skip to content

Update dependency @biomejs/biome to v2.3.5 #25

Update dependency @biomejs/biome to v2.3.5

Update dependency @biomejs/biome to v2.3.5 #25

Workflow file for this run

name: Minify Userscript
on:
push:
branches:
- main
workflow_dispatch:
jobs:
Minify:
name: Minify userscript
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Install Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6
with:
node-version-file: ".node-version"
- name: Minify
run: |
echo "Minifying userscript..."
sed -n '/\/\/ ==UserScript==/,/\/\/ ==\/UserScript==/p' "dist/Hagezi to NextDNS.user.js" > "meta.js"
sed -n '/\/\/ ==\/UserScript==/,$p' "dist/Hagezi to NextDNS.user.js" | tail -n +2 > "input.js"
npx terser --compress --mangle --comments false --parse bare_returns --output "output.js" -- "input.js"
[ $(wc -c < "output.js") -lt 100 ] && { echo "Failed to minify userscript"; exit 1; }
cat "meta.js" "output.js" > "dist/Hagezi to NextDNS.min.user.js"
echo "Userscript minification completed!"
- name: Commit
uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
with:
branch: main
file_pattern: "dist/*.min.user.js"
commit_message: minify userscript