From d75ec2a64b1ddea4ea92dae704ffe3a399daf777 Mon Sep 17 00:00:00 2001 From: SharzyL Date: Fri, 12 Apr 2024 11:49:29 +0800 Subject: [PATCH] chore: remove unneeded deploy scripts --- scripts/deploy-static.sh | 20 -------------------- scripts/md2html.sh | 27 --------------------------- scripts/render.js | 32 -------------------------------- 3 files changed, 79 deletions(-) delete mode 100755 scripts/deploy-static.sh delete mode 100755 scripts/md2html.sh delete mode 100644 scripts/render.js diff --git a/scripts/deploy-static.sh b/scripts/deploy-static.sh deleted file mode 100755 index ec28bfc..0000000 --- a/scripts/deploy-static.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# deploy the static pages on Cloudflare workers -# add argument --preview to deploy on preview namespace - -set -e - -declare -a args=('yarn' 'wrangler' 'kv:key' 'put' '--binding=PB') - -if [ "$1" == '--preview' ]; then - args+=('--env' 'preview') - shift -fi - -declare -a files=("$@") - -set -x -for file in "${files[@]}"; do - file_base=$(basename "$file") - "${args[@]}" "${file_base%.html}" --path "$file" -done diff --git a/scripts/md2html.sh b/scripts/md2html.sh deleted file mode 100755 index c2ab149..0000000 --- a/scripts/md2html.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -md_file="$1" -html_file="$2" -title="$3" - -cat > "$html_file" <<-EOF - - - - - $title - - - - - -
-EOF - -yarn -s remark "$md_file" --use remark-html >> "$html_file" - -cat >> "$html_file" <<-EOF -
- - -EOF diff --git a/scripts/render.js b/scripts/render.js deleted file mode 100644 index b7496f7..0000000 --- a/scripts/render.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Liquid } from 'liquidjs' -import fs from 'fs' -import { spawnSync } from 'child_process' -import { ArgumentParser } from 'argparse' - -function parseArgs() { - const parser = ArgumentParser() - parser.add_argument('-o', '--output', { required: true }) - parser.add_argument('-c', '--config', { required: true }) - parser.add_argument('-r', '--revision') - parser.add_argument('file') - return parser.parse_args() -} - -function getCommitHash() { - const stdout = spawnSync('git', ['rev-parse', '--short=6', 'HEAD']).stdout - return stdout === null ? 'unknown' : stdout.toString().trim() -} - -function main() { - const args = parseArgs() - - const conf = JSON.parse(fs.readFileSync(args.config).toString()) - conf.COMMIT_HASH_6 = getCommitHash() - conf.DEPLOY_DATE = new Date().toString() - - const engine = new Liquid() - const rendered = engine.renderFileSync(args.file, {}, { globals: conf }) - fs.writeFileSync(args.output, rendered) -} - -main()