From 71b3ee4c77f2f3f545a0a4c4a5f21a9aa0a250c8 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 15 Jan 2023 11:33:09 +0100 Subject: [PATCH] Add static typecheck to pipeline --- .github/workflows/test.yml | 3 ++ deno.jsonc | 1 + plugos/bin/plugos-server.ts | 60 ------------------------------------- plugs/markdown/share.ts | 1 + 4 files changed, 5 insertions(+), 60 deletions(-) delete mode 100755 plugos/bin/plugos-server.ts diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b016623..6e6c5194 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/deno.jsonc b/deno.jsonc index e2cce727..80f50c0d 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -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", diff --git a/plugos/bin/plugos-server.ts b/plugos/bin/plugos-server.ts deleted file mode 100755 index 57369603..00000000 --- a/plugos/bin/plugos-server.ts +++ /dev/null @@ -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 "); - process.exit(1); -} - -const plugPath = args._[0] as string; - -const app = express(); - -type ServerHook = EndpointHookT & CronHookT & EventHookT; -const system = new System("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}`); - }); -}); diff --git a/plugs/markdown/share.ts b/plugs/markdown/share.ts index 5e903b29..ee1f1c58 100644 --- a/plugs/markdown/share.ts +++ b/plugs/markdown/share.ts @@ -16,6 +16,7 @@ export async function sharePublisher(event: PublishEvent) { const markdownHtml = renderMarkdownToHtml(tree, { smartHardBreak: true, }); + const html = `
${markdownHtml}
`; await rootFS.writeFile(path, html, "utf8");