SilverBullet pivot to become an offline-first PWA (#403)
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
KEY_CHAIN=build.keychain
|
||||
MACOS_CERT_P12_FILE=certificate.p12
|
||||
|
||||
# Recreate the certificate from the secure environment variable
|
||||
echo $MACOS_CERT_P12 | base64 --decode > $MACOS_CERT_P12_FILE
|
||||
|
||||
#create a keychain
|
||||
security create-keychain -p actions $KEY_CHAIN
|
||||
|
||||
# Make the keychain the default so identities are found
|
||||
security default-keychain -s $KEY_CHAIN
|
||||
|
||||
# Unlock the keychain
|
||||
security unlock-keychain -p actions $KEY_CHAIN
|
||||
|
||||
security import $MACOS_CERT_P12_FILE -k $KEY_CHAIN -P $MACOS_CERT_PASSWORD -T /usr/bin/codesign;
|
||||
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k actions $KEY_CHAIN
|
||||
|
||||
# remove certs
|
||||
rm -fr *.p12
|
||||
+24
-20
@@ -1,47 +1,51 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
echo "Generating version number..."
|
||||
echo "export const version = '$(git rev-parse HEAD)';" > version.ts
|
||||
fi
|
||||
|
||||
|
||||
echo "Building silver bullet"
|
||||
rm -rf website_build
|
||||
deno task clean
|
||||
deno task build
|
||||
echo "Cleaning website build dir"
|
||||
rm -rf website_build
|
||||
mkdir -p website_build/fs/_plug
|
||||
mkdir -p website_build/_fs/_plug website_build/_client
|
||||
echo "Copying silverbullet runtime files"
|
||||
cp -r dist_bundle/web/* website_build/
|
||||
cp dist_client_bundle/* website_build/
|
||||
cp -r dist_client_bundle/.client/* website_build/_client/
|
||||
|
||||
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
|
||||
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
|
||||
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/
|
||||
rm -rf website_build/_fs/_plug/{plugmd}.plug.js
|
||||
|
||||
echo "Copying website content into fs/"
|
||||
cp -r website/* website_build/fs/
|
||||
rm website_build/fs/{_redirects,_headers}
|
||||
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/
|
||||
|
||||
# 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
|
||||
echo "Generating file listing"
|
||||
deno run -A scripts/generate_fs_list.ts > website_build/index.json
|
||||
|
||||
echo > website_build/empty.md
|
||||
|
||||
echo "Bundling..."
|
||||
#echo "Bundling..."
|
||||
deno task bundle
|
||||
cp dist/silverbullet.js website_build/
|
||||
cp dist_bundle/web/global.plug.json website_build/
|
||||
cp web/images/logo.ico website_build/
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
echo "Now building SilverBullet bundle"
|
||||
curl -fsSL https://deno.land/install.sh | sh
|
||||
export PATH=~/.deno/bin:$PATH
|
||||
|
||||
echo "Generating version number..."
|
||||
echo "export const version = '$(git rev-parse HEAD)';" > version.ts
|
||||
echo "Building..."
|
||||
deno task build
|
||||
deno task install
|
||||
|
||||
rm -rf website_build
|
||||
silverbullet publish --index -o website_build website
|
||||
|
||||
echo "Bundling..."
|
||||
deno task bundle
|
||||
cp dist/silverbullet.js website_build/
|
||||
cp dist_bundle/web/global.plug.json website_build/
|
||||
@@ -4,7 +4,10 @@ import { walk } from "https://deno.land/std@0.165.0/fs/mod.ts";
|
||||
import { resolve } from "https://deno.land/std@0.165.0/path/mod.ts";
|
||||
import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts";
|
||||
|
||||
const rootDir = resolve("website_build/fs");
|
||||
const rootDir = resolve("website_build/_fs");
|
||||
|
||||
const lastModifiedTimestamp = +Deno.env.get("LAST_MODIFIED_TIMESTAMP")! ||
|
||||
Date.now();
|
||||
|
||||
const allFiles: FileMeta[] = [];
|
||||
for await (
|
||||
@@ -18,7 +21,7 @@ for await (
|
||||
const s = await Deno.stat(fullPath);
|
||||
allFiles.push({
|
||||
name: fullPath.substring(rootDir.length + 1),
|
||||
lastModified: 1,
|
||||
lastModified: lastModifiedTimestamp,
|
||||
contentType: mime.getType(fullPath) || "application/octet-stream",
|
||||
size: s.size,
|
||||
perm: "rw",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
VERSION=$1
|
||||
cd desktop; npm version $VERSION; cd ..
|
||||
echo "export const version = '$VERSION';" > version.ts
|
||||
git commit -am $VERSION
|
||||
git tag $VERSION
|
||||
git push && git push --tags
|
||||
|
||||
Reference in New Issue
Block a user