1
0
This commit is contained in:
Zef Hemel 2022-09-13 08:46:30 +02:00
parent d9338543eb
commit 43b5f62210
3 changed files with 8 additions and 15 deletions

View File

@ -4,22 +4,18 @@ echo "Building silver bullet"
npm run clean-build npm run clean-build
echo "Cleaning website build dir" echo "Cleaning website build dir"
rm -rf website_build rm -rf website_build
mkdir -p website_build/page/_plug mkdir -p website_build/fs/_plug
echo "Copying silverbullet runtime files" echo "Copying silverbullet runtime files"
cp -r packages/web/dist/* website_build/ cp -r packages/web/dist/* website_build/
echo "Copying netlify config files" echo "Copying netlify config files"
cp website/{_redirects,_headers} website_build/ cp website/{_redirects,_headers} website_build/
echo "Copying website markdown files" echo "Copying website markdown files"
cp -r website/* website_build/page/ cp -r website/* website_build/fs/
rm website_build/page/{_redirects,_headers} rm website_build/fs/{_redirects,_headers}
echo "Copying standard set of plugs" echo "Copying standard set of plugs"
cp packages/plugs/dist/* website_build/page/_plug/ cp packages/plugs/dist/* website_build/fs/_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}"' _ {} \;
echo "Generating file listing" echo "Generating file listing"
node scripts/generate_fs_list.js > website_build/index.json node scripts/generate_fs_list.js > website_build/index.json

View File

@ -12,15 +12,12 @@ async function getFiles(dir) {
return Array.prototype.concat(...files); return Array.prototype.concat(...files);
} }
const rootDir = resolve("website_build/page"); const rootDir = resolve("website_build/fs");
getFiles(rootDir).then((files) => { getFiles(rootDir).then((files) => {
files = files files = files
.map((file) => ({ .map((file) => ({
name: file name: file.substring(rootDir.length + 1),
.substring(rootDir.length + 1)
.replace(/\.md$/, "")
.replace(/\.plug\.json$/, ""),
lastModified: 0, lastModified: 0,
perm: "rw", perm: "rw",
})) }))

View File

@ -1,8 +1,8 @@
/page/_plug/* /fs/_plug/*
Content-Type: application/json Content-Type: application/json
Last-Modified: 0 Last-Modified: 0
X-Permission: ro X-Permission: ro
/page/* /fs/*
Content-Type: text/markdown Content-Type: text/markdown
Last-Modified: 0 Last-Modified: 0
X-Permission: rw X-Permission: rw