Add static typecheck to pipeline
This commit is contained in:
parent
31c2f6c222
commit
71b3ee4c77
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@ -26,5 +26,8 @@ jobs:
|
|||||||
- name: Run build
|
- name: Run build
|
||||||
run: deno task build
|
run: deno task build
|
||||||
|
|
||||||
|
- name: Run static type check
|
||||||
|
run: deno task check
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: deno task test
|
run: deno task test
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"tasks": {
|
"tasks": {
|
||||||
"clean": "rm -rf dist dist_bundle",
|
"clean": "rm -rf dist dist_bundle",
|
||||||
"install": "deno install -f -A --unstable silverbullet.ts",
|
"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",
|
"test": "deno test -A --unstable",
|
||||||
"build": "deno run -A --unstable --check build_plugs.ts && deno run -A --unstable --check build_web.ts",
|
"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",
|
"plugs": "deno run -A --unstable --check build_plugs.ts",
|
||||||
|
@ -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}`);
|
|
||||||
});
|
|
||||||
});
|
|
@ -16,6 +16,7 @@ export async function sharePublisher(event: PublishEvent) {
|
|||||||
const markdownHtml = renderMarkdownToHtml(tree, {
|
const markdownHtml = renderMarkdownToHtml(tree, {
|
||||||
smartHardBreak: true,
|
smartHardBreak: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const html =
|
const html =
|
||||||
`<html><head><style>${css}</style></head><body><div id="root">${markdownHtml}</div></body></html>`;
|
`<html><head><style>${css}</style></head><body><div id="root">${markdownHtml}</div></body></html>`;
|
||||||
await rootFS.writeFile(path, html, "utf8");
|
await rootFS.writeFile(path, html, "utf8");
|
||||||
|
Loading…
Reference in New Issue
Block a user