1
0
This commit is contained in:
Zef Hemel 2022-10-29 16:27:16 +02:00
parent fa66b775a5
commit 63aea3c593
2 changed files with 35 additions and 6 deletions

View File

@ -1,12 +1,17 @@
#!/bin/bash
echo "Install Deno"
# curl -fsSL https://deno.land/install.sh | sh
# export PATH=~/.deno/bin:$PATH
echo "Building silver bullet"
npm run clean-build
deno task build
echo "Cleaning website build dir"
rm -rf website_build
mkdir -p website_build/fs/_plug
echo "Copying silverbullet runtime files"
cp -r packages/web/dist/* website_build/
cp -r dist_bundle/web/* website_build/
cp -r dist_bundle/_plug/* website_build/fs/_plug/
echo "Copying netlify config files"
cp website/{_redirects,_headers} website_build/
@ -14,11 +19,8 @@ echo "Copying website markdown files"
cp -r website/* website_build/fs/
rm website_build/fs/{_redirects,_headers}
echo "Copying standard set of plugs"
cp packages/plugs/dist/* website_build/fs/_plug/
echo "Generating file listing"
node scripts/generate_fs_list.js > website_build/index.json
deno run -A scripts/generate_fs_list.ts > website_build/index.json
echo > website_build/empty.md

View File

@ -0,0 +1,27 @@
import type { FileMeta } from "../common/types.ts";
import { walk } from "https://deno.land/std@0.159.0/fs/mod.ts";
import { resolve } from "https://deno.land/std@0.159.0/path/mod.ts";
import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts";
const rootDir = resolve("website_build/fs");
const allFiles: FileMeta[] = [];
for await (
const file of walk(rootDir, {
includeDirs: false,
// Exclude hidden files
skip: [/^.*\/\..+$/],
})
) {
const fullPath = file.path;
const s = await Deno.stat(fullPath);
allFiles.push({
name: fullPath.substring(rootDir.length + 1),
lastModified: s.mtime!.getTime(),
contentType: mime.getType(fullPath) || "application/octet-stream",
size: s.size,
perm: "rw",
});
}
console.log(JSON.stringify(allFiles, null, 2));