Skip to content

Commit

Permalink
reorg, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjor committed Oct 7, 2023
1 parent 0fc3ee2 commit 0f9698a
Show file tree
Hide file tree
Showing 11 changed files with 370 additions and 100 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ jobs:
uses: denoland/deployctl@v1
with:
project: kaleidoshare
entrypoint: server.ts
entrypoint: server/index.ts
import-map: server/deno.jsonc
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"deno.enable": true,
"deno.unstable": true,
"deno.enablePaths": ["server.ts", "server"],
"deno.config": "./deno.jsonc"
"deno.config": "./server/deno.jsonc"
}
26 changes: 0 additions & 26 deletions deno.jsonc

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
"scripts": {
"dev": "run-p dev:*",
"dev:frontend": "vite",
"dev:backend": "deno run -A --watch --unstable ./server.ts",
"dev:backend": "deno run -A --watch --unstable --config server/deno.jsonc server/index.ts",
"build": "run-s build:*",
"build:schema": "ts-json-schema-generator --path 'schema/schema.ts' --out schema/schema.json",
"build:frontend": "vite build",
"preview": "deno run -A --unstable ./server.ts",
"preview": "deno run -A --unstable --config server/deno.jsonc server/index.ts",
"test": "run-s test:*",
"test:backend": "node --loader tsx --test ./test/backend/*.test.mts",
"test:frontend": "playwright test"
Expand Down
3 changes: 2 additions & 1 deletion server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
updateContent,
} from "./content.ts";

import Ajv, { ValidateFunction } from "ajv";
import AjvImport, { ValidateFunction } from "ajv";
const Ajv = AjvImport as unknown as typeof AjvImport.default;
import schema from "../schema/schema.json" assert { type: "json" };
import { Settings, Output, Image } from "../schema/schema.ts";
import { makeContentPageForTwitterBot } from "./twitter.tsx";
Expand Down
22 changes: 22 additions & 0 deletions server/deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"imports": {
"simplewebauthn/server": "npm:@simplewebauthn/server@^7.3.0",
"simplewebauthn/server/helpers": "npm:@simplewebauthn/server@^7.3.0/helpers",
"simplewebauthn/typescript-types": "npm:@simplewebauthn/typescript-types@7.4.0",
"std/encoding/base64url": "https://deno.land/std@0.179.0/encoding/base64url.ts",
"std/_util/asserts": "https://deno.land/std@0.183.0/_util/asserts.ts",
"ulid": "npm:ulid@2.3.0",
"ajv": "npm:ajv@8.12.0",
"oak": "https://deno.land/x/oak@v12.2.0/mod.ts",
"oak_sessions": "https://deno.land/x/oak_sessions@v4.1.4/mod.ts",
"react": "npm:react@18.2.0",
"react-dom/server": "npm:react-dom@18.2.0/server"
},
"scopes": {},
"compilerOptions": {
"jsx": "react",
"jsxFactory": "React.createElement",
"jsxFragmentFactory": "React.Fragment"
},
"nodeModulesDir": false
}
317 changes: 278 additions & 39 deletions deno.lock → server/deno.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions server.ts → server/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Application } from "oak";
import { CookieStore, Session } from "oak_sessions";
import { randomHex } from "./server/util.ts";
import { openKv } from "./server/kv.ts";
import { createRouters, handleError } from "./server/api.ts";
import { randomHex } from "./util.ts";
import { openKv } from "./kv.ts";
import { createRouters, handleError } from "./api.ts";

const apiServerPort: number = parseInt(Deno.env.get("PORT") ?? "8000");

Expand Down
29 changes: 20 additions & 9 deletions test/backend/bot.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@ test("bot", async (t) => {
let p: childProcess.ChildProcess;
before(async () => {
fs.mkdirSync("tmp", { recursive: true });
p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], {
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
});
p = childProcess.spawn(
"deno",
[
"run",
"-A",
"--unstable",
"--config",
"server/deno.jsonc",
"server/index.ts",
],
{
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
}
);
await waitForServer(origin);
});
after(() => {
Expand Down
29 changes: 20 additions & 9 deletions test/backend/content.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@ test("content", async (t) => {
let p: childProcess.ChildProcess;
before(async () => {
fs.mkdirSync("tmp", { recursive: true });
p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], {
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
});
p = childProcess.spawn(
"deno",
[
"run",
"-A",
"--unstable",
"--config",
"server/deno.jsonc",
"server/index.ts",
],
{
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
}
);
await waitForServer(origin);
});
after(() => {
Expand Down
29 changes: 20 additions & 9 deletions test/backend/session.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,26 @@ test("session", async (t) => {
let p: childProcess.ChildProcess;
before(async () => {
fs.mkdirSync("tmp", { recursive: true });
p = childProcess.spawn("deno", ["run", "-A", "--unstable", "server.ts"], {
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
});
p = childProcess.spawn(
"deno",
[
"run",
"-A",
"--unstable",
"--config",
"server/deno.jsonc",
"server/index.ts",
],
{
env: {
...process.env,
CHALLENGE: "test",
PORT: String(port),
KV_PATH: kvPath,
},
stdio: "inherit",
}
);
await waitForServer(origin);
});
after(() => {
Expand Down

0 comments on commit 0f9698a

Please sign in to comment.