diff --git a/.air.toml b/.air.toml deleted file mode 100644 index b0b67da1..00000000 --- a/.air.toml +++ /dev/null @@ -1,36 +0,0 @@ -root = "." -tmp_dir = "tmp" - -[build] - args_bin = [] - bin = "silverbullet" - cmd = "make" - # delay = 10000 - exclude_dir = ["node_modules", "website", "scripts", "client_bundle", "dist"] - exclude_file = ["public_version.ts"] - # Per-plug `assets/` folders are build outputs (see each plug's .plug.yaml - # `build:` section); watching them would cause a rebuild loop. - exclude_regex = ["_test.go", ".test.ts", "plugs/[^/]+/assets/"] - exclude_unchanged = false - follow_symlink = false - full_bin = "" - include_dir = [] - include_ext = ["go", "html", "ts", "tsx", "scss", "md", "yaml"] - kill_delay = "0s" - log = "build-errors.log" - poll = false - poll_interval = 0 - post_cmd = [] - pre_cmd = [] - stop_on_error = true - -[color] - app = "" - build = "yellow" - main = "magenta" - runner = "green" - watcher = "cyan" - -[screen] - clear_on_rebuild = true - keep_scroll = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc57e9c9..702de480 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,7 +240,7 @@ jobs: body: Automated build from commit ${{ github.sha }} prerelease: true files: | - website/CHANGELOG.md + docs/CHANGELOG.md dist/plug-compile.js dist-artifacts/silverbullet-server-*.zip dist-artifacts/sb-*.zip @@ -254,7 +254,7 @@ jobs: with: draft: false files: | - website/CHANGELOG.md + docs/CHANGELOG.md dist/plug-compile.js dist-artifacts/silverbullet-server-*.zip dist-artifacts/sb-*.zip diff --git a/Dockerfile.website b/Dockerfile.website index 8495f1db..fdb01ee6 100644 --- a/Dockerfile.website +++ b/Dockerfile.website @@ -7,7 +7,7 @@ ENV SB_INDEX_PAGE=SilverBullet ENV SB_READ_ONLY=1 # Add the website content -ADD website /space +ADD docs /space # Add silversearch plug ADD https://github.com/MrMugame/silversearch/releases/download/edge/silversearch.plug.js /space/ diff --git a/Makefile b/Makefile index 0039b82d..b92c7c72 100644 --- a/Makefile +++ b/Makefile @@ -163,5 +163,5 @@ generate: npx @lezer/generator@1.5.1 client/space_lua/lua.grammar -o client/space_lua/parse-lua.js website: build-rs - SB_INDEX_PAGE=SilverBullet SB_DISABLE_SERVICE_WORKER=1 ./target/release/silverbullet -p 3001 website + SB_INDEX_PAGE=SilverBullet SB_DISABLE_SERVICE_WORKER=1 ./target/release/silverbullet -p 3001 docs diff --git a/README.md b/README.md index d2ff33c1..9f542c32 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The server backend is written in [Rust](https://www.rust-lang.org/) (a Cargo wor * `syscalls/`: TypeScript wrappers around syscalls * `types/`: Various (client) types that can be references from plugs * `scripts/`: Useful scripts -* `website/`: silverbullet.md website content +* `docs/`: documentation (also serves a silverbullet.md website content) ### Requirements * [Node.js](https://nodejs.org/) 24+ and npm 10+: Used to build the frontend (client) and plugs diff --git a/STYLE.md b/STYLE.md index a8ea0d78..1f044fd0 100644 --- a/STYLE.md +++ b/STYLE.md @@ -130,4 +130,4 @@ const { text, meta } = await this.space.readPage(name); Follow common Go conventions. `make fmt` also reformats Go code. ## Lua (libraries) -See `website/Space Lua/Conventions` +See `docs/Space Lua/Conventions` diff --git a/bin/sb/src/api.rs b/bin/sb/src/api.rs index 469a3485..09ec3f03 100644 --- a/bin/sb/src/api.rs +++ b/bin/sb/src/api.rs @@ -2,7 +2,7 @@ //! //! All methods live on [`crate::conn::SpaceConnection`]. The Rust server //! wraps eval responses in a `{ "result": }` / `{ "error": }` -//! envelope (see `website/Runtime API.md`) — see the per-method docs for exact +//! envelope (see `docs/Runtime API.md`) — see the per-method docs for exact //! response shapes. use reqwest::StatusCode; @@ -70,7 +70,7 @@ impl SpaceConnection { if status.is_success() { // On 200, the body is the `{ "result": }` envelope (Core's - // runtime handlers wrap eval results; see `website/Runtime API.md`). + // runtime handlers wrap eval results; see `docs/Runtime API.md`). // A Lua-level failure arrives as `{ "error": }`. let v: Value = serde_json::from_slice(&bytes) .map_err(|e| format!("parsing response JSON: {e}"))?; diff --git a/docs/Development.md b/docs/Development.md index 5ff9e76f..892a1e77 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -26,7 +26,7 @@ The SilverBullet server is written in [Rust](https://www.rust-lang.org/) (a Carg * `types/`: Various (client) types that can be references from plugs * `bin/plug-compile.ts`: the plug compiler * `scripts/`: Useful scripts -* `website/`: silverbullet.md website content +* `docs/`: silverbullet.md website content # Development Requirements: diff --git a/e2e/guide-journaling.test.ts b/e2e/guide-journaling.test.ts index 4d9a7cb0..226b07fe 100644 --- a/e2e/guide-journaling.test.ts +++ b/e2e/guide-journaling.test.ts @@ -1,7 +1,7 @@ import type { Page } from "@playwright/test"; import { expect, mod, test, waitForSaveAndReadFromServer } from "./fixtures.ts"; -// This file exercises the workflow described in website/Journal.md end-to-end. +// This file exercises the workflow described in docs/Journal.md end-to-end. // The Journal feature is built in: the `Journal: Today` command and the // default template at `Library/Std/Journal/Template` ship with SilverBullet. diff --git a/e2e/guide-knowledge-base.test.ts b/e2e/guide-knowledge-base.test.ts index 14b05a0b..f49cf82b 100644 --- a/e2e/guide-knowledge-base.test.ts +++ b/e2e/guide-knowledge-base.test.ts @@ -7,7 +7,7 @@ import { waitForSaveAndReadFromServer, } from "./fixtures.ts"; -// This file exercises the workflow described in website/Guide/Knowledge Base.md +// This file exercises the workflow described in docs/Guide/Knowledge Base.md // end-to-end. It seeds a small interconnected knowledge base, then verifies // the load-bearing claims of the guide: // - links create connections between pages diff --git a/e2e/guide-people-notes.test.ts b/e2e/guide-people-notes.test.ts index a5f683bf..bba4396f 100644 --- a/e2e/guide-people-notes.test.ts +++ b/e2e/guide-people-notes.test.ts @@ -1,6 +1,6 @@ import { expect, gotoSilverBulletPage, test } from "./fixtures.ts"; -// This file exercises the workflow described in website/Guide/People Notes.md +// This file exercises the workflow described in docs/Guide/People Notes.md // end-to-end. It seeds a small CRM-style space and verifies the load-bearing // claims of the guide: // - person pages are tagged via frontmatter diff --git a/e2e/guide-task-management.test.ts b/e2e/guide-task-management.test.ts index 8652e0de..36ba69ef 100644 --- a/e2e/guide-task-management.test.ts +++ b/e2e/guide-task-management.test.ts @@ -5,7 +5,7 @@ import { waitForSaveAndReadFromServer, } from "./fixtures.ts"; -// This file exercises the workflow described in website/Guide/Task Management.md +// This file exercises the workflow described in docs/Guide/Task Management.md // end-to-end. It seeds a small project + task space and verifies the // load-bearing claims of the guide: // - tasks on a project page render with checkboxes diff --git a/plug-api/lib/tree.bench.ts b/plug-api/lib/tree.bench.ts index d93819aa..4e6d0b5e 100644 --- a/plug-api/lib/tree.bench.ts +++ b/plug-api/lib/tree.bench.ts @@ -1,7 +1,12 @@ -import { bench, describe } from "vitest"; import { readdirSync, readFileSync, statSync } from "node:fs"; import { join } from "node:path"; import { fileURLToPath } from "node:url"; +import { bench, describe } from "vitest"; +import { lezerToParseTree } from "../../client/markdown_parser/parse_tree.ts"; +import { + extendedMarkdownLanguage, + parseMarkdown, +} from "../../client/markdown_parser/parser.ts"; import { addParentPointers, cloneTree, @@ -14,15 +19,10 @@ import { replaceNodesMatching, traverseTree, } from "./tree.ts"; -import { parseMarkdown } from "../../client/markdown_parser/parser.ts"; -import { - lezerToParseTree, -} from "../../client/markdown_parser/parse_tree.ts"; -import { extendedMarkdownLanguage } from "../../client/markdown_parser/parser.ts"; -// --- Load all website markdown files --- +// --- Load all docs markdown files --- const __dirname = fileURLToPath(new URL(".", import.meta.url)); -const websiteDir = join(__dirname, "../../website"); +const docsDir = join(__dirname, "../../docs"); type PageData = { name: string; @@ -47,7 +47,7 @@ function loadMarkdownFiles(dir: string, base = ""): PageData[] { return pages; } -const pages = loadMarkdownFiles(websiteDir); +const pages = loadMarkdownFiles(docsDir); // Pre-parse trees for tree-operation benchmarks const parsedTrees: ParseTree[] = pages.map((p) => parseMarkdown(p.text)); diff --git a/plugs/index/index.bench.ts b/plugs/index/index.bench.ts index 8bdd1c99..c26a729d 100644 --- a/plugs/index/index.bench.ts +++ b/plugs/index/index.bench.ts @@ -1,28 +1,28 @@ +import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; +import type { PageMeta } from "@silverbulletmd/silverbullet/type/index"; import { bench, describe } from "vitest"; import { parseMarkdown } from "../../client/markdown_parser/parser.ts"; import { createMockSystem } from "../../plug-api/system_mock.ts"; -import { extractFrontMatter, type FrontMatter } from "./frontmatter.ts"; -import { indexPage as pageIndexPage } from "./page.ts"; import { indexData } from "./data.ts"; -import { indexItems } from "./item.ts"; +import { extractFrontMatter, type FrontMatter } from "./frontmatter.ts"; import { indexHeaders } from "./header.ts"; +import { allIndexers } from "./indexer.ts"; +import { indexItems } from "./item.ts"; +import { indexPage as pageIndexPage } from "./page.ts"; import { indexParagraphs } from "./paragraph.ts"; import { indexRelations } from "./relation.ts"; -import { indexTables } from "./table.ts"; import { indexSpaceLua } from "./space_lua.ts"; import { indexSpaceStyle } from "./space_style.ts"; +import { indexTables } from "./table.ts"; import { indexTags } from "./tags.ts"; -import { allIndexers } from "./indexer.ts"; import { type CorpusPage, + docsDir, loadMarkdownFiles, stubPageMeta, - websiteDir, } from "./test_corpus.ts"; -import type { PageMeta } from "@silverbulletmd/silverbullet/type/index"; -import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; -const pages = loadMarkdownFiles(websiteDir); +const pages = loadMarkdownFiles(docsDir); // Pre-parse trees for indexer-only benchmarks. type ParsedPage = CorpusPage & { diff --git a/plugs/index/index_stats.ts b/plugs/index/index_stats.ts index 64d7d9c4..7ee1b061 100644 --- a/plugs/index/index_stats.ts +++ b/plugs/index/index_stats.ts @@ -1,27 +1,27 @@ // Run with `npm run index-stats`. // -// Indexes every Markdown page under `silverbullet/website/` and reports +// Indexes every Markdown page under `silverbullet/docs/` and reports // total indexer wall time (mean over a few runs) and object counts // grouped by tag, with a sub-breakdown of relation records by kind. // // Parsing is hoisted out of the timing loop so the reported time // reflects the indexer pipeline itself, not Lezer parsing. +import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; +import type { + ObjectValue, + PageMeta, +} from "@silverbulletmd/silverbullet/type/index"; import { parseMarkdown } from "../../client/markdown_parser/parser.ts"; import { createMockSystem } from "../../plug-api/system_mock.ts"; import { extractFrontMatter, type FrontMatter } from "./frontmatter.ts"; import { allIndexers } from "./indexer.ts"; import { type CorpusPage, + docsDir, loadMarkdownFiles, stubPageMeta, - websiteDir, } from "./test_corpus.ts"; -import type { - ObjectValue, - PageMeta, -} from "@silverbulletmd/silverbullet/type/index"; -import type { ParseTree } from "@silverbulletmd/silverbullet/lib/tree"; createMockSystem(); @@ -72,8 +72,8 @@ async function runOnce(parsed: ParsedPage[]): Promise { } async function main() { - const pages = loadMarkdownFiles(websiteDir); - console.log(`Loaded ${pages.length} pages from ${websiteDir}`); + const pages = loadMarkdownFiles(docsDir); + console.log(`Loaded ${pages.length} pages from ${docsDir}`); const parsed: ParsedPage[] = pages.map((p) => { const tree = parseMarkdown(p.text); @@ -111,9 +111,9 @@ async function main() { console.log(`Per page mean: ${(r.total / pages.length).toFixed(1)}`); console.log(`\n=== OBJECTS BY TAG ===`); - for ( - const [tag, count] of Object.entries(r.byTag).sort((a, b) => b[1] - a[1]) - ) { + for (const [tag, count] of Object.entries(r.byTag).sort( + (a, b) => b[1] - a[1], + )) { const pct = ((count / r.total) * 100).toFixed(1); console.log(` ${tag.padEnd(20)} ${String(count).padStart(5)} (${pct}%)`); } @@ -121,11 +121,9 @@ async function main() { const relTotal = r.byTag.relation ?? 0; if (relTotal > 0) { console.log(`\n=== RELATION RECORDS BY KIND ===`); - for ( - const [kind, count] of Object.entries(r.relationByKind).sort( - (a, b) => b[1] - a[1], - ) - ) { + for (const [kind, count] of Object.entries(r.relationByKind).sort( + (a, b) => b[1] - a[1], + )) { const pct = ((count / relTotal) * 100).toFixed(1); console.log( ` ${kind.padEnd(14)} ${String(count).padStart(5)} (${pct}%)`, diff --git a/plugs/index/test_corpus.ts b/plugs/index/test_corpus.ts index 8c9e78c7..9043c22b 100644 --- a/plugs/index/test_corpus.ts +++ b/plugs/index/test_corpus.ts @@ -1,4 +1,4 @@ -// Shared test/benchmark helpers for loading the silverbullet/website +// Shared test/benchmark helpers for loading the silverbullet/docs // markdown corpus and synthesizing PageMeta stubs. import { readdirSync, readFileSync, statSync } from "node:fs"; @@ -11,9 +11,7 @@ export type CorpusPage = { text: string; }; -export const websiteDir = fileURLToPath( - new URL("../../website", import.meta.url), -); +export const docsDir = fileURLToPath(new URL("../../docs", import.meta.url)); export function loadMarkdownFiles(dir: string, base = ""): CorpusPage[] { const out: CorpusPage[] = []; diff --git a/scripts/deploy_silverbullet_md.sh b/scripts/deploy_silverbullet_md.sh deleted file mode 100755 index 552f9eb3..00000000 --- a/scripts/deploy_silverbullet_md.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -e - -cd $(realpath $(dirname $(dirname $0))) - -IMAGE_NAME="ghcr.io/silverbulletmd/silverbullet:v2" -WEBSITE_SPACE="./website" -WEBSITE_PORT=3002 - -# Get the current image ID -BEFORE_PULL=$(docker images -q $IMAGE_NAME) - -# Pull the Docker image -docker pull $IMAGE_NAME - -# Get the new image ID -AFTER_PULL=$(docker images -q $IMAGE_NAME) - -# Compare the image IDs -if [ "$BEFORE_PULL" == "$AFTER_PULL" ]; then - echo "The Docker image has not been updated. Done!" - exit 0 -fi - -echo "The Docker image has been updated, let's update the website content." -git pull - -# Check if a silverbullet container is running already -if [ "$(docker ps -q -f name=silverbullet-v2)" ]; then - echo "A silverbullet container is running, let's stop it." - docker kill silverbullet-v2 - docker rm silverbullet-v2 -fi - -# Remove the old database -echo "Removing old databases" -rm -f $WEBSITE_SPACE/.silverbullet.db* - -echo "Starting new silverbullet container" -docker run -d --name silverbullet-v2 --restart unless-stopped -v $WEBSITE_SPACE:/space -e SB_INDEX_PAGE=SilverBullet -e SB_READ_ONLY=1 -p $WEBSITE_PORT:3000 $IMAGE_NAME - - -echo "Waiting for the servers to start" - -# Repeatedly try to connect to the server until it responds -until $(curl --output /dev/null --silent --head --fail http://localhost:$WEBSITE_PORT/); do - printf '.' - sleep 1 -done -echo -echo "We're back up!" \ No newline at end of file diff --git a/scripts/deploy_silverbullet_playground.sh b/scripts/deploy_silverbullet_playground.sh deleted file mode 100755 index 0b3bcb69..00000000 --- a/scripts/deploy_silverbullet_playground.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -e - -cd $(realpath $(dirname $(dirname $0))) - -IMAGE_NAME="ghcr.io/silverbulletmd/silverbullet:v2" -PLAYGROUND_SPACE="/tmp/silverbullet-playground" -PLAYGROUND_PORT=3001 -SB_USER=silverbullet:silverbullet - -# Now do the same for the playground -echo "Now resetting the playground" - -# Check if a silverbullet container is running already -if [ "$(docker ps -q -f name=silverbullet-playground)" ]; then - echo "A playground container is running, let's stop it." - docker kill silverbullet-playground - docker rm silverbullet-playground -fi - -# Remove the old space -echo "Removing old playground space" -rm -rf $PLAYGROUND_SPACE - -echo "Creating fresh playground space" -mkdir -p $PLAYGROUND_SPACE -cp -r scripts/playground_space/* $PLAYGROUND_SPACE/ - -echo "Starting new playground container" -docker run -d --name silverbullet-playground --restart unless-stopped -v $PLAYGROUND_SPACE:/space -e SB_SHELL_BACKEND=off -e SB_USER=$SB_USER -p $PLAYGROUND_PORT:3000 $IMAGE_NAME - -echo "Waiting for the server to start" - -until $(curl --output /dev/null --silent --head --fail http://localhost:$PLAYGROUND_PORT/); do - printf '.' - sleep 1 -done -echo -echo "We're back up!" \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 15a7cc69..c61b0220 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,5 +22,5 @@ "build_*.ts", "version.ts" ], - "exclude": ["node_modules", "dist", "client_bundle", "website"] + "exclude": ["node_modules", "dist", "client_bundle", "docs"] } diff --git a/vitest.config.ts b/vitest.config.ts index 6ff654d5..c46b1c55 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -47,7 +47,7 @@ export default defineConfig({ "dist", "client_bundle", "e2e", - "website", + "docs", "server", // Exclude helper test files (no test() blocks, only export helper functions) "client/data/kv_primitives.test.ts",