1
0
silverbullet/scripts/build_website.sh

47 lines
1.4 KiB
Bash
Raw Normal View History

2023-01-26 11:09:24 +00:00
#!/bin/bash -e
2022-07-15 09:36:11 +00:00
2023-01-25 17:29:47 +00:00
echo "Install Deno"
2022-10-29 07:54:18 +00:00
curl -fsSL https://deno.land/install.sh | sh
export PATH=~/.deno/bin:$PATH
2023-01-26 12:02:13 +00:00
export DENO_DIR=$PWD/deno_cache
echo "DENO_DIR: $DENO_DIR"
mkdir -p $DENO_DIR
2022-10-29 14:01:20 +00:00
echo "Generating version number..."
echo "export const version = '$(git rev-parse HEAD)';" > version.ts
2023-01-26 11:09:24 +00:00
2023-01-25 17:29:47 +00:00
echo "Building silver bullet"
deno task build
echo "Cleaning website build dir"
rm -rf website_build
2023-01-25 17:29:47 +00:00
mkdir -p website_build/fs/_plug
echo "Copying silverbullet runtime files"
cp -r dist_bundle/web/* website_build/
echo "And all plugs"
cp -r dist_bundle/_plug/* website_build/fs/_plug/
echo "And additional ones"
curl https://raw.githubusercontent.com/silverbulletmd/silverbullet-mermaid/main/mermaid.plug.json > website_build/fs/_plug/mermaid.plug.json
echo "But remove some plugs"
rm -rf website_build/fs/_plug/{directive,plugmd,publish,share}.plug.json
#echo "Copying netlify config files"
#cp website/{_redirects,_headers} website_build/
echo "Copying website content into fs/"
cp -r website/* website_build/fs/
rm website_build/fs/{_redirects,_headers}
echo "Copy website files another time into the root"
cp -r website/* website_build/
echo "Generating file listing"
deno run -A scripts/generate_fs_list.ts > website_build/index.json
echo > website_build/empty.md
2022-10-29 14:01:20 +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 dist_bundle/web/global.plug.json website_build/
cp web/images/logo.ico website_build/