This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
2,281 additions
and
1,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Deno Deploy | ||
on: push | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: denoland/setup-deno@9db7f66e8e16b5699a514448ce994936c63f0d54 # v1.1.0 | ||
with: | ||
deno-version: v1.x | ||
- run: deno task run _tasks/gen_deploy.ts | ||
- name: Deploy to Deno Deploy | ||
uses: denoland/deployctl@v1 | ||
with: | ||
project: capi-dev | ||
entrypoint: target/deploy.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { LocalCapiCodegenServer } from "../codegen/server/local.ts" | ||
import * as fs from "../deps/std/fs.ts" | ||
|
||
await fs.emptyDir("target/codegen/generated") | ||
const port = 5646 | ||
const server = new LocalCapiCodegenServer() | ||
server.listen(port) | ||
|
||
await Deno.run({ | ||
cmd: [ | ||
"deno", | ||
"cache", | ||
"--no-lock", | ||
"--import-map", | ||
"import_map_localhost.json", | ||
`--reload=http://localhost:${port}/`, | ||
"examples/mod.ts", | ||
], | ||
}).status() | ||
|
||
server.abortController.abort() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getModuleIndex, getSha } from "../codegen/server/git_utils.ts" | ||
import { ensureDir } from "../deps/std/fs.ts" | ||
|
||
const sha = await getSha() | ||
const index = await getModuleIndex() | ||
|
||
await ensureDir("target") | ||
await Deno.writeTextFile( | ||
"target/deploy.ts", | ||
` | ||
import { DenoDeployCodegenServer } from "../codegen/server/deploy.ts" | ||
new DenoDeployCodegenServer( | ||
"sha:${sha}", | ||
${JSON.stringify(index)}, | ||
).listen(80) | ||
`, | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,9 @@ | ||
import { tsFormatter } from "../deps/dprint.ts" | ||
import * as path from "../deps/std/path.ts" | ||
import { S } from "./utils.ts" | ||
|
||
export type File = { getContent: () => S } | ||
export class Files extends Map<string, File> { | ||
async write(outDir: string) { | ||
const errors = [] | ||
try { | ||
await Deno.remove(outDir, { recursive: true }) | ||
} catch (e) { | ||
if (!(e instanceof Deno.errors.NotFound)) { | ||
throw e | ||
} | ||
} | ||
await Deno.mkdir(outDir, { recursive: true }) | ||
for (const [relativePath, file] of this.entries()) { | ||
const outputPath = path.join(outDir, relativePath) | ||
const content = S.toString(file.getContent()) | ||
try { | ||
const formatted = tsFormatter.formatText("gen.ts", content) | ||
await Deno.writeTextFile(outputPath, formatted) | ||
} catch (e) { | ||
await Deno.writeTextFile(outputPath, content) | ||
errors.push(e) | ||
} | ||
} | ||
if (errors.length) { | ||
throw errors | ||
} | ||
export class Files extends Map<string, () => string> { | ||
getFormatted(key: string) { | ||
const file = this.get(key) | ||
if (!file) return undefined | ||
return tsFormatter.formatText(key, file()) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.