Skip to content

Commit d81207c

Browse files
committed
chore: Deploy an index.html for the CDN build
1 parent 7a46aa2 commit d81207c

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

script/cdn_build.sh

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
#!/bin/sh
22

3+
JSONURL_ORG_CLONE='https://github.com/jsonurl/jsonurl.github.io.git'
4+
SCRIPT_DIR=`dirname "$0"`
5+
VERSION_SH="$SCRIPT_DIR/version_snapshot.sh"
6+
7+
git clone "$JSONURL_ORG_CLONE" dist
8+
test -x "$VERSION_SH" && "$VERSION_SH"
39
npm run build
10+
cd ./dist
11+
12+
sed -i -zre 's/<script\s+src="https:\/\/cdn.jsdelivr.net\/npm\/@jsonurl[^"]*"\s+integrity="[^"]*"\s+crossorigin="[^"]*">/<script src="jsonurl.js">/' index.html
13+
14+
sed -e 's/src="jsonurl.js"/src="jsonurl.noproto.js"/' index.html > index-noproto.html
15+
16+
sed -i -re 's/<a title="GitHub" href="https:\/\/github.com\/jsonurl">GitHub/<a title="No Prototype Modification" href="index-noproto.html">NoProto/' index.html
17+
18+
419

5-
cat > dist/_headers <<EOT;
6-
/*.js
7-
Access-Control-Allow-Origin: *
8-
EOT
20+
#cat > dist/_headers <<EOT;
21+
#/*.js
22+
# Access-Control-Allow-Origin: *
23+
#EOT
924

0 commit comments

Comments
 (0)