-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tooling updates * update gitignore * functionality * fix route integration? * fix? * weird hack around build process * fix lockfile * add tests * mock something * testing * fix ses mock * add one more live test * use moment-timezone build
- Loading branch information
1 parent
ba0d6b1
commit 437fad4
Showing
29 changed files
with
1,356 additions
and
43 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 |
---|---|---|
|
@@ -141,3 +141,4 @@ __pycache__ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
dist_devel/ |
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
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,39 @@ | ||
import esbuild from "esbuild"; | ||
import { resolve } from "path"; | ||
|
||
esbuild | ||
.build({ | ||
entryPoints: ["api/lambda.js"], // Entry file | ||
bundle: true, | ||
format: "esm", | ||
minify: true, | ||
outdir: "../../dist/lambda/", | ||
outExtension: { ".js": ".mjs" }, | ||
loader: { | ||
".png": "file", | ||
".pkpass": "file", | ||
".json": "file", | ||
}, // File loaders | ||
target: "es2022", // Target ES2022 | ||
sourcemap: false, | ||
platform: "node", | ||
external: ["aws-sdk", "moment-timezone", "passkit-generator", "fastify"], | ||
alias: { | ||
'moment-timezone': resolve(process.cwd(), '../../node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js') | ||
}, | ||
banner: { | ||
js: ` | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { createRequire as topLevelCreateRequire } from 'module'; | ||
const require = topLevelCreateRequire(import.meta.url); | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
`.trim(), | ||
}, // Banner for compatibility with CommonJS | ||
}) | ||
.then(() => console.log("Build completed successfully!")) | ||
.catch((error) => { | ||
console.error("Build failed:", error); | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { build, context } from 'esbuild'; | ||
import { readFileSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
|
||
const isWatching = !!process.argv.includes('--watch') | ||
const nodePackage = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')); | ||
|
||
const buildOptions = { | ||
entryPoints: [resolve(process.cwd(), 'index.ts')], | ||
outfile: resolve(process.cwd(), '../', '../', 'dist_devel', 'index.js'), | ||
bundle: true, | ||
platform: 'node', | ||
format: 'esm', | ||
external: [ | ||
Object.keys(nodePackage.dependencies ?? {}), | ||
Object.keys(nodePackage.peerDependencies ?? {}), | ||
Object.keys(nodePackage.devDependencies ?? {}), | ||
].flat(), | ||
loader: { | ||
'.png': 'file', // Add this line to specify a loader for .png files | ||
}, | ||
alias: { | ||
'moment-timezone': resolve(process.cwd(), '../../node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js') | ||
}, | ||
banner: { | ||
js: ` | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { createRequire as topLevelCreateRequire } from 'module'; | ||
const require = topLevelCreateRequire(import.meta.url); | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
`.trim(), | ||
}, // Banner for compatibility with CommonJS | ||
}; | ||
|
||
if (isWatching) { | ||
context(buildOptions).then(ctx => { | ||
if (isWatching) { | ||
ctx.watch(); | ||
} else { | ||
ctx.rebuild(); | ||
} | ||
}); | ||
} else { | ||
build(buildOptions) | ||
} |
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,18 @@ | ||
import { FastifyBaseLogger, FastifyInstance } from "fastify"; | ||
|
||
export async function checkPaidMembership( | ||
endpoint: string, | ||
log: FastifyBaseLogger, | ||
netId: string, | ||
) { | ||
const membershipApiPayload = (await ( | ||
await fetch(`${endpoint}?netId=${netId}`) | ||
).json()) as { netId: string; isPaidMember: boolean }; | ||
log.trace(`Got Membership API Payload for ${netId}: ${membershipApiPayload}`); | ||
try { | ||
return membershipApiPayload["isPaidMember"]; | ||
} catch (e: any) { | ||
log.error(`Failed to get response from membership API: ${e.toString()}`); | ||
throw e; | ||
} | ||
} |
Oops, something went wrong.