Make stuff work with npm
This commit is contained in:
@@ -35,7 +35,12 @@ export class ExpressServer {
|
||||
private port: number;
|
||||
private server?: Server;
|
||||
|
||||
constructor(port: number, rootPath: string, distDir: string) {
|
||||
constructor(
|
||||
port: number,
|
||||
rootPath: string,
|
||||
distDir: string,
|
||||
preloadedModules: string[]
|
||||
) {
|
||||
this.port = port;
|
||||
this.app = express();
|
||||
this.rootPath = rootPath;
|
||||
@@ -78,7 +83,9 @@ export class ExpressServer {
|
||||
plugLoaded: (plugName, plug) => {
|
||||
safeRun(async () => {
|
||||
console.log("Plug load", plugName);
|
||||
await this.system.load(plugName, plug, createSandbox);
|
||||
await this.system.load(plugName, plug, (p) =>
|
||||
createSandbox(p, preloadedModules)
|
||||
);
|
||||
});
|
||||
throttledRebuildMdExtensions();
|
||||
},
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"name": "@silverbulletmd/server",
|
||||
"author": {
|
||||
"name": "Zef Hemel",
|
||||
"email": "zef@zef.me"
|
||||
},
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
@@ -31,7 +35,7 @@
|
||||
"@codemirror/stream-parser": "^0.19.9",
|
||||
"@jest/globals": "^27.5.1",
|
||||
"@lezer/markdown": "^0.15.0",
|
||||
"@silverbulletmd/web": "^0.0.1",
|
||||
"@silverbulletmd/web": "^0.0.2",
|
||||
"better-sqlite3": "^7.5.0",
|
||||
"body-parser": "^1.19.2",
|
||||
"buffer": "^6.0.3",
|
||||
|
||||
@@ -4,6 +4,7 @@ import yargs from "yargs";
|
||||
import { hideBin } from "yargs/helpers";
|
||||
import { ExpressServer } from "./api_server";
|
||||
import { nodeModulesDir } from "@plugos/plugos/environments/node_sandbox";
|
||||
import { preloadModules } from "@silverbulletmd/common/preload_modules";
|
||||
|
||||
let args = yargs(hideBin(process.argv))
|
||||
.option("port", {
|
||||
@@ -18,13 +19,15 @@ if (!args._.length) {
|
||||
}
|
||||
|
||||
const pagesPath = args._[0] as string;
|
||||
|
||||
const port = args.port;
|
||||
const webappDistDir = `${nodeModulesDir}/node_modules/@silverbulletmd/web/dist`;
|
||||
|
||||
// console.log("This is where the static files live", webappDistDir);
|
||||
|
||||
const expressServer = new ExpressServer(port, pagesPath, webappDistDir);
|
||||
const expressServer = new ExpressServer(
|
||||
port,
|
||||
pagesPath,
|
||||
webappDistDir,
|
||||
preloadModules
|
||||
);
|
||||
expressServer.start().catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user