-
Notifications
You must be signed in to change notification settings - Fork 844
chore(benchmarks): renovate, use ESM #2454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Changes from 3 commits
1f85de1
fcb2a50
0bed263
c73996b
398bbb2
654fc93
a4f17cc
79fdf6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,28 +15,26 @@ const pathToLocalCliScript = path.resolve( | |
| './node_modules/react-email/dist/cli/index.js', | ||
| ); | ||
|
|
||
| (async () => { | ||
| const bench = new Bench({ | ||
| iterations: 30, | ||
| }); | ||
| const bench = new Bench({ | ||
| iterations: 30, | ||
| }); | ||
|
|
||
| bench | ||
| .add('startup on local', async () => { | ||
| const server = await runServer(pathToLocalCliScript); | ||
| await fetch(`${server.url}/preview/magic-links/notion-magic-link`); | ||
| server.subprocess.kill(); | ||
| }) | ||
| .add('startup on 2.1.7-canary.2', async () => { | ||
| const server = await runServer(pathToCanaryCliScript); | ||
| await fetch(`${server.url}/preview/magic-links/notion-magic-link`); | ||
| server.subprocess.kill(); | ||
| }); | ||
| bench | ||
| .add('startup on local', async () => { | ||
| const server = await runServer(pathToLocalCliScript); | ||
|
||
| await fetch(`${server.url}/preview/magic-links/notion-magic-link`); | ||
| server.subprocess.kill(); | ||
|
||
| }) | ||
| .add('startup on 2.1.7-canary.2', async () => { | ||
| const server = await runServer(pathToCanaryCliScript); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Subprocess may be left running if fetch throws; wrap server lifecycle in a try/finally so kill() always runs for cleanup. Prompt for AI agents |
||
| await fetch(`${server.url}/preview/magic-links/notion-magic-link`); | ||
| server.subprocess.kill(); | ||
| }); | ||
|
|
||
| await bench.run(); | ||
| await bench.run(); | ||
|
|
||
| await fs.writeFile( | ||
| 'startup-bench-results-30-iterations.json', | ||
| JSON.stringify(bench.results), | ||
| 'utf8', | ||
| ); | ||
| })(); | ||
| await fs.writeFile( | ||
| 'startup-bench-results-30-iterations.json', | ||
| JSON.stringify(bench.results), | ||
| 'utf8', | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,32 +15,30 @@ const pathToLocalCliScript = path.resolve( | |
| './node_modules/react-email/dist/cli/index.js', | ||
| ); | ||
|
|
||
| (async () => { | ||
| const bench = new Bench({ | ||
| iterations: 30, | ||
| const bench = new Bench({ | ||
| iterations: 30, | ||
| }); | ||
|
|
||
| const localServer = await runServer(pathToLocalCliScript); | ||
| const canaryServer = await runServer(pathToCanaryCliScript); | ||
| bench | ||
| .add('local', async () => { | ||
| await fetch(`${localServer.url}/preview/magic-links/notion-magic-link`); | ||
| }) | ||
| .add('2.1.7-canary.2', async () => { | ||
| await fetch(`${canaryServer.url}/preview/magic-links/notion-magic-link`); | ||
| }); | ||
|
|
||
| const localServer = await runServer(pathToLocalCliScript); | ||
| const canaryServer = await runServer(pathToCanaryCliScript); | ||
| bench | ||
| .add('local', async () => { | ||
| await fetch(`${localServer.url}/preview/magic-links/notion-magic-link`); | ||
| }) | ||
| .add('2.1.7-canary.2', async () => { | ||
| await fetch(`${canaryServer.url}/preview/magic-links/notion-magic-link`); | ||
| }); | ||
|
|
||
| await fetch(`${localServer.url}/preview/magic-links/notion-magic-link`); | ||
| await fetch(`${canaryServer.url}/preview/magic-links/notion-magic-link`); | ||
|
|
||
| await bench.run(); | ||
|
|
||
| localServer.subprocess.kill(); | ||
| canaryServer.subprocess.kill(); | ||
|
|
||
| await fs.writeFile( | ||
| 'bench-results-30-iterations.json', | ||
| JSON.stringify(bench.results), | ||
| 'utf8', | ||
| ); | ||
| })(); | ||
| await fetch(`${localServer.url}/preview/magic-links/notion-magic-link`); | ||
| await fetch(`${canaryServer.url}/preview/magic-links/notion-magic-link`); | ||
|
|
||
| await bench.run(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure server subprocesses are terminated via try/finally so they’re killed even if an await (fetch/run/writeFile) throws. Prompt for AI agents |
||
|
|
||
| localServer.subprocess.kill(); | ||
| canaryServer.subprocess.kill(); | ||
|
|
||
| await fs.writeFile( | ||
| 'bench-results-30-iterations.json', | ||
| JSON.stringify(bench.results), | ||
| 'utf8', | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "extends": "tsconfig/react-library.json", | ||
| "include": ["src"], | ||
| "exclude": ["node_modules"], | ||
| "compilerOptions": { | ||
| "target": "esnext", | ||
| "noUncheckedIndexedAccess": true, | ||
| "resolveJsonModule": true, | ||
| "moduleResolution": "bundler", | ||
| "module": "esnext", | ||
| "declarationMap": false, | ||
| "declaration": false, | ||
| "outDir": "dist" | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting type: "module" makes this package ESM, but several scripts use __dirname, which is undefined in ESM. This risks runtime failures when running the benchmark scripts.
Prompt for AI agents