2023-01-26 11:09:24 +00:00
|
|
|
#!/bin/bash -e
|
2022-07-15 09:36:11 +00:00
|
|
|
|
2023-05-23 18:53:53 +00:00
|
|
|
if [ "$1" != "local" ]; then
|
|
|
|
echo "Install Deno"
|
|
|
|
curl -fsSL https://deno.land/install.sh | sh
|
|
|
|
export PATH=~/.deno/bin:$PATH
|
|
|
|
export DENO_DIR=$PWD/deno_cache
|
|
|
|
echo "DENO_DIR: $DENO_DIR"
|
|
|
|
mkdir -p $DENO_DIR
|
2022-10-29 14:01:20 +00:00
|
|
|
|
2023-05-23 18:53:53 +00:00
|
|
|
fi
|
2022-11-01 16:03:42 +00:00
|
|
|
|
2023-01-26 11:09:24 +00:00
|
|
|
|
2023-01-25 17:29:47 +00:00
|
|
|
echo "Building silver bullet"
|
2023-05-23 18:53:53 +00:00
|
|
|
rm -rf website_build
|
|
|
|
deno task clean
|
2023-01-25 17:29:47 +00:00
|
|
|
deno task build
|
|
|
|
echo "Cleaning website build dir"
|
2022-11-01 16:03:42 +00:00
|
|
|
rm -rf website_build
|
2023-05-23 18:53:53 +00:00
|
|
|
mkdir -p website_build/_fs/_plug website_build/_client
|
2023-01-25 17:29:47 +00:00
|
|
|
echo "Copying silverbullet runtime files"
|
2023-05-23 18:53:53 +00:00
|
|
|
cp dist_client_bundle/* website_build/
|
|
|
|
cp -r dist_client_bundle/.client/* website_build/_client/
|
2023-01-25 17:29:47 +00:00
|
|
|
|
|
|
|
echo "And all plugs"
|
2023-05-23 18:53:53 +00:00
|
|
|
cp -r dist_plug_bundle/_plug/* website_build/_fs/_plug/
|
|
|
|
#echo "And additional ones"
|
|
|
|
curl https://raw.githubusercontent.com/silverbulletmd/silverbullet-mermaid/main/mermaid.plug.js > website_build/_fs/_plug/mermaid.plug.js
|
2023-01-25 17:29:47 +00:00
|
|
|
echo "But remove some plugs"
|
2023-05-23 18:53:53 +00:00
|
|
|
rm -rf website_build/_fs/_plug/{plugmd}.plug.js
|
2023-01-25 17:29:47 +00:00
|
|
|
|
|
|
|
echo "Copying website content into fs/"
|
2023-05-23 18:53:53 +00:00
|
|
|
cp -r website/* website_build/_fs/
|
|
|
|
rm website_build/_fs/{_redirects,_headers}
|
2023-01-25 17:29:47 +00:00
|
|
|
|
|
|
|
echo "Copy website files another time into the root"
|
|
|
|
cp -r website/* website_build/
|
|
|
|
|
2023-05-23 18:53:53 +00:00
|
|
|
# Genereate random modified date, and replace in _headers too
|
|
|
|
export LAST_MODIFIED_TIMESTAMP=$RANDOM
|
|
|
|
|
|
|
|
cat website/_headers | sed "s/12345/$LAST_MODIFIED_TIMESTAMP/g" > website_build/_headers
|
2023-01-25 17:29:47 +00:00
|
|
|
echo "Generating file listing"
|
|
|
|
deno run -A scripts/generate_fs_list.ts > website_build/index.json
|
|
|
|
|
|
|
|
echo > website_build/empty.md
|
2022-11-01 16:03:42 +00:00
|
|
|
|
2023-05-23 18:53:53 +00:00
|
|
|
#echo "Bundling..."
|
2022-10-29 07:54:18 +00:00
|
|
|
deno task bundle
|
2022-10-29 13:48:27 +00:00
|
|
|
cp dist/silverbullet.js website_build/
|
2023-01-25 17:29:47 +00:00
|
|
|
cp web/images/logo.ico website_build/
|