Massive cleanup and plugbox cleanup

This commit is contained in:
Zef Hemel
2022-03-23 15:41:12 +01:00
parent a916088215
commit 09d07d587f
34 changed files with 695 additions and 525 deletions
+12 -1
View File
@@ -45,6 +45,12 @@
"path": "/",
"handler": "endpointTest"
}
],
"crons": [
{
"cron": "*/15 * * * *",
"handler": "gitSnapshot"
}
]
},
"functions": {
@@ -88,7 +94,12 @@
"path": "./server.ts:endpointTest"
},
"welcome": {
"path": "./server.ts:welcome"
"path": "./server.ts:welcome",
"env": "server"
},
"gitSnapshot": {
"path": "./git.ts:commit",
"env": "server"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
import { syscall } from "./lib/syscall";
export async function commit() {
console.log("Snapshotting the current space to git");
await syscall("shell.run", "git", ["add", "./*.md"]);
try {
await syscall("shell.run", "git", ["commit", "-a", "-m", "Snapshot"]);
} catch (e) {
// We can ignore, this happens when there's no changes to commit
}
console.log("Done!");
}
+2 -2
View File
@@ -57,10 +57,10 @@ export async function renamePage() {
let text = await syscall("editor.getText");
console.log("Writing new page to space");
await syscall("space.writePage", newName, text);
console.log("Deleting page from space");
await syscall("space.deletePage", oldName);
console.log("Navigating to new page");
await syscall("editor.navigate", newName);
console.log("Deleting page from space");
await syscall("space.deletePage", oldName);
let pageToUpdateSet = new Set<string>();
for (let pageToUpdate of pagesToUpdate) {
+5 -4
View File
@@ -1,4 +1,7 @@
import { EndpointRequest, EndpointResponse } from "../../plugbox/endpoints";
import {
EndpointRequest,
EndpointResponse,
} from "../../plugbox/feature/endpoint";
export function endpointTest(req: EndpointRequest): EndpointResponse {
console.log("I'm running on the server!", req);
@@ -9,7 +12,5 @@ export function endpointTest(req: EndpointRequest): EndpointResponse {
}
export function welcome() {
for (var i = 0; i < 10; i++) {
console.log("Welcome to you all!!!");
}
console.log("Hello world!");
}