Massive cleanup and plugbox cleanup
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
@@ -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) {
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user