From bb1e49a11ea7619b3c9ebce041042feb8d7d2441 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 8 Feb 2024 21:12:23 +0100 Subject: [PATCH] More moving stuff around --- .gitpod.Dockerfile | 2 +- Dockerfile | 2 +- cmd/README.md | 1 + common/README.md | 1 + common/settings.ts | 2 +- lib/README.md | 2 +- plug-api/README.md | 4 ++++ plug-api/syscalls/editor.ts | 2 +- plugs/.gitignore | 1 - plugs/README.md | 1 + plugs/emoji/emoji.ts | 2 +- server/http_server.ts | 2 +- server/instance.ts | 2 +- server/shell_backend.ts | 2 +- server/syscalls/shell.ts | 2 +- {server => type}/rpc.ts | 0 web/types.ts => type/web.ts | 0 web/client.ts | 4 ++-- web/components/command_palette.tsx | 2 +- web/components/filter.tsx | 2 +- web/components/page_navigator.tsx | 2 +- web/components/panel.tsx | 2 +- web/components/top_bar.tsx | 2 +- web/editor_ui.tsx | 2 +- web/fuse_search.test.ts | 2 +- web/fuse_search.ts | 2 +- web/reducer.ts | 2 +- web/syscalls/editor.ts | 2 +- 28 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 cmd/README.md create mode 100644 common/README.md create mode 100644 plug-api/README.md delete mode 100644 plugs/.gitignore create mode 100644 plugs/README.md rename {server => type}/rpc.ts (100%) rename web/types.ts => type/web.ts (100%) diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index ff2e0ee7..5b08e5e8 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -1,6 +1,6 @@ FROM gitpod/workspace-full:latest -RUN curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.38.5 +RUN curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.40.4 RUN /home/gitpod/.deno/bin/deno completions bash > /home/gitpod/.bashrc.d/90-deno && \ echo 'export DENO_INSTALL="/home/gitpod/.deno"' >> /home/gitpod/.bashrc.d/90-deno && \ echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> /home/gitpod/.bashrc.d/90-deno diff --git a/Dockerfile b/Dockerfile index 2b2610b5..6a3dc2dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lukechannings/deno:v1.40.3 +FROM lukechannings/deno:v1.40.4 # The volume that will keep the space data # Either create a volume: diff --git a/cmd/README.md b/cmd/README.md new file mode 100644 index 00000000..e810f573 --- /dev/null +++ b/cmd/README.md @@ -0,0 +1 @@ +Code that implements `silverbullet` sub commands \ No newline at end of file diff --git a/common/README.md b/common/README.md new file mode 100644 index 00000000..1a6a7493 --- /dev/null +++ b/common/README.md @@ -0,0 +1 @@ +SilverBullet-specific code that is shared between server and client \ No newline at end of file diff --git a/common/settings.ts b/common/settings.ts index eedb0230..1411be73 100644 --- a/common/settings.ts +++ b/common/settings.ts @@ -2,7 +2,7 @@ import { YAML } from "./deps.ts"; import { INDEX_TEMPLATE, SETTINGS_TEMPLATE } from "./PAGE_TEMPLATES.ts"; import { SpacePrimitives } from "./spaces/space_primitives.ts"; import { expandPropertyNames } from "../lib/json.ts"; -import type { BuiltinSettings } from "../web/types.ts"; +import type { BuiltinSettings } from "../type/web.ts"; // TODO: This is naive, may be better to use a proper parser const yamlSettingsRegex = /```yaml([^`]+)```/; diff --git a/lib/README.md b/lib/README.md index d2913120..e5e54bfc 100644 --- a/lib/README.md +++ b/lib/README.md @@ -1 +1 @@ -This folder contains library functions that is generally reusable, not specific to SilverBullet. This code can be used from within plugs or the core code base. \ No newline at end of file +This folder contains library functions that is generally reusable, not specific to SilverBullet. This code can be used from within plugs or the core code base. It may move out of this repo at some point. \ No newline at end of file diff --git a/plug-api/README.md b/plug-api/README.md new file mode 100644 index 00000000..6b4dea5d --- /dev/null +++ b/plug-api/README.md @@ -0,0 +1,4 @@ +This folder contains two things: + +* Wrappers for `syscall`s to be used by Plugs +* Reusablee library code that plugs may find useful \ No newline at end of file diff --git a/plug-api/syscalls/editor.ts b/plug-api/syscalls/editor.ts index 966a2c8b..265d7560 100644 --- a/plug-api/syscalls/editor.ts +++ b/plug-api/syscalls/editor.ts @@ -1,4 +1,4 @@ -import type { FilterOption } from "../../web/types.ts"; +import type { FilterOption } from "../../type/web.ts"; import { UploadFile } from "$type/types.ts"; import { syscall } from "../syscall.ts"; import type { PageRef } from "$sb/lib/page_ref.ts"; diff --git a/plugs/.gitignore b/plugs/.gitignore deleted file mode 100644 index c795b054..00000000 --- a/plugs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build \ No newline at end of file diff --git a/plugs/README.md b/plugs/README.md new file mode 100644 index 00000000..6e1c7fb7 --- /dev/null +++ b/plugs/README.md @@ -0,0 +1 @@ +This folder contains the implementation of SilverBullet's built-in plugs — the plugs that ship with SB itself. \ No newline at end of file diff --git a/plugs/emoji/emoji.ts b/plugs/emoji/emoji.ts index b5506e1c..52630e7d 100644 --- a/plugs/emoji/emoji.ts +++ b/plugs/emoji/emoji.ts @@ -2,7 +2,7 @@ import emojiBlob from "./emoji.json" assert { type: "json" }; import type { CompleteEvent } from "$type/types.ts"; import { readSetting } from "$sb/lib/settings_page.ts"; import { editor } from "$sb/syscalls.ts"; -import type { EmojiConfig } from "../../web/types.ts"; +import type { EmojiConfig } from "../../type/web.ts"; let emojiConfig: EmojiConfig = { aliases: [] }; diff --git a/server/http_server.ts b/server/http_server.ts index 7db6cd4d..6a0ec713 100644 --- a/server/http_server.ts +++ b/server/http_server.ts @@ -9,7 +9,7 @@ import { } from "./deps.ts"; import { AssetBundle } from "../lib/asset_bundle/bundle.ts"; import { FileMeta } from "$type/types.ts"; -import { ShellRequest } from "./rpc.ts"; +import { ShellRequest } from "../type/rpc.ts"; import { SpaceServer, SpaceServerConfig } from "./instance.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { PrefixedKvPrimitives } from "$lib/data/prefixed_kv_primitives.ts"; diff --git a/server/instance.ts b/server/instance.ts index 746eccf4..9e200199 100644 --- a/server/instance.ts +++ b/server/instance.ts @@ -10,7 +10,7 @@ import { DataStore } from "$lib/data/datastore.ts"; import { KvPrimitives } from "$lib/data/kv_primitives.ts"; import { DataStoreMQ } from "$lib/data/mq.datastore.ts"; import { System } from "$lib/plugos/system.ts"; -import { BuiltinSettings } from "../web/types.ts"; +import { BuiltinSettings } from "../type/web.ts"; import { JWTIssuer } from "./crypto.ts"; import { gitIgnoreCompiler } from "./deps.ts"; import { ServerSystem } from "./server_system.ts"; diff --git a/server/shell_backend.ts b/server/shell_backend.ts index 5a71861f..dd0ebce6 100644 --- a/server/shell_backend.ts +++ b/server/shell_backend.ts @@ -1,5 +1,5 @@ import type { SpaceServerConfig } from "./instance.ts"; -import { ShellRequest, ShellResponse } from "./rpc.ts"; +import { ShellRequest, ShellResponse } from "../type/rpc.ts"; /** * Configuration via environment variables: diff --git a/server/syscalls/shell.ts b/server/syscalls/shell.ts index 53d592eb..90ead351 100644 --- a/server/syscalls/shell.ts +++ b/server/syscalls/shell.ts @@ -1,5 +1,5 @@ import { SysCallMapping } from "../../lib/plugos/system.ts"; -import { ShellResponse } from "../../server/rpc.ts"; +import { ShellResponse } from "../../type/rpc.ts"; import { ShellBackend } from "../shell_backend.ts"; export function shellSyscalls(shellBackend: ShellBackend): SysCallMapping { diff --git a/server/rpc.ts b/type/rpc.ts similarity index 100% rename from server/rpc.ts rename to type/rpc.ts diff --git a/web/types.ts b/type/web.ts similarity index 100% rename from web/types.ts rename to type/web.ts diff --git a/web/client.ts b/web/client.ts index 5d701abd..8d3d132b 100644 --- a/web/client.ts +++ b/web/client.ts @@ -9,7 +9,7 @@ import { syntaxTree, } from "./deps.ts"; import { Space } from "../common/space.ts"; -import { FilterOption } from "./types.ts"; +import { FilterOption } from "../type/web.ts"; import { EventHook } from "../lib/plugos/hooks/event.ts"; import { AppCommand } from "$common/hooks/command.ts"; import { @@ -18,7 +18,7 @@ import { PathPageNavigator, } from "./navigator.ts"; -import { AppViewState, BuiltinSettings } from "./types.ts"; +import { AppViewState, BuiltinSettings } from "../type/web.ts"; import type { AppEvent, CompleteEvent } from "$type/types.ts"; import { throttle } from "$lib/async.ts"; diff --git a/web/components/command_palette.tsx b/web/components/command_palette.tsx index ca06e458..f95f43bc 100644 --- a/web/components/command_palette.tsx +++ b/web/components/command_palette.tsx @@ -1,7 +1,7 @@ import { FilterList } from "./filter.tsx"; import { CompletionContext, CompletionResult, featherIcons } from "../deps.ts"; import { AppCommand } from "$common/hooks/command.ts"; -import { BuiltinSettings, FilterOption } from "../types.ts"; +import { BuiltinSettings, FilterOption } from "../../type/web.ts"; import { parseCommand } from "$common/command.ts"; export function CommandPalette({ diff --git a/web/components/filter.tsx b/web/components/filter.tsx index ef6e15c3..716a9434 100644 --- a/web/components/filter.tsx +++ b/web/components/filter.tsx @@ -7,7 +7,7 @@ import { useRef, useState, } from "../deps.ts"; -import { FilterOption } from "../types.ts"; +import { FilterOption } from "../../type/web.ts"; import { MiniEditor } from "./mini_editor.tsx"; import { fuzzySearchAndSort } from "../fuse_search.ts"; import { deepEqual } from "$lib/json.ts"; diff --git a/web/components/page_navigator.tsx b/web/components/page_navigator.tsx index a50c2cb0..3e5de8dc 100644 --- a/web/components/page_navigator.tsx +++ b/web/components/page_navigator.tsx @@ -1,5 +1,5 @@ import { FilterList } from "./filter.tsx"; -import { FilterOption } from "../types.ts"; +import { FilterOption } from "../../type/web.ts"; import { CompletionContext, CompletionResult } from "../deps.ts"; import { PageMeta } from "../../type/types.ts"; import { isFederationPath } from "$sb/lib/resolve.ts"; diff --git a/web/components/panel.tsx b/web/components/panel.tsx index 2c6c11f1..b625188a 100644 --- a/web/components/panel.tsx +++ b/web/components/panel.tsx @@ -1,6 +1,6 @@ import { useEffect, useRef } from "../deps.ts"; import { Client } from "../client.ts"; -import { PanelConfig } from "../types.ts"; +import { PanelConfig } from "../../type/web.ts"; import { panelHtml } from "./panel_html.ts"; export function Panel({ diff --git a/web/components/top_bar.tsx b/web/components/top_bar.tsx index 4f698f45..5f1f6759 100644 --- a/web/components/top_bar.tsx +++ b/web/components/top_bar.tsx @@ -1,6 +1,6 @@ import { CompletionContext, CompletionResult, useEffect } from "../deps.ts"; import type { ComponentChildren, FunctionalComponent } from "../deps.ts"; -import { Notification } from "../types.ts"; +import { Notification } from "../../type/web.ts"; import { FeatherProps } from "https://esm.sh/v99/preact-feather@4.2.1/dist/types"; import { MiniEditor } from "./mini_editor.tsx"; diff --git a/web/editor_ui.tsx b/web/editor_ui.tsx index d85ba013..1af5ee3e 100644 --- a/web/editor_ui.tsx +++ b/web/editor_ui.tsx @@ -4,7 +4,7 @@ import { FilterList } from "./components/filter.tsx"; import { PageNavigator } from "./components/page_navigator.tsx"; import { TopBar } from "./components/top_bar.tsx"; import reducer from "./reducer.ts"; -import { Action, AppViewState, initialViewState } from "./types.ts"; +import { Action, AppViewState, initialViewState } from "../type/web.ts"; import { closeSearchPanel, featherIcons, diff --git a/web/fuse_search.test.ts b/web/fuse_search.test.ts index b8b90079..51f2cdbb 100644 --- a/web/fuse_search.test.ts +++ b/web/fuse_search.test.ts @@ -1,4 +1,4 @@ -import { FilterOption } from "./types.ts"; +import { FilterOption } from "../type/web.ts"; import { assertEquals } from "$lib/test_deps.ts"; import { fuzzySearchAndSort } from "./fuse_search.ts"; diff --git a/web/fuse_search.ts b/web/fuse_search.ts index f31781c3..cacef13d 100644 --- a/web/fuse_search.ts +++ b/web/fuse_search.ts @@ -1,6 +1,6 @@ // @deno-types="https://deno.land/x/fuse@v6.4.1/dist/fuse.d.ts" import Fuse from "https://deno.land/x/fuse@v6.4.1/dist/fuse.esm.min.js"; -import { FilterOption } from "./types.ts"; +import { FilterOption } from "../type/web.ts"; type FuseOption = FilterOption & { baseName: string; diff --git a/web/reducer.ts b/web/reducer.ts index 78048389..8d36ef1b 100644 --- a/web/reducer.ts +++ b/web/reducer.ts @@ -1,4 +1,4 @@ -import { Action, AppViewState } from "./types.ts"; +import { Action, AppViewState } from "../type/web.ts"; export default function reducer( state: AppViewState, diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index 4f30fccf..e2152fe1 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -11,7 +11,7 @@ import { vimGetCm, } from "../deps.ts"; import { SysCallMapping } from "$lib/plugos/system.ts"; -import type { FilterOption } from "../types.ts"; +import type { FilterOption } from "../../type/web.ts"; import { UploadFile } from "$type/types.ts"; import { PageRef } from "$sb/lib/page_ref.ts"; import { openSearchPanel } from "../deps.ts";