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
feat: add command to render multiple trios in roger
#1471
Conversation
perf: switch from tsx to ts-node
Deploying with Cloudflare Pages
|
± Registry diff
📊 PerformanceKeyNote that each bar component rounds up to the nearest 100ms, so each full bar is an overestimate by up to 400ms.
If a row has only one bar instead of four, that means it's not a trio and the bar just shows the total time spent for that example, again rounded up to the nearest 100ms. Data
|
You can fix the JSON import with this diff: diff --git a/packages/roger/index.ts b/packages/roger/index.ts
index 48303f8b..dc7f6bad 100755
--- a/packages/roger/index.ts
+++ b/packages/roger/index.ts
@@ -22,7 +22,7 @@ import convertHrtime from "convert-hrtime";
import * as fs from "fs";
import { basename, extname, join, resolve } from "path";
import prettier from "prettier";
-// import packageJSON from "./package.json"; // TODO: no supported by node
+import packageJSON from "./package.json" assert { type: "json" };
import { InstanceData } from "./types.js";
import watch from "./watch.js";
@@ -255,7 +255,7 @@ const orderTrio = (unordered: string[]): string[] => {
yargs(hideBin(process.argv))
.scriptName("roger")
// .description("Command-line interface for Penrose.")
- // .version(packageJSON.version) // TODO: not supported by node
+ .version(packageJSON.version)
.command(
"trio [trio..]",
"Generate a diagram from a Penrose trio.",
diff --git a/packages/roger/tsconfig.json b/packages/roger/tsconfig.json
index 5619f878..246bfc65 100644
--- a/packages/roger/tsconfig.json
+++ b/packages/roger/tsconfig.json
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
+ "module": "ESNext",
"noEmit": true,
"noImplicitThis": true,
"resolveJsonModule": true, But did you just mean you don't want to do this right now because it causes the following warning?
|
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.
Looks good to me other than one minor thing, thanks so much Nimo! 🏎️
Co-authored-by: Sam Estep <sam@samestep.com>
Yep precisely to avoid printing out the warnings |
Description
Resolves #1439.
This PR contains 2 strategies to mitigate the
roger
startup time, which is mostly caused by the node runtime.tsx
tots-node --esm --swc
because we observed a 40% speedup when usingts-node
. This will hopefully reduce the cost of a singleroger
run.roger trios [trios..] -o <output-path>
to support batch-rendering multiple trios. This command expects a list of.trio.json
files (the extension is necessary for accurate guessing of the output svg file) and render them to<output-path
.A small thing:
ts-node
prints out a warning for ourpackage.json
import for version printing (see issue). This is a Node problem, but I've disabledroger --version
for now to avoid the noisy output.Examples with steps to reproduce them
In
packages/examples
, runroger trios **/*.trio.json -o out
to render all the trios!Checklist