Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

chore: codegen + test ctx server refactor #487

Merged
merged 94 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
91880fd
begin fresh refactor
harrysolovay Dec 24, 2022
23886ec
continued
harrysolovay Dec 24, 2022
3238dee
continued
harrysolovay Jan 5, 2023
698dbae
fix changed devcontainer deno config file
harrysolovay Jan 5, 2023
7c05df6
fix broken jsonc formatting
harrysolovay Jan 5, 2023
3dd1fa0
continued
harrysolovay Jan 5, 2023
af0a866
continued
harrysolovay Jan 5, 2023
2c5ac71
continued
harrysolovay Jan 6, 2023
498c776
continued
harrysolovay Jan 7, 2023
9170790
continued
harrysolovay Jan 7, 2023
e815937
continued
harrysolovay Jan 7, 2023
1cfe339
continued
harrysolovay Jan 7, 2023
60f3bbd
continued
harrysolovay Jan 7, 2023
292516d
continued
harrysolovay Jan 7, 2023
1bc7435
continued
harrysolovay Jan 8, 2023
f991d44
continued
harrysolovay Jan 9, 2023
5b59b25
continued
harrysolovay Jan 9, 2023
537f233
rebase against main
harrysolovay Jan 9, 2023
7c452f6
continued
harrysolovay Jan 9, 2023
7f2d663
continued
harrysolovay Jan 9, 2023
85d8a75
continued
harrysolovay Jan 10, 2023
1ca1b2c
continued
harrysolovay Jan 10, 2023
bb7402e
outdent
harrysolovay Jan 10, 2023
ca2be43
work on zombienet provider
harrysolovay Jan 10, 2023
60f5b1c
zombienet integrated
harrysolovay Jan 11, 2023
2505660
continued
harrysolovay Jan 11, 2023
b2c8085
continued
harrysolovay Jan 11, 2023
6129b4c
continued
harrysolovay Jan 13, 2023
da6ad52
continued
harrysolovay Jan 13, 2023
85a03e7
continued
harrysolovay Jan 16, 2023
7ef58c2
continued
harrysolovay Jan 17, 2023
59863ee
continued
harrysolovay Jan 17, 2023
6b83277
continued
harrysolovay Jan 18, 2023
3e581aa
fix serving local capi, begin fixing tests
harrysolovay Jan 18, 2023
4e1a2f7
get tests working
harrysolovay Jan 19, 2023
4bb2b3d
misc simplifying
harrysolovay Jan 19, 2023
22e620d
continued
harrysolovay Jan 19, 2023
dab8be8
fix formatting error
harrysolovay Jan 19, 2023
ca56a78
fix lint errors
harrysolovay Jan 19, 2023
b7e5aa2
fixing ci
harrysolovay Jan 19, 2023
15d3718
clean up xcm example
harrysolovay Jan 20, 2023
a2d6e61
temporarily disable all star task usage
harrysolovay Jan 20, 2023
45cf345
get things working
harrysolovay Jan 20, 2023
b27f10a
uncomment zombienet examples
harrysolovay Jan 20, 2023
cb776f2
debugging zombienet path
harrysolovay Jan 23, 2023
d1df7d6
continue debugging
harrysolovay Jan 23, 2023
0672e31
continue debugging
harrysolovay Jan 23, 2023
727f9c1
tmp
harrysolovay Jan 23, 2023
061c8b0
attempting to fix ci
harrysolovay Jan 23, 2023
feaf17f
update deno std deps
harrysolovay Jan 23, 2023
a6ebd22
t6 feedback
harrysolovay Jan 25, 2023
98fdcc5
continued
harrysolovay Jan 25, 2023
a929ba8
change default port, fixes
harrysolovay Jan 26, 2023
a171be7
fix broken examples
harrysolovay Jan 26, 2023
a6c1a97
try to get ci working
harrysolovay Jan 26, 2023
8a04b4e
remove unused import
harrysolovay Jan 26, 2023
8f634aa
misc changes
harrysolovay Jan 26, 2023
fbab8f9
vscode setting tweak
harrysolovay Jan 26, 2023
00bdc2c
pairing with t6
harrysolovay Jan 27, 2023
253eece
fix lint errors
harrysolovay Jan 27, 2023
4db8312
various fixes
harrysolovay Jan 27, 2023
734eaf5
remove deno deploy goodies
harrysolovay Jan 27, 2023
bf2a5de
debugging ci
harrysolovay Jan 27, 2023
e5ce6a5
debugging ci
harrysolovay Jan 27, 2023
eb8d2f4
correct zombienet throw message
harrysolovay Jan 27, 2023
869d13e
Update .github/workflows/test.yml
harrysolovay Jan 27, 2023
1609994
Update .github/workflows/test.yml
harrysolovay Jan 27, 2023
bb93ca0
clean up ci and expose main.ts cmd exit
harrysolovay Jan 27, 2023
c0fd95a
get rid of unwanted console log
harrysolovay Jan 27, 2023
fc7dfb5
misc ci cleanup
harrysolovay Jan 27, 2023
98b1ac5
re-add star task to test
harrysolovay Jan 27, 2023
11c9b0f
allow zombienet process to throw
harrysolovay Jan 27, 2023
955eb00
Update rpc/provider/proxy.test.ts
harrysolovay Jan 27, 2023
b4f549b
Update deno.jsonc
harrysolovay Jan 27, 2023
b670760
Update .github/workflows/test.yml
harrysolovay Jan 27, 2023
838bddc
Update deps/dprint.ts
harrysolovay Jan 27, 2023
a706215
Update server/Env.ts
harrysolovay Jan 27, 2023
e9a4040
Update util/string.ts
harrysolovay Jan 27, 2023
cc9884a
sort words file
harrysolovay Jan 27, 2023
18fc169
Update server/PathInfo.test.ts
harrysolovay Jan 27, 2023
0bd140c
Update server/PathInfo.ts
harrysolovay Jan 27, 2023
e8d80d3
Update server/local/factories.ts
harrysolovay Jan 27, 2023
9ab5fd4
Update server/local/factories.ts
harrysolovay Jan 27, 2023
278696a
Update server/local/factories.ts
harrysolovay Jan 27, 2023
5d92dde
Update server/local/mod.ts
harrysolovay Jan 27, 2023
d9cf295
Update server/local/factories.ts
harrysolovay Jan 27, 2023
26d8356
get rid of misc pages and add t6 favicon
harrysolovay Jan 27, 2023
7e8869d
get rid of preact
harrysolovay Jan 27, 2023
b2b2cd2
fix ci errors
harrysolovay Jan 27, 2023
4221683
readd lib
harrysolovay Jan 27, 2023
50f84e2
fix typo
harrysolovay Jan 27, 2023
b42803e
Update server/local/mod.ts
harrysolovay Jan 28, 2023
a817246
cleanup
harrysolovay Jan 28, 2023
d8a1037
cleanup
harrysolovay Jan 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion providers/frame/Zombienet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export class ZombienetProvider extends FrameProxyProvider {
const network = await this.zombienet(configPath)
const node = network.nodesByName[nodeName]
if (!node) {
console.log({ pathInfo, configPath, nodeName, target, targetParts })
harrysolovay marked this conversation as resolved.
Show resolved Hide resolved
throw new Error(
`No such node named "${nodeName}" in zombienet. Available names are "${
Object.keys(network.nodesByName).join(",")
Object.keys(network.nodesByName).join(`", "`)
}".`,
)
}
Expand Down
6 changes: 3 additions & 3 deletions server/local/factories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { renderToString } from "../../deps/preact_render_to_string.ts"
import { serveFile } from "../../deps/std/http/file_server.ts"
import { Status } from "../../deps/std/http/http_status.ts"
import * as U from "../../util/mod.ts"
import { CodePage, FiveHundredPage, FourOFourPage } from "./pages/mod.ts"
import { CodePage } from "./pages/mod.ts"

export async function staticFile(req: Request, url: URL): Promise<Response> {
const { pathname: path } = url
Expand Down Expand Up @@ -32,11 +32,11 @@ export async function redirect(path: string): Promise<Response> {
})
}

