From d477417ff6e2ed739a9448e9b8f931e2e21228ce Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 20 Jul 2023 16:13:36 -0400 Subject: [PATCH] style: format --- src/index.ts | 26 +++++++++++++------------- src/sandbox.ts | 8 ++++---- src/tester.ts | 3 +-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7d3196d..fbe2daf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,42 +1,42 @@ -import * as path from 'path'; -import * as kernel from '@lumeweb/libkernel/kernel'; +import * as path from "path"; +import * as kernel from "@lumeweb/libkernel/kernel"; // @ts-ignore -import StaticServer from 'static-server'; -import { Page } from 'puppeteer'; -import { bufToHex, ed25519, ErrTuple } from '@lumeweb/libkernel'; +import StaticServer from "static-server"; +import { Page } from "puppeteer"; +import { bufToHex, ed25519, ErrTuple } from "@lumeweb/libkernel"; -import * as url from 'url'; +import * as url from "url"; -const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); +const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); export function generateSeedPhrase() { return ed25519.utils.randomPrivateKey(); } export async function login(page: Page, seed = generateSeedPhrase()) { - await page.goto('http://kernel.lumeweb.com'); + await page.goto("http://kernel.lumeweb.com"); let seedHex = bufToHex(seed); await page.evaluate((seed: string) => { - window.localStorage.setItem('v1-key', seed); + window.localStorage.setItem("v1-key", seed); }, seedHex); } export async function loadTester(page: Page, port = 8080) { const server = new StaticServer({ - rootPath: path.resolve(__dirname, '..', 'public'), + rootPath: path.resolve(__dirname, "..", "public"), port, - host: 'localhost', + host: "localhost", }); await new Promise((resolve) => { server.start(resolve); }); const stop = () => server.stop(); - process.on('SIGTERM', stop); - page.browser().on('disconnected', stop); + process.on("SIGTERM", stop); + page.browser().on("disconnected", stop); await page.goto(`http://localhost:${port}/`); await page.evaluate(() => { diff --git a/src/sandbox.ts b/src/sandbox.ts index 0eaf37c..ff03953 100644 --- a/src/sandbox.ts +++ b/src/sandbox.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node // @ts-ignore -import { loadTester, login } from '../build/index.js'; +import { loadTester, login } from "../build/index.js"; -import puppeteer, { Browser, Page, ProtocolError } from 'puppeteer'; +import puppeteer, { Browser, Page, ProtocolError } from "puppeteer"; let browser: Browser; @@ -14,10 +14,10 @@ let browser: Browser; await loadTester(page); })(); -process.on('SIGTERM', async () => { +process.on("SIGTERM", async () => { await browser.close(); }); -process.on('uncaughtException', (e) => { +process.on("uncaughtException", (e) => { if (!(e instanceof ProtocolError)) { throw e; } diff --git a/src/tester.ts b/src/tester.ts index 885a69f..5349be2 100644 --- a/src/tester.ts +++ b/src/tester.ts @@ -1,5 +1,4 @@ -import * as kernel from "@lumeweb/libkernel"; - +import * as kernel from "@lumeweb/libkernel/kernel"; // @ts-ignore window.kernel = kernel;