From cb809d2d03541d43bac3cf655cceef6af2ea79b3 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 27 Mar 2022 11:31:12 +0200 Subject: [PATCH] Rebranded plugbox to PlugOS (plugos) --- Makefile | 9 --------- common/manifest.ts | 10 +++++----- package.json | 20 +++++++++---------- .../bin/plugos-bundle.ts | 2 +- .../bin/plugos-server.ts | 4 ++-- .../environment/iframe_sandbox.html | 0 .../environment/iframe_sandbox.ts | 0 .../environment/node_sandbox.ts | 0 .../environment/node_worker.ts | 0 .../environment/sandbox_worker.ts | 0 .../environment/webworker_sandbox.ts | 0 {plugbox => plugos}/environment/worker.ts | 0 {plugbox => plugos}/feature/endpoint.test.ts | 2 +- {plugbox => plugos}/feature/endpoint.ts | 0 {plugbox => plugos}/feature/event.ts | 0 {plugbox => plugos}/feature/node_cron.ts | 0 {plugbox => plugos}/plug.ts | 0 {plugbox => plugos}/plug_loader.ts | 0 {plugbox => plugos}/runtime.test.ts | 0 {plugbox => plugos}/sandbox.ts | 0 {plugbox => plugos}/syscall/event.ts | 0 {plugbox => plugos}/syscall/fetch.node.ts | 0 {plugbox => plugos}/syscall/shell.node.ts | 0 .../syscall/store.dexie_browser.test.ts | 0 .../syscall/store.dexie_browser.ts | 0 .../syscall/store.knex_node.test.ts | 0 .../syscall/store.knex_node.ts | 0 {plugbox => plugos}/syscall/transport.ts | 0 {plugbox => plugos}/system.ts | 0 {plugbox => plugos}/types.ts | 0 {plugbox => plugos}/util.ts | 0 plugs/core/server.ts | 2 +- server/api.test.ts | 2 +- server/api_server.ts | 2 +- server/express_server.ts | 4 ++-- server/page_api.ts | 4 ++-- server/server.ts | 10 +++++----- server/syscalls/page_index.ts | 2 +- tsconfig.json | 2 +- webapp/editor.tsx | 6 +++--- webapp/space.ts | 2 +- webapp/syscalls/editor.ts | 2 +- webapp/syscalls/indexer.ts | 4 ++-- webapp/syscalls/space.ts | 2 +- webapp/syscalls/system.ts | 2 +- 45 files changed, 42 insertions(+), 51 deletions(-) delete mode 100644 Makefile rename plugbox/bin/plugbox-bundle.ts => plugos/bin/plugos-bundle.ts (96%) rename plugbox/bin/plugbox-server.ts => plugos/bin/plugos-server.ts (95%) rename {plugbox => plugos}/environment/iframe_sandbox.html (100%) rename {plugbox => plugos}/environment/iframe_sandbox.ts (100%) rename {plugbox => plugos}/environment/node_sandbox.ts (100%) rename {plugbox => plugos}/environment/node_worker.ts (100%) rename {plugbox => plugos}/environment/sandbox_worker.ts (100%) rename {plugbox => plugos}/environment/webworker_sandbox.ts (100%) rename {plugbox => plugos}/environment/worker.ts (100%) rename {plugbox => plugos}/feature/endpoint.test.ts (96%) rename {plugbox => plugos}/feature/endpoint.ts (100%) rename {plugbox => plugos}/feature/event.ts (100%) rename {plugbox => plugos}/feature/node_cron.ts (100%) rename {plugbox => plugos}/plug.ts (100%) rename {plugbox => plugos}/plug_loader.ts (100%) rename {plugbox => plugos}/runtime.test.ts (100%) rename {plugbox => plugos}/sandbox.ts (100%) rename {plugbox => plugos}/syscall/event.ts (100%) rename {plugbox => plugos}/syscall/fetch.node.ts (100%) rename {plugbox => plugos}/syscall/shell.node.ts (100%) rename {plugbox => plugos}/syscall/store.dexie_browser.test.ts (100%) rename {plugbox => plugos}/syscall/store.dexie_browser.ts (100%) rename {plugbox => plugos}/syscall/store.knex_node.test.ts (100%) rename {plugbox => plugos}/syscall/store.knex_node.ts (100%) rename {plugbox => plugos}/syscall/transport.ts (100%) rename {plugbox => plugos}/system.ts (100%) rename {plugbox => plugos}/types.ts (100%) rename {plugbox => plugos}/util.ts (100%) diff --git a/Makefile b/Makefile deleted file mode 100644 index fc549841..00000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: core - -BUILD=../plugbox/bin/plugbox-bundle.mjs - -core: core/* - ${BUILD} --debug core/core.plug.json ../webapp/src/generated/core.plug.json - -watch: * - ls -d core/* | entr make diff --git a/common/manifest.ts b/common/manifest.ts index 224ed6ac..05392c53 100644 --- a/common/manifest.ts +++ b/common/manifest.ts @@ -1,7 +1,7 @@ -import * as plugbox from "../plugbox/types"; -import { EndpointHook } from "../plugbox/feature/endpoint"; -import { CronHook } from "../plugbox/feature/node_cron"; -import { EventHook } from "../plugbox/feature/event"; +import * as plugos from "../plugos/types"; +import { EndpointHook } from "../plugos/feature/endpoint"; +import { CronHook } from "../plugos/feature/node_cron"; +import { EventHook } from "../plugos/feature/event"; export type CommandDef = { name: string; @@ -21,4 +21,4 @@ export type SilverBulletHooks = { CronHook & EventHook; -export type Manifest = plugbox.Manifest; +export type Manifest = plugos.Manifest; diff --git a/package.json b/package.json index 6cadd662..35b2c0f4 100644 --- a/package.json +++ b/package.json @@ -6,15 +6,15 @@ "@lezer/common": "https://github.com/zefhemel/common.git#046c880d1fcab713cadad327a5b7d8bb5de6522c" }, "bin": { - "plugbox-bundle": "./dist/plugbox/plugbox-bundle.js", - "plugbox-server": "./dist/plugbox/plugbox-server.js", + "plugos-bundle": "./dist/plugos/plugos-bundle.js", + "plugos-server": "./dist/plugos/plugos-server.js", "silverbullet": "./dist/server/server.js" }, "scripts": { "watch": "rm -rf .parcel-cache && parcel watch", "build": "parcel build", "clean": "rm -rf dist", - "plugs": "plugbox-bundle -w --dist plugs/dist plugs/*/*.plug.yaml", + "plugs": "./dist/plugos/plugos-bundle.js -w --dist plugs/dist plugs/*/*.plug.yaml", "server": "nodemon -w dist/server dist/server/server.js pages", "test": "jest" }, @@ -36,10 +36,10 @@ "isLibrary": true, "context": "node" }, - "plugbox": { + "plugos": { "source": [ - "plugbox/bin/plugbox-bundle.ts", - "plugbox/bin/plugbox-server.ts" + "plugos/bin/plugos-bundle.ts", + "plugos/bin/plugos-server.ts" ], "outputFormat": "commonjs", "isLibrary": true, @@ -47,10 +47,10 @@ }, "test": { "source": [ - "plugbox/runtime.test.ts", - "plugbox/feature/endpoint.test.ts", - "plugbox/syscall/store.knex_node.test.ts", - "plugbox/syscall/store.dexie_browser.test.ts", + "plugos/runtime.test.ts", + "plugos/feature/endpoint.test.ts", + "plugos/syscall/store.knex_node.test.ts", + "plugos/syscall/store.dexie_browser.test.ts", "server/api.test.ts" ], "outputFormat": "commonjs", diff --git a/plugbox/bin/plugbox-bundle.ts b/plugos/bin/plugos-bundle.ts similarity index 96% rename from plugbox/bin/plugbox-bundle.ts rename to plugos/bin/plugos-bundle.ts index 7c91881f..dc5bd755 100755 --- a/plugbox/bin/plugbox-bundle.ts +++ b/plugos/bin/plugos-bundle.ts @@ -99,7 +99,7 @@ async function run() { .parse(); if (args._.length === 0) { console.log( - "Usage: plugbox-bundle [--debug] [--dist ] ..." + "Usage: plugos-bundle [--debug] [--dist ] ..." ); process.exit(1); } diff --git a/plugbox/bin/plugbox-server.ts b/plugos/bin/plugos-server.ts similarity index 95% rename from plugbox/bin/plugbox-server.ts rename to plugos/bin/plugos-server.ts index 15dcaf1e..48c7b7ed 100755 --- a/plugbox/bin/plugbox-server.ts +++ b/plugos/bin/plugos-server.ts @@ -27,7 +27,7 @@ let args = yargs(hideBin(process.argv)) .parse(); if (!args._.length) { - console.error("Usage: plugbox-server "); + console.error("Usage: plugos-server "); process.exit(1); } @@ -42,7 +42,7 @@ safeRun(async () => { const db = knex({ client: "better-sqlite3", connection: { - filename: "plugbox.db", + filename: "plugos.db", }, useNullAsDefault: true, }); diff --git a/plugbox/environment/iframe_sandbox.html b/plugos/environment/iframe_sandbox.html similarity index 100% rename from plugbox/environment/iframe_sandbox.html rename to plugos/environment/iframe_sandbox.html diff --git a/plugbox/environment/iframe_sandbox.ts b/plugos/environment/iframe_sandbox.ts similarity index 100% rename from plugbox/environment/iframe_sandbox.ts rename to plugos/environment/iframe_sandbox.ts diff --git a/plugbox/environment/node_sandbox.ts b/plugos/environment/node_sandbox.ts similarity index 100% rename from plugbox/environment/node_sandbox.ts rename to plugos/environment/node_sandbox.ts diff --git a/plugbox/environment/node_worker.ts b/plugos/environment/node_worker.ts similarity index 100% rename from plugbox/environment/node_worker.ts rename to plugos/environment/node_worker.ts diff --git a/plugbox/environment/sandbox_worker.ts b/plugos/environment/sandbox_worker.ts similarity index 100% rename from plugbox/environment/sandbox_worker.ts rename to plugos/environment/sandbox_worker.ts diff --git a/plugbox/environment/webworker_sandbox.ts b/plugos/environment/webworker_sandbox.ts similarity index 100% rename from plugbox/environment/webworker_sandbox.ts rename to plugos/environment/webworker_sandbox.ts diff --git a/plugbox/environment/worker.ts b/plugos/environment/worker.ts similarity index 100% rename from plugbox/environment/worker.ts rename to plugos/environment/worker.ts diff --git a/plugbox/feature/endpoint.test.ts b/plugos/feature/endpoint.test.ts similarity index 96% rename from plugbox/feature/endpoint.test.ts rename to plugos/feature/endpoint.test.ts index 98f4402f..2d01aa22 100644 --- a/plugbox/feature/endpoint.test.ts +++ b/plugos/feature/endpoint.test.ts @@ -6,7 +6,7 @@ import request from "supertest"; import { EndpointFeature, EndpointHook } from "./endpoint"; import { System } from "../system"; -test("Run a plugbox endpoint server", async () => { +test("Run a plugos endpoint server", async () => { let system = new System("server"); let plug = await system.load( "test", diff --git a/plugbox/feature/endpoint.ts b/plugos/feature/endpoint.ts similarity index 100% rename from plugbox/feature/endpoint.ts rename to plugos/feature/endpoint.ts diff --git a/plugbox/feature/event.ts b/plugos/feature/event.ts similarity index 100% rename from plugbox/feature/event.ts rename to plugos/feature/event.ts diff --git a/plugbox/feature/node_cron.ts b/plugos/feature/node_cron.ts similarity index 100% rename from plugbox/feature/node_cron.ts rename to plugos/feature/node_cron.ts diff --git a/plugbox/plug.ts b/plugos/plug.ts similarity index 100% rename from plugbox/plug.ts rename to plugos/plug.ts diff --git a/plugbox/plug_loader.ts b/plugos/plug_loader.ts similarity index 100% rename from plugbox/plug_loader.ts rename to plugos/plug_loader.ts diff --git a/plugbox/runtime.test.ts b/plugos/runtime.test.ts similarity index 100% rename from plugbox/runtime.test.ts rename to plugos/runtime.test.ts diff --git a/plugbox/sandbox.ts b/plugos/sandbox.ts similarity index 100% rename from plugbox/sandbox.ts rename to plugos/sandbox.ts diff --git a/plugbox/syscall/event.ts b/plugos/syscall/event.ts similarity index 100% rename from plugbox/syscall/event.ts rename to plugos/syscall/event.ts diff --git a/plugbox/syscall/fetch.node.ts b/plugos/syscall/fetch.node.ts similarity index 100% rename from plugbox/syscall/fetch.node.ts rename to plugos/syscall/fetch.node.ts diff --git a/plugbox/syscall/shell.node.ts b/plugos/syscall/shell.node.ts similarity index 100% rename from plugbox/syscall/shell.node.ts rename to plugos/syscall/shell.node.ts diff --git a/plugbox/syscall/store.dexie_browser.test.ts b/plugos/syscall/store.dexie_browser.test.ts similarity index 100% rename from plugbox/syscall/store.dexie_browser.test.ts rename to plugos/syscall/store.dexie_browser.test.ts diff --git a/plugbox/syscall/store.dexie_browser.ts b/plugos/syscall/store.dexie_browser.ts similarity index 100% rename from plugbox/syscall/store.dexie_browser.ts rename to plugos/syscall/store.dexie_browser.ts diff --git a/plugbox/syscall/store.knex_node.test.ts b/plugos/syscall/store.knex_node.test.ts similarity index 100% rename from plugbox/syscall/store.knex_node.test.ts rename to plugos/syscall/store.knex_node.test.ts diff --git a/plugbox/syscall/store.knex_node.ts b/plugos/syscall/store.knex_node.ts similarity index 100% rename from plugbox/syscall/store.knex_node.ts rename to plugos/syscall/store.knex_node.ts diff --git a/plugbox/syscall/transport.ts b/plugos/syscall/transport.ts similarity index 100% rename from plugbox/syscall/transport.ts rename to plugos/syscall/transport.ts diff --git a/plugbox/system.ts b/plugos/system.ts similarity index 100% rename from plugbox/system.ts rename to plugos/system.ts diff --git a/plugbox/types.ts b/plugos/types.ts similarity index 100% rename from plugbox/types.ts rename to plugos/types.ts diff --git a/plugbox/util.ts b/plugos/util.ts similarity index 100% rename from plugbox/util.ts rename to plugos/util.ts diff --git a/plugs/core/server.ts b/plugs/core/server.ts index 8eec1a9e..1a593cdc 100644 --- a/plugs/core/server.ts +++ b/plugs/core/server.ts @@ -1,7 +1,7 @@ import { EndpointRequest, EndpointResponse, -} from "../../plugbox/feature/endpoint"; +} from "../../plugos/feature/endpoint"; export function endpointTest(req: EndpointRequest): EndpointResponse { console.log("I'm running on the server!", req); diff --git a/server/api.test.ts b/server/api.test.ts index 0728b771..f5125399 100644 --- a/server/api.test.ts +++ b/server/api.test.ts @@ -7,7 +7,7 @@ import { SocketServer } from "./api_server"; import * as path from "path"; import * as fs from "fs"; import { SilverBulletHooks } from "../common/manifest"; -import { System } from "../plugbox/system"; +import { System } from "../plugos/system"; describe("Server test", () => { let io: Server, diff --git a/server/api_server.ts b/server/api_server.ts index 3a333da1..522a873f 100644 --- a/server/api_server.ts +++ b/server/api_server.ts @@ -6,7 +6,7 @@ import { PageApi } from "./page_api"; import { SilverBulletHooks } from "../common/manifest"; import pageIndexSyscalls from "./syscalls/page_index"; import { safeRun } from "./util"; -import { System } from "../plugbox/system"; +import { System } from "../plugos/system"; export class ClientConnection { openPages = new Set(); diff --git a/server/express_server.ts b/server/express_server.ts index fedb7e2d..a4524bed 100644 --- a/server/express_server.ts +++ b/server/express_server.ts @@ -1,8 +1,8 @@ import { Express } from "express"; import { SilverBulletHooks } from "../common/manifest"; -import { EndpointFeature } from "../plugbox/feature/endpoint"; +import { EndpointFeature } from "../plugos/feature/endpoint"; import { readFile } from "fs/promises"; -import { System } from "../plugbox/system"; +import { System } from "../plugos/system"; export class ExpressServer { app: Express; diff --git a/server/page_api.ts b/server/page_api.ts index 66202bb1..05e017a7 100644 --- a/server/page_api.ts +++ b/server/page_api.ts @@ -10,8 +10,8 @@ import path from "path"; import { stat } from "fs/promises"; import { Cursor, cursorEffect } from "../webapp/cursorEffect"; import { SilverBulletHooks } from "../common/manifest"; -import { System } from "../plugbox/system"; -import { EventFeature } from "../plugbox/feature/event"; +import { System } from "../plugos/system"; +import { EventFeature } from "../plugos/feature/event"; export class PageApi implements ApiProvider { openPages: Map; diff --git a/server/server.ts b/server/server.ts index 1282d3c3..56bcb783 100755 --- a/server/server.ts +++ b/server/server.ts @@ -8,10 +8,10 @@ import yargs from "yargs"; import {hideBin} from "yargs/helpers"; import {SilverBulletHooks} from "../common/manifest"; import {ExpressServer} from "./express_server"; -import {DiskPlugLoader} from "../plugbox/plug_loader"; -import {NodeCronFeature} from "../plugbox/feature/node_cron"; -import shellSyscalls from "../plugbox/syscall/shell.node"; -import {System} from "../plugbox/system"; +import {DiskPlugLoader} from "../plugos/plug_loader"; +import {NodeCronFeature} from "../plugos/feature/node_cron"; +import shellSyscalls from "../plugos/syscall/shell.node"; +import {System} from "../plugos/system"; let args = yargs(hideBin(process.argv)) .option("port", { @@ -21,7 +21,7 @@ let args = yargs(hideBin(process.argv)) .parse(); if (!args._.length) { - console.error("Usage: silverbullet "); + console.error("Usage: silverbullet "); process.exit(1); } diff --git a/server/syscalls/page_index.ts b/server/syscalls/page_index.ts index 0b283f74..b532239e 100644 --- a/server/syscalls/page_index.ts +++ b/server/syscalls/page_index.ts @@ -1,5 +1,5 @@ import { Knex } from "knex"; -import { SysCallMapping } from "../../plugbox/system"; +import { SysCallMapping } from "../../plugos/system"; type IndexItem = { page: string; diff --git a/tsconfig.json b/tsconfig.json index 7d70674e..50985554 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "include": ["webapp/**/*", "server/**/*", "plugbox/**/*", "plugs/**/*"], + "include": ["webapp/**/*", "server/**/*", "plugos/**/*", "plugs/**/*"], "compilerOptions": { "target": "esnext", "strict": true, diff --git a/webapp/editor.tsx b/webapp/editor.tsx index ddf75832..337c0ab5 100644 --- a/webapp/editor.tsx +++ b/webapp/editor.tsx @@ -21,7 +21,7 @@ import { } from "@codemirror/view"; import React, { useEffect, useReducer } from "react"; import ReactDOM from "react-dom"; -import { createSandbox as createIFrameSandbox } from "../plugbox/environment/iframe_sandbox"; +import { createSandbox as createIFrameSandbox } from "../plugos/environment/iframe_sandbox"; import { AppEvent, AppEventDispatcher, ClickEvent } from "./app_event"; import { CollabDocument, collabExtension } from "./collab"; import * as commands from "./commands"; @@ -49,8 +49,8 @@ import { } from "./types"; import { SilverBulletHooks } from "../common/manifest"; import { safeRun } from "./util"; -import { System } from "../plugbox/system"; -import { EventFeature } from "../plugbox/feature/event"; +import { System } from "../plugos/system"; +import { EventFeature } from "../plugos/feature/event"; import { systemSyscalls } from "./syscalls/system"; class PageState { diff --git a/webapp/space.ts b/webapp/space.ts index 95e2e711..1a0aa5a0 100644 --- a/webapp/space.ts +++ b/webapp/space.ts @@ -7,7 +7,7 @@ import { CollabDocument, CollabEvents } from "./collab"; import { cursorEffect } from "./cursorEffect"; import { EventEmitter } from "../common/event"; import { Manifest } from "../common/manifest"; -import { SystemJSON } from "../plugbox/system"; +import { SystemJSON } from "../plugos/system"; export type SpaceEvents = { connect: () => void; diff --git a/webapp/syscalls/editor.ts b/webapp/syscalls/editor.ts index ba94084d..929da5d3 100644 --- a/webapp/syscalls/editor.ts +++ b/webapp/syscalls/editor.ts @@ -1,7 +1,7 @@ import { Editor } from "../editor"; import { syntaxTree } from "@codemirror/language"; import { Transaction } from "@codemirror/state"; -import { SysCallMapping } from "../../plugbox/system"; +import { SysCallMapping } from "../../plugos/system"; type SyntaxNode = { name: string; diff --git a/webapp/syscalls/indexer.ts b/webapp/syscalls/indexer.ts index b71350a7..f539766b 100644 --- a/webapp/syscalls/indexer.ts +++ b/webapp/syscalls/indexer.ts @@ -1,6 +1,6 @@ import { Space } from "../space"; -import { SysCallMapping } from "../../plugbox/system"; -import { transportSyscalls } from "../../plugbox/syscall/transport"; +import { SysCallMapping } from "../../plugos/system"; +import { transportSyscalls } from "../../plugos/syscall/transport"; export default function indexerSyscalls(space: Space): SysCallMapping { return transportSyscalls( diff --git a/webapp/syscalls/space.ts b/webapp/syscalls/space.ts index 204f2c56..8a334e6d 100644 --- a/webapp/syscalls/space.ts +++ b/webapp/syscalls/space.ts @@ -1,6 +1,6 @@ import { Editor } from "../editor"; import { PageMeta } from "../types"; -import { SysCallMapping } from "../../plugbox/system"; +import { SysCallMapping } from "../../plugos/system"; export default (editor: Editor): SysCallMapping => ({ listPages: (): PageMeta[] => { diff --git a/webapp/syscalls/system.ts b/webapp/syscalls/system.ts index 89b89f82..3a3a782a 100644 --- a/webapp/syscalls/system.ts +++ b/webapp/syscalls/system.ts @@ -1,4 +1,4 @@ -import { SysCallMapping } from "../../plugbox/system"; +import { SysCallMapping } from "../../plugos/system"; import { Space } from "../space"; export function systemSyscalls(space: Space): SysCallMapping {