-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·35 lines (24 loc) · 998 Bytes
/
build.sh
File metadata and controls
executable file
·35 lines (24 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -euo pipefail
test -d www/ && find www/ -delete
mkdir -vp www/js
cp -vL src/js/config.js www/js
cp -vrL src/js/vendor www/js
cp -vr src/css www
( cd src && cp -vL *.png *.ico *.svg *.xml *.json worker.js index.html ../www )
sed -i "s/devMode = true/devMode = false/" www/index.html
# FIXME: webmentions.js cannot yet be bundled
mkdir -vp www/js/components/webmentions/js
cp -vL src/js/components/webmentions/js/webmention.js www/js/components/webmentions/js
# Update index.html title, feeds and blogroll
cat <<EOT | node --input-type=module
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { Config } from './www/js/config.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const indexPath = path.join(__dirname, 'www', 'index.html');
const indexContent = fs.readFileSync(indexPath, 'utf8');
fs.writeFileSync(indexPath, indexContent.replace(/<!-- head insertion marker -->/, Config.head));
EOT
npx webpack ${@-}