Preparing for an initial release
This commit is contained in:
@@ -279,7 +279,6 @@ function $11a7e2bff790f35a$export$195ba6d62321b933(message, defaultValue = "") {
|
||||
}
|
||||
|
||||
|
||||
const $c3893eec0c49ec96$var$dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;
|
||||
function $c3893eec0c49ec96$export$5dc1410f87262ed6(d) {
|
||||
return d.toISOString().split("T")[0];
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,6 +35,13 @@ functions:
|
||||
path: "./page.ts:parseIndexTextRepublish"
|
||||
events:
|
||||
- page:index_text
|
||||
reindexSpaceCommand:
|
||||
path: "./page.ts:reindexCommand"
|
||||
command:
|
||||
name: "Space: Reindex"
|
||||
reindexSpace:
|
||||
path: "./page.ts:reindexSpace"
|
||||
env: server
|
||||
indexLinks:
|
||||
path: "./page.ts:indexLinks"
|
||||
events:
|
||||
@@ -43,25 +50,10 @@ functions:
|
||||
path: ./page.ts:linkQueryProvider
|
||||
events:
|
||||
- query:link
|
||||
# indexItems:
|
||||
# path: "./item.ts:indexItems"
|
||||
# events:
|
||||
# - page:index
|
||||
# itemQueryProvider:
|
||||
# path: ./item.ts:queryProvider
|
||||
# events:
|
||||
# - query:item
|
||||
deletePage:
|
||||
path: "./page.ts:deletePage"
|
||||
command:
|
||||
name: "Page: Delete"
|
||||
reindexSpaceCommand:
|
||||
path: "./page.ts:reindexCommand"
|
||||
command:
|
||||
name: "Space: Reindex"
|
||||
reindexSpace:
|
||||
path: "./page.ts:reindexSpace"
|
||||
env: server
|
||||
renamePage:
|
||||
path: "./page.ts:renamePage"
|
||||
command:
|
||||
@@ -82,38 +74,39 @@ functions:
|
||||
path: "./navigate.ts:clickNavigate"
|
||||
events:
|
||||
- page:click
|
||||
insertToday:
|
||||
path: "./dates.ts:insertToday"
|
||||
slashCommand:
|
||||
name: today
|
||||
insertTomorrow:
|
||||
path: "./dates.ts:insertTomorrow"
|
||||
slashCommand:
|
||||
name: tomorrow
|
||||
parseServerCommand:
|
||||
path: ./debug.ts:parseServerPageCommand
|
||||
command:
|
||||
name: "Debug: Parse Document on Server"
|
||||
parsePage:
|
||||
path: ./debug.ts:parsePage
|
||||
parseCommand:
|
||||
path: ./debug.ts:parsePageCommand
|
||||
command:
|
||||
name: "Debug: Parse Document"
|
||||
showLogsCommand:
|
||||
path: ./debug.ts:showLogsCommand
|
||||
command:
|
||||
name: "Debug: Show Logs"
|
||||
key: "Ctrl-Alt-l"
|
||||
mac: "Cmd-Alt-l"
|
||||
|
||||
# Full text search
|
||||
searchIndex:
|
||||
path: ./search.ts:index
|
||||
events:
|
||||
- log:reload
|
||||
hideBhsCommand:
|
||||
path: ./debug.ts:hideBhsCommand
|
||||
- page:index
|
||||
searchUnindex:
|
||||
path: "./search.ts:unindex"
|
||||
env: server
|
||||
events:
|
||||
- page:deleted
|
||||
searchQueryProvider:
|
||||
path: ./search.ts:queryProvider
|
||||
events:
|
||||
- query:full-text
|
||||
searchCommand:
|
||||
path: ./search.ts:searchCommand
|
||||
command:
|
||||
name: "UI: Hide BHS"
|
||||
key: "Ctrl-Alt-b"
|
||||
mac: "Cmd-Alt-b"
|
||||
name: "Search Space"
|
||||
key: Ctrl-Shift-f
|
||||
mac: Cmd-Shift-f
|
||||
readPageSearch:
|
||||
path: ./search.ts:readPageSearch
|
||||
pageNamespace:
|
||||
pattern: "@search/.+"
|
||||
operation: readPage
|
||||
getPageMetaSearch:
|
||||
path: ./search.ts:getPageMetaSearch
|
||||
pageNamespace:
|
||||
pattern: "@search/.+"
|
||||
operation: getPageMeta
|
||||
|
||||
# Template commands
|
||||
insertPageMeta:
|
||||
path: "./page.ts:insertPageMeta"
|
||||
slashCommand:
|
||||
@@ -132,7 +125,16 @@ functions:
|
||||
path: ./template.ts:instantiateTemplateCommand
|
||||
command:
|
||||
name: "Template: Instantiate for Page"
|
||||
insertToday:
|
||||
path: "./dates.ts:insertToday"
|
||||
slashCommand:
|
||||
name: today
|
||||
insertTomorrow:
|
||||
path: "./dates.ts:insertTomorrow"
|
||||
slashCommand:
|
||||
name: tomorrow
|
||||
|
||||
# Text editing commands
|
||||
quoteSelection:
|
||||
path: ./text.ts:quoteSelection
|
||||
command:
|
||||
@@ -159,3 +161,40 @@ functions:
|
||||
name: "Text: Italic"
|
||||
key: "Ctrl-i"
|
||||
mac: "Cmd-i"
|
||||
|
||||
# Plug manager
|
||||
updatePlugsCommand:
|
||||
path: ./plugmanager.ts:updatePlugsCommand
|
||||
command:
|
||||
name: "Plugs: Update"
|
||||
key: "Ctrl-Shift-p"
|
||||
mac: "Cmd-Shift-p"
|
||||
updatePlugs:
|
||||
path: ./plugmanager.ts:updatePlugs
|
||||
env: server
|
||||
|
||||
# Debug commands
|
||||
parseServerCommand:
|
||||
path: ./debug.ts:parseServerPageCommand
|
||||
command:
|
||||
name: "Debug: Parse Document on Server"
|
||||
parsePage:
|
||||
path: ./debug.ts:parsePage
|
||||
parseCommand:
|
||||
path: ./debug.ts:parsePageCommand
|
||||
command:
|
||||
name: "Debug: Parse Document"
|
||||
showLogsCommand:
|
||||
path: ./debug.ts:showLogsCommand
|
||||
command:
|
||||
name: "Debug: Show Logs"
|
||||
key: "Ctrl-Alt-l"
|
||||
mac: "Cmd-Alt-l"
|
||||
events:
|
||||
- log:reload
|
||||
hideBhsCommand:
|
||||
path: ./debug.ts:hideBhsCommand
|
||||
command:
|
||||
name: "UI: Hide BHS"
|
||||
key: "Ctrl-Alt-b"
|
||||
mac: "Cmd-Alt-b"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { insertAtCursor } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
|
||||
const dateMatchRegex = /(\d{4}\-\d{2}\-\d{2})/g;
|
||||
|
||||
export function niceDate(d: Date): string {
|
||||
return d.toISOString().split("T")[0];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getLogs } from "@plugos/plugos-syscall/sandbox";
|
||||
import { LogEntry } from "@plugos/plugos/sandbox";
|
||||
import {
|
||||
getText,
|
||||
hideBhs,
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import {
|
||||
getCursor,
|
||||
getText,
|
||||
insertAtPos,
|
||||
replaceRange,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
|
||||
export async function toggleH1() {
|
||||
await togglePrefix("# ");
|
||||
}
|
||||
|
||||
export async function toggleH2() {
|
||||
await togglePrefix("## ");
|
||||
}
|
||||
|
||||
function lookBack(s: string, pos: number, backString: string): boolean {
|
||||
return s.substring(pos - backString.length, pos) === backString;
|
||||
}
|
||||
|
||||
async function togglePrefix(prefix: string) {
|
||||
let text = await getText();
|
||||
let pos = await getCursor();
|
||||
if (text[pos] === "\n") {
|
||||
pos--;
|
||||
}
|
||||
while (pos > 0 && text[pos] !== "\n") {
|
||||
if (lookBack(text, pos, prefix)) {
|
||||
// Already has this prefix, let's flip it
|
||||
await replaceRange(pos - prefix.length, pos, "");
|
||||
return;
|
||||
}
|
||||
pos--;
|
||||
}
|
||||
if (pos) {
|
||||
pos++;
|
||||
}
|
||||
await insertAtPos(prefix, pos);
|
||||
}
|
||||
@@ -8,8 +8,6 @@ import {
|
||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
||||
import { nodeAtPos, ParseTree } from "@silverbulletmd/common/tree";
|
||||
|
||||
const materializedQueryPrefix = /<!--\s*#query\s+/;
|
||||
|
||||
async function actionClickOrActionEnter(mdTree: ParseTree | null) {
|
||||
if (!mdTree) {
|
||||
return;
|
||||
|
||||
@@ -35,9 +35,7 @@ import {
|
||||
replaceNodesMatching,
|
||||
} from "@silverbulletmd/common/tree";
|
||||
import { applyQuery, QueryProviderEvent } from "../query/engine";
|
||||
import { PageMeta } from "@silverbulletmd/common/types";
|
||||
import { extractMeta } from "../query/data";
|
||||
import { jsonToMDTable } from "../query/util";
|
||||
|
||||
// Key space:
|
||||
// pl:toPage:pos => pageName
|
||||
@@ -101,8 +99,8 @@ export async function linkQueryProvider({
|
||||
|
||||
export async function deletePage() {
|
||||
let pageName = await getCurrentPage();
|
||||
console.log("Navigating to start page");
|
||||
await navigate("start");
|
||||
console.log("Navigating to index page");
|
||||
await navigate("index");
|
||||
console.log("Deleting page from space");
|
||||
await deletePageSyscall(pageName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
import { dispatch } from "@plugos/plugos-syscall/event";
|
||||
import { findNodeOfType } from "@silverbulletmd/common/tree";
|
||||
import { flashNotification } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
||||
import {
|
||||
deletePage,
|
||||
listPages,
|
||||
readPage,
|
||||
writePage,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
||||
import {
|
||||
invokeFunction,
|
||||
reloadPlugs,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
||||
import YAML from "yaml";
|
||||
|
||||
async function listPlugs(): Promise<string[]> {
|
||||
let unfilteredPages = await listPages(true);
|
||||
return unfilteredPages
|
||||
.filter((p) => p.name.startsWith("_plug/"))
|
||||
.map((p) => p.name.substring("_plug/".length));
|
||||
}
|
||||
|
||||
export async function updatePlugsCommand() {
|
||||
flashNotification("Updating plugs...");
|
||||
await invokeFunction("server", "updatePlugs");
|
||||
flashNotification("And... done!");
|
||||
await reloadPlugs();
|
||||
}
|
||||
|
||||
export async function updatePlugs() {
|
||||
let { text: plugPageText } = await readPage("PLUGS");
|
||||
|
||||
let tree = await parseMarkdown(plugPageText);
|
||||
|
||||
let codeTextNode = findNodeOfType(tree, "CodeText");
|
||||
if (!codeTextNode) {
|
||||
console.error("Could not find yaml block in PLUGS");
|
||||
return;
|
||||
}
|
||||
let plugYaml = codeTextNode.children![0].text;
|
||||
let plugList = YAML.parse(plugYaml!);
|
||||
console.log("Plug YAML", plugList);
|
||||
let allPlugNames: string[] = [];
|
||||
for (let plugUri of plugList) {
|
||||
let [protocol, ...rest] = plugUri.split(":");
|
||||
let manifests = await dispatch(`get-plug:${protocol}`, rest.join(":"));
|
||||
if (manifests.length === 0) {
|
||||
console.error("Could not resolve plug", plugUri);
|
||||
}
|
||||
// console.log("Got manifests", plugUri, protocol, manifests);
|
||||
let manifest = manifests[0];
|
||||
allPlugNames.push(manifest.name);
|
||||
// console.log("Writing", `_plug/${manifest.name}`);
|
||||
await writePage(
|
||||
`_plug/${manifest.name}`,
|
||||
JSON.stringify(manifest, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
// And delete extra ones
|
||||
for (let existingPlug of await listPlugs()) {
|
||||
if (!allPlugNames.includes(existingPlug)) {
|
||||
console.log("Removing plug", existingPlug);
|
||||
await deletePage(`_plug/${existingPlug}`);
|
||||
}
|
||||
}
|
||||
await reloadPlugs();
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
import { fullTextIndex, fullTextSearch } from "@plugos/plugos-syscall/fulltext";
|
||||
import {
|
||||
fullTextDelete,
|
||||
fullTextIndex,
|
||||
fullTextSearch,
|
||||
} from "@plugos/plugos-syscall/fulltext";
|
||||
import { renderToText } from "@silverbulletmd/common/tree";
|
||||
import { PageMeta } from "@silverbulletmd/common/types";
|
||||
import { queryPrefix } from "@silverbulletmd/plugos-silverbullet-syscall";
|
||||
@@ -16,6 +20,10 @@ export async function index(data: IndexTreeEvent) {
|
||||
await fullTextIndex(data.name, cleanText);
|
||||
}
|
||||
|
||||
export async function unindex(pageName: string) {
|
||||
await fullTextDelete(pageName);
|
||||
}
|
||||
|
||||
export async function queryProvider({
|
||||
query,
|
||||
}: QueryProviderEvent): Promise<any[]> {
|
||||
@@ -1,12 +0,0 @@
|
||||
import {
|
||||
EndpointRequest,
|
||||
EndpointResponse,
|
||||
} from "@plugos/plugos/hooks/endpoint";
|
||||
|
||||
export function endpointTest(req: EndpointRequest): EndpointResponse {
|
||||
console.log("I'm running on the server!", req);
|
||||
return {
|
||||
status: 200,
|
||||
body: "Hello world!",
|
||||
};
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
function countWords(str: string): number {
|
||||
const matches = str.match(/[\w\d\'-]+/gi);
|
||||
return matches ? matches.length : 0;
|
||||
}
|
||||
|
||||
function readingTime(wordCount: number): number {
|
||||
// 225 is average word reading speed for adults
|
||||
return Math.ceil(wordCount / 225);
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
import emojis from "./emoji.json";
|
||||
import { matchBefore } from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
|
||||
const emojiMatcher = /\(([^\)]+)\)\s+(.+)$/;
|
||||
|
||||
export async function emojiCompleter() {
|
||||
let prefix = await matchBefore(":[\\w]+");
|
||||
if (!prefix) {
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
name: ghost
|
||||
functions:
|
||||
downloadAllPostsCommand:
|
||||
path: "./ghost.ts:downloadAllPostsCommand"
|
||||
command:
|
||||
name: "Ghost: Download Posts"
|
||||
downloadAllPosts:
|
||||
path: "./ghost.ts:downloadAllPosts"
|
||||
env: server
|
||||
publishCommand:
|
||||
path: "./ghost.ts:publishCommand"
|
||||
command:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
readPage,
|
||||
writePage,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
||||
import { readPage } from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
||||
import { invokeFunction } from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
||||
import {
|
||||
getCurrentPage,
|
||||
@@ -195,21 +192,6 @@ async function getConfig(): Promise<GhostConfig> {
|
||||
return pageMeta as GhostConfig;
|
||||
}
|
||||
|
||||
export async function downloadAllPostsCommand() {
|
||||
await invokeFunction("server", "downloadAllPosts");
|
||||
}
|
||||
|
||||
export async function downloadAllPosts() {
|
||||
let config = await getConfig();
|
||||
let admin = new GhostAdmin(config.url, config.adminKey);
|
||||
await admin.init();
|
||||
let allPosts = await admin.listMarkdownPosts();
|
||||
for (let post of allPosts) {
|
||||
let text = mobileDocToMarkdown(post.mobiledoc);
|
||||
text = `# ${post.title}\n${text}`;
|
||||
await writePage(`${config.postPrefix}/${post.slug}`, text);
|
||||
}
|
||||
}
|
||||
export async function publishCommand() {
|
||||
await invokeFunction(
|
||||
"server",
|
||||
|
||||
@@ -7,7 +7,6 @@ export async function togglePreview() {
|
||||
await clientStore.set("enableMarkdownPreview", !currentValue);
|
||||
if (!currentValue) {
|
||||
await invokeFunction("client", "preview");
|
||||
// updateMarkdownPreview();
|
||||
} else {
|
||||
await hideMarkdownPreview();
|
||||
}
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@silverbulletmd/plugs",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@silverbulletmd/plugs",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jest/globals": "^27.5.1",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"name": "Zef Hemel",
|
||||
"email": "zef@zef.me"
|
||||
},
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"generate": "lezer-generator query/query.grammar -o query/parse-query.js",
|
||||
@@ -34,13 +34,17 @@
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@lezer/generator": "1.0.0",
|
||||
"@lezer/lr": "1.0.0",
|
||||
"@mattermost/client": "^6.7.0-0",
|
||||
"@mattermost/types": "^6.7.0-0",
|
||||
"@mattermost/client": "^7.0.0",
|
||||
"@mattermost/types": "^7.0.0",
|
||||
"@silverbulletmd/common": "^0.0.7",
|
||||
"@silverbulletmd/plugs": "^0.0.7",
|
||||
"@silverbulletmd/web": "^0.0.7",
|
||||
"@types/yaml": "^1.9.7",
|
||||
"handlebars": "^4.7.7",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-task-lists": "^2.1.1",
|
||||
"yaml": "^2.0.0",
|
||||
"handlebars": "^4.7.7"
|
||||
"server": "^1.0.37",
|
||||
"yaml": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/markdown-it": "^12.2.3"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
name: plugmanager
|
||||
functions:
|
||||
updatePlugsCommand:
|
||||
path: ./plugmanager.ts:updatePlugsCommand
|
||||
command:
|
||||
name: "Plugs: Update"
|
||||
key: "Ctrl-Shift-p"
|
||||
mac: "Cmd-Shift-p"
|
||||
updatePlugs:
|
||||
path: ./plugmanager.ts:updatePlugs
|
||||
env: server
|
||||
check:
|
||||
path: "./plugmanager.ts:checkCommand"
|
||||
command:
|
||||
name: "Plug: Check"
|
||||
mac: "Cmd-Alt-c"
|
||||
key: "Ctrl-Alt-c"
|
||||
compile:
|
||||
path: "./plugmanager.ts:compileCommand"
|
||||
command:
|
||||
name: "Plug: Compile"
|
||||
mac: "Cmd-Shift-c"
|
||||
key: "Ctrl-Shift-c"
|
||||
compileJS:
|
||||
path: "./plugmanager.ts:compileJS"
|
||||
env: server
|
||||
compileModule:
|
||||
path: "./plugmanager.ts:compileModule"
|
||||
env: server
|
||||
getPlugPlugMd:
|
||||
path: "./plugmanager.ts:getPlugPlugMd"
|
||||
events:
|
||||
- get-plug:plugmd
|
||||
@@ -0,0 +1,24 @@
|
||||
name: plugmd
|
||||
functions:
|
||||
check:
|
||||
path: "./plugmd.ts:checkCommand"
|
||||
command:
|
||||
name: "Plug: Check"
|
||||
mac: "Cmd-Alt-c"
|
||||
key: "Ctrl-Alt-c"
|
||||
compile:
|
||||
path: "./plugmd.ts:compileCommand"
|
||||
command:
|
||||
name: "Plug: Compile"
|
||||
mac: "Cmd-Shift-c"
|
||||
key: "Ctrl-Shift-c"
|
||||
compileJS:
|
||||
path: "./plugmd.ts:compileJS"
|
||||
env: server
|
||||
compileModule:
|
||||
path: "./plugmd.ts:compileModule"
|
||||
env: server
|
||||
getPlugPlugMd:
|
||||
path: "./plugmd.ts:getPlugPlugMd"
|
||||
events:
|
||||
- get-plug:plugmd
|
||||
@@ -1,19 +1,14 @@
|
||||
import { dispatch } from "@plugos/plugos-syscall/event";
|
||||
import {
|
||||
addParentPointers,
|
||||
collectNodesOfType,
|
||||
findNodeOfType,
|
||||
} from "@silverbulletmd/common/tree";
|
||||
import {
|
||||
flashNotification,
|
||||
getText,
|
||||
hideBhs,
|
||||
showBhs,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/editor";
|
||||
import { parseMarkdown } from "@silverbulletmd/plugos-silverbullet-syscall/markdown";
|
||||
import {
|
||||
deletePage,
|
||||
listPages,
|
||||
readPage,
|
||||
writePage,
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/space";
|
||||
@@ -23,8 +18,6 @@ import {
|
||||
} from "@silverbulletmd/plugos-silverbullet-syscall/system";
|
||||
import YAML from "yaml";
|
||||
|
||||
import { extractMeta } from "../query/data";
|
||||
|
||||
import type { Manifest } from "@silverbulletmd/common/manifest";
|
||||
|
||||
export async function compileCommand() {
|
||||
@@ -131,64 +124,6 @@ export async function compileModule(moduleName: string): Promise<string> {
|
||||
return self.syscall("esbuild.compileModule", moduleName);
|
||||
}
|
||||
|
||||
async function listPlugs(): Promise<string[]> {
|
||||
let unfilteredPages = await listPages(true);
|
||||
return unfilteredPages
|
||||
.filter((p) => p.name.startsWith("_plug/"))
|
||||
.map((p) => p.name.substring("_plug/".length));
|
||||
}
|
||||
|
||||
export async function listCommand() {
|
||||
console.log(await listPlugs());
|
||||
}
|
||||
|
||||
export async function updatePlugsCommand() {
|
||||
flashNotification("Updating plugs...");
|
||||
await invokeFunction("server", "updatePlugs");
|
||||
flashNotification("And... done!");
|
||||
await reloadPlugs();
|
||||
}
|
||||
|
||||
export async function updatePlugs() {
|
||||
let { text: plugPageText } = await readPage("PLUGS");
|
||||
|
||||
let tree = await parseMarkdown(plugPageText);
|
||||
|
||||
let codeTextNode = findNodeOfType(tree, "CodeText");
|
||||
if (!codeTextNode) {
|
||||
console.error("Could not find yaml block in PLUGS");
|
||||
return;
|
||||
}
|
||||
let plugYaml = codeTextNode.children![0].text;
|
||||
let plugList = YAML.parse(plugYaml!);
|
||||
console.log("Plug YAML", plugList);
|
||||
let allPlugNames: string[] = [];
|
||||
for (let plugUri of plugList) {
|
||||
let [protocol, ...rest] = plugUri.split(":");
|
||||
let manifests = await dispatch(`get-plug:${protocol}`, rest.join(":"));
|
||||
if (manifests.length === 0) {
|
||||
console.error("Could not resolve plug", plugUri);
|
||||
}
|
||||
// console.log("Got manifests", plugUri, protocol, manifests);
|
||||
let manifest = manifests[0];
|
||||
allPlugNames.push(manifest.name);
|
||||
// console.log("Writing", `_plug/${manifest.name}`);
|
||||
await writePage(
|
||||
`_plug/${manifest.name}`,
|
||||
JSON.stringify(manifest, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
// And delete extra ones
|
||||
for (let existingPlug of await listPlugs()) {
|
||||
if (!allPlugNames.includes(existingPlug)) {
|
||||
console.log("Removing plug", existingPlug);
|
||||
await deletePage(`_plug/${existingPlug}`);
|
||||
}
|
||||
}
|
||||
await reloadPlugs();
|
||||
}
|
||||
|
||||
export async function getPlugPlugMd(pageName: string): Promise<Manifest> {
|
||||
let { text } = await readPage(pageName);
|
||||
console.log("Compiling", pageName);
|
||||
@@ -1,7 +1,4 @@
|
||||
name: query
|
||||
# dependencies:
|
||||
# yaml: "yaml@2"
|
||||
# "@lezer/lr": "@lezer/lr@0.15.4"
|
||||
functions:
|
||||
updateMaterializedQueriesOnPage:
|
||||
path: ./materialized_queries.ts:updateMaterializedQueriesOnPage
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
name: search
|
||||
functions:
|
||||
index:
|
||||
path: ./search.ts:index
|
||||
events:
|
||||
- page:index
|
||||
queryProvider:
|
||||
path: ./search.ts:queryProvider
|
||||
events:
|
||||
- query:full-text
|
||||
searchCommand:
|
||||
path: ./search.ts:searchCommand
|
||||
command:
|
||||
name: "Search Space"
|
||||
key: Ctrl-Shift-f
|
||||
mac: Cmd-Shift-f
|
||||
readPageSearch:
|
||||
path: ./search.ts:readPageSearch
|
||||
pageNamespace:
|
||||
pattern: "@search/.+"
|
||||
operation: readPage
|
||||
getPageMetaSearch:
|
||||
path: ./search.ts:getPageMetaSearch
|
||||
pageNamespace:
|
||||
pattern: "@search/.+"
|
||||
operation: getPageMeta
|
||||
@@ -41,7 +41,7 @@ functions:
|
||||
taskPostponeCommand:
|
||||
path: ./task.ts:postponeCommand
|
||||
command:
|
||||
name: "Task: Postpone by 1 day"
|
||||
name: "Task: Postpone"
|
||||
key: Alt-+
|
||||
contexts:
|
||||
- DeadlineDate
|
||||
|
||||
Reference in New Issue
Block a user