1
0

Add static typecheck to pipeline

This commit is contained in:
Zef Hemel 2023-01-15 11:33:09 +01:00
parent 31c2f6c222
commit 71b3ee4c77
4 changed files with 5 additions and 60 deletions

View File

@ -26,5 +26,8 @@ jobs:
- name: Run build
run: deno task build
- name: Run static type check
run: deno task check
- name: Run tests
run: deno task test

View File

@ -2,6 +2,7 @@
"tasks": {
"clean": "rm -rf dist dist_bundle",
"install": "deno install -f -A --unstable silverbullet.ts",
"check": "find web common server plugs cmd plug-api plugos -name '*.ts*' | xargs deno check",
"test": "deno test -A --unstable",
"build": "deno run -A --unstable --check build_plugs.ts && deno run -A --unstable --check build_web.ts",
"plugs": "deno run -A --unstable --check build_plugs.ts",

View File

@ -1,60 +0,0 @@
#!/usr/bin/env node
import express from "express";
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { DiskPlugLoader } from "../plug_loader";
import { CronHookT, NodeCronHook } from "../hooks/node_cron.ts";
import shellSyscalls from "../syscalls/shell.node.ts";
import { System } from "../system.ts";
import { EndpointHook, EndpointHookT } from "../hooks/endpoint.ts";
import { safeRun } from "../util.ts";
import knex from "knex";
import { ensureTable, storeSyscalls } from "../syscalls/store.knex_node";
import { EventHook, EventHookT } from "../hooks/event.ts";
import { eventSyscalls } from "../syscalls/event.ts";
let args = yargs(hideBin(process.argv))
.option("port", {
type: "number",
default: 1337,
})
.parse();
if (!args._.length) {
console.error("Usage: plugos-server <path-to-plugs>");
process.exit(1);
}
const plugPath = args._[0] as string;
const app = express();
type ServerHook = EndpointHookT & CronHookT & EventHookT;
const system = new System<ServerHook>("server");
safeRun(async () => {
const db = knex({
client: "better-sqlite3",
connection: {
filename: "plugos.db",
},
useNullAsDefault: true,
});
await ensureTable(db, "item");
let plugLoader = new DiskPlugLoader(system, plugPath);
await plugLoader.loadPlugs();
plugLoader.watcher();
system.addHook(new NodeCronHook());
let eventHook = new EventHook();
system.addHook(eventHook);
system.registerSyscalls([], eventSyscalls(eventHook));
system.addHook(new EndpointHook(app, ""));
system.registerSyscalls([], shellSyscalls("."));
system.registerSyscalls([], storeSyscalls(db, "item"));
app.listen(args.port, () => {
console.log(`Plugbox server listening on port ${args.port}`);
});
});

View File

@ -16,6 +16,7 @@ export async function sharePublisher(event: PublishEvent) {
const markdownHtml = renderMarkdownToHtml(tree, {
smartHardBreak: true,
});
const html =
`<html><head><style>${css}</style></head><body><div id="root">${markdownHtml}</div></body></html>`;
await rootFS.writeFile(path, html, "utf8");