From 43b5f62210127e69894793fb74d7fa7b7f369fe6 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Tue, 13 Sep 2022 08:46:30 +0200 Subject: [PATCH] Fix demo --- scripts/build_demo.sh | 12 ++++-------- scripts/generate_fs_list.js | 7 ++----- website/_headers | 4 ++-- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/scripts/build_demo.sh b/scripts/build_demo.sh index facacaa..52864ff 100755 --- a/scripts/build_demo.sh +++ b/scripts/build_demo.sh @@ -4,22 +4,18 @@ echo "Building silver bullet" npm run clean-build echo "Cleaning website build dir" rm -rf website_build -mkdir -p website_build/page/_plug +mkdir -p website_build/fs/_plug echo "Copying silverbullet runtime files" cp -r packages/web/dist/* website_build/ echo "Copying netlify config files" cp website/{_redirects,_headers} website_build/ echo "Copying website markdown files" -cp -r website/* website_build/page/ -rm website_build/page/{_redirects,_headers} +cp -r website/* website_build/fs/ +rm website_build/fs/{_redirects,_headers} echo "Copying standard set of plugs" -cp packages/plugs/dist/* website_build/page/_plug/ - -echo "Applying rename magic" -find website_build/page/ -depth -name "*.md" -exec sh -c 'mv "$1" "${1%.md}"' _ {} \; -find website_build/page/ -depth -name "*.plug.json" -exec sh -c 'mv "$1" "${1%.plug.json}"' _ {} \; +cp packages/plugs/dist/* website_build/fs/_plug/ echo "Generating file listing" node scripts/generate_fs_list.js > website_build/index.json diff --git a/scripts/generate_fs_list.js b/scripts/generate_fs_list.js index f07e26e..0ccb5e3 100644 --- a/scripts/generate_fs_list.js +++ b/scripts/generate_fs_list.js @@ -12,15 +12,12 @@ async function getFiles(dir) { return Array.prototype.concat(...files); } -const rootDir = resolve("website_build/page"); +const rootDir = resolve("website_build/fs"); getFiles(rootDir).then((files) => { files = files .map((file) => ({ - name: file - .substring(rootDir.length + 1) - .replace(/\.md$/, "") - .replace(/\.plug\.json$/, ""), + name: file.substring(rootDir.length + 1), lastModified: 0, perm: "rw", })) diff --git a/website/_headers b/website/_headers index 24f3de4..c596b53 100644 --- a/website/_headers +++ b/website/_headers @@ -1,8 +1,8 @@ -/page/_plug/* +/fs/_plug/* Content-Type: application/json Last-Modified: 0 X-Permission: ro -/page/* +/fs/* Content-Type: text/markdown Last-Modified: 0 X-Permission: rw