export function notFound(req: Request): U.PromiseOr<Response> {
export function notFound(): U.PromiseOr<Response> {
return new Response("404", { status: Status.NotFound })
}

export function serverError(req: Request, message?: string): U.PromiseOr<Response> {
export function serverError(message?: string): U.PromiseOr<Response> {
return new Response(message || "500", { status: Status.InternalServerError })
}

Expand Down
14 changes: 6 additions & 8 deletions server/local/mod.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Handler } from "../../deps/std/http/server.ts"
import { Env, parsePathInfo } from "../mod.ts"
import * as f from "./factories.ts"
import { LandingPage } from "./pages/mod.ts"

export function handler(env: Env): Handler {
return async (req) => {
const url = new URL(req.url)
const path = url.pathname.slice(1)
if (path === "") return f.page(LandingPage())
if (path === "") return f.notFound()
harrysolovay marked this conversation as resolved.
Show resolved Hide resolved
const pathInfo = parsePathInfo(path)
if (pathInfo) {
const { vCapi, vRuntime, providerId, generatorId, filePath } = pathInfo
Expand All @@ -16,20 +15,19 @@ export function handler(env: Env): Handler {
const provider = generatorProviders[providerId]
if (provider) {
if (vCapi) {
return f.fiveHundred(
req,
return f.serverError(
"The local Capi sever assumes the same version as itself. Another cannot be specified.",
)
}
if (typeof vRuntime !== "string") {
return await f.fiveHundred(req, "No `vRuntime` in `pathInfo`")
return await f.serverError("No `vRuntime` in `pathInfo`")
}
if (typeof filePath !== "string") {
return await f.fiveHundred(req, "No `filePath` in `pathInfo`")
return await f.serverError("No `filePath` in `pathInfo`")
}
switch (filePath) {
case "":
return await f.fiveHundred(req, "TODO: chain root page")
return await f.serverError("TODO: chain root page")
case "capi.ts":
return await f.redirect("/mod.ts")
default: {
Expand All @@ -47,7 +45,7 @@ export function handler(env: Env): Handler {
return await f.staticFile(req, url)
} catch (_e) {}
}
return f.fourOFour(req)
return f.notFound()
}
}

Expand Down
12 changes: 0 additions & 12 deletions server/local/pages/404.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions server/local/pages/500.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions server/local/pages/Landing.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions server/local/pages/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export * from "./404.tsx"
export * from "./500.tsx"
export * from "./Code.tsx"
export * from "./Landing.tsx"
Binary file modified server/local/static/favicon.ico
Binary file not shown.
8 changes: 4 additions & 4 deletions util/string.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export function splitFirst(char: string, src: string) {
export function splitFirst(char: string, src: string): [string, string] | undefined {
const i = src.indexOf(char)
return i === -1 ? undefined : [src.slice(0, i), src.slice(i, 1)]
return i === -1 ? undefined : [src.slice(0, i), src.slice(i + 1)]
}

export function splitLast(char: string, src: string) {
export function splitLast(char: string, src: string): [string, string] | undefined {
const i = src.lastIndexOf(char)
return i === -1 ? undefined : [src.slice(0, i), src.slice(i, 1)]
return i === -1 ? undefined : [src.slice(0, i), src.slice(i + 1)]
}