generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 19
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
10 changed files
with
83 additions
and
624 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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import esbuild from "esbuild"; | ||
const typescriptEntries = ["static/main.ts"]; | ||
const typescriptEntries = ["src/worker.ts"]; | ||
// const cssEntries = ["static/style.css"]; | ||
const entries = [ | ||
...typescriptEntries, | ||
// ...cssEntries | ||
...typescriptEntries, | ||
// ...cssEntries | ||
]; | ||
|
||
export const esBuildContext: esbuild.BuildOptions = { | ||
sourcemap: true, | ||
entryPoints: entries, | ||
bundle: true, | ||
minify: false, | ||
loader: { | ||
".png": "dataurl", | ||
".woff": "dataurl", | ||
".woff2": "dataurl", | ||
".eot": "dataurl", | ||
".ttf": "dataurl", | ||
".svg": "dataurl", | ||
}, | ||
outdir: "dist", | ||
sourcemap: true, | ||
entryPoints: entries, | ||
bundle: true, | ||
minify: false, | ||
loader: { | ||
".png": "dataurl", | ||
".woff": "dataurl", | ||
".woff2": "dataurl", | ||
".eot": "dataurl", | ||
".ttf": "dataurl", | ||
".svg": "dataurl", | ||
}, | ||
outdir: "dist", | ||
}; | ||
|
||
esbuild | ||
.build(esBuildContext) | ||
.then(() => { | ||
console.log("\tesbuild complete"); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
.build(esBuildContext) | ||
.then(() => { | ||
console.log("\tesbuild complete"); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
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 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import SmeeClient from "smee-client"; | ||
import { Miniflare } from "miniflare"; | ||
|
||
const path = "/events"; | ||
|
||
const mf = new Miniflare({ | ||
modules: true, | ||
scriptPath: "./worker.js", | ||
}); | ||
|
||
mf.ready | ||
.then(async (url) => { | ||
const env = await mf.getBindings(); | ||
if (env.WEBHOOK_PROXY_URL && typeof env.WEBHOOK_PROXY_URL === "string") { | ||
url.pathname = path; | ||
const smee = new SmeeClient({ | ||
source: env.WEBHOOK_PROXY_URL, | ||
target: url.toString(), | ||
logger: console, | ||
}); | ||
|
||
smee.start(); | ||
} | ||
console.log(`Listening on ${url}`); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,3 @@ | ||
export async function handleEvent(event: unknown) { | ||
console.trace(event); | ||
} |
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
Oops, something went wrong.