Clean up website build
This commit is contained in:
parent
6521016b7c
commit
ee4979b471
@ -35,14 +35,6 @@ export async function updateDirectivesOnPageCommand(arg: any) {
|
||||
// Collect all directives and their body replacements
|
||||
const replacements: { fullMatch: string; text?: string }[] = [];
|
||||
|
||||
// Sanity checking if the server gives useful responses (will not be the case on silverbullet.md)
|
||||
try {
|
||||
await system.invokeFunction("server", "serverPing");
|
||||
} catch {
|
||||
console.warn("Server not functional, not updating directives");
|
||||
return;
|
||||
}
|
||||
|
||||
await replaceAsync(
|
||||
text,
|
||||
directiveRegex,
|
||||
|
@ -11,9 +11,6 @@ functions:
|
||||
key: "Alt-q"
|
||||
events:
|
||||
- editor:pageLoaded
|
||||
serverPing:
|
||||
env: server
|
||||
path: ./command.ts:serverPing
|
||||
indexData:
|
||||
path: ./data.ts:indexData
|
||||
events:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Install Deno"
|
||||
# curl -fsSL https://deno.land/install.sh | sh
|
||||
# export PATH=~/.deno/bin:$PATH
|
||||
curl -fsSL https://deno.land/install.sh | sh
|
||||
export PATH=~/.deno/bin:$PATH
|
||||
|
||||
echo "Building silver bullet"
|
||||
deno task build
|
||||
@ -11,14 +11,21 @@ rm -rf website_build
|
||||
mkdir -p website_build/fs/_plug
|
||||
echo "Copying silverbullet runtime files"
|
||||
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/
|
||||
|
||||
echo "Copying website markdown files"
|
||||
echo "And all plugs"
|
||||
cp -r dist_bundle/_plug/* website_build/fs/_plug/
|
||||
echo "But remove some plugs"
|
||||
rm -rf website_build/fs/_plug/{directive,plugmd,publish}.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
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
const { resolve } = require("path");
|
||||
const { readdir } = require("fs").promises;
|
||||
const mime = require("mime-types");
|
||||
|
||||
async function getFiles(dir) {
|
||||
const dirents = await readdir(dir, { withFileTypes: true });
|
||||
const files = await Promise.all(
|
||||
dirents.map((dirent) => {
|
||||
const res = resolve(dir, dirent.name);
|
||||
return dirent.isDirectory() ? getFiles(res) : res;
|
||||
}),
|
||||
);
|
||||
return Array.prototype.concat(...files);
|
||||
}
|
||||
|
||||
const rootDir = resolve("website_build/fs");
|
||||
|
||||
getFiles(rootDir).then((files) => {
|
||||
files = files
|
||||
.map((file) => ({
|
||||
name: file.substring(rootDir.length + 1),
|
||||
lastModified: 0,
|
||||
contentType: mime.lookup(file),
|
||||
size: 0,
|
||||
perm: "rw",
|
||||
}))
|
||||
.filter((pageMeta) => !pageMeta.name.startsWith("."));
|
||||
console.log(JSON.stringify(files, null, 2));
|
||||
});
|
@ -1,9 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
VERSION=$1
|
||||
npm version --ws $VERSION || true
|
||||
npm install --workspace packages/server --save @silverbulletmd/web@$VERSION @silverbulletmd/common@$VERSION @silverbulletmd/plugs@$VERSION
|
||||
npm install --workspace packages/plugs --save @silverbulletmd/common@$VERSION
|
||||
|
||||
npm run clean-build
|
||||
npm run publish-all
|
Loading…
Reference in New Issue
Block a user