prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey

some fixes

Tyler db9b7aff 15c93be1

+16 -7
+1 -1
.github/workflows/ci.yml
··· 41 steps: 42 - uses: actions/checkout@v4 43 - uses: ./.github/actions/prepare 44 - - run: pnpm test:bench 45 46 name: CI 47
··· 41 steps: 42 - uses: actions/checkout@v4 43 - uses: ./.github/actions/prepare 44 + - run: pnpm -F prototypey test:bench 45 46 name: CI 47
+13 -4
packages/cli/tests/commands/gen-inferred.test.ts
··· 74 expect(content).toContain('with { type: "json" }'); 75 expect(content).toContain("export type Profile = Infer<typeof schema>"); 76 expect(content).toContain("export const ProfileSchema = schema"); 77 - expect(content).toContain("export function isProfile(v: unknown): v is Profile"); 78 expect(content).toContain('v.$type === "app.bsky.actor.profile"'); 79 }); 80 ··· 275 ); 276 277 // Run with array of patterns 278 - await genInferred(outDir, [`${schemasDir1}/*.json`, `${schemasDir2}/*.json`]); 279 280 // Verify both were generated 281 const oneContent = await readFile(join(outDir, "app/one.ts"), "utf-8"); ··· 319 expect(content).toContain('import type { Infer } from "prototypey"'); 320 expect(content).toContain("export type Complete = Infer<typeof schema>"); 321 expect(content).toContain("export const CompleteSchema = schema"); 322 - expect(content).toContain("export function isComplete(v: unknown): v is Complete"); 323 324 // Check type guard implementation 325 expect(content).toContain('typeof v === "object"'); ··· 330 // Check comments 331 expect(content).toContain("// Generated by prototypey - DO NOT EDIT"); 332 expect(content).toContain("// Source: app.test.complete"); 333 - expect(content).toContain("* Type-inferred from lexicon schema: app.test.complete"); 334 expect(content).toContain("* The lexicon schema object"); 335 expect(content).toContain("* Type guard to check if a value is a Complete"); 336 });
··· 74 expect(content).toContain('with { type: "json" }'); 75 expect(content).toContain("export type Profile = Infer<typeof schema>"); 76 expect(content).toContain("export const ProfileSchema = schema"); 77 + expect(content).toContain( 78 + "export function isProfile(v: unknown): v is Profile", 79 + ); 80 expect(content).toContain('v.$type === "app.bsky.actor.profile"'); 81 }); 82 ··· 277 ); 278 279 // Run with array of patterns 280 + await genInferred(outDir, [ 281 + `${schemasDir1}/*.json`, 282 + `${schemasDir2}/*.json`, 283 + ]); 284 285 // Verify both were generated 286 const oneContent = await readFile(join(outDir, "app/one.ts"), "utf-8"); ··· 324 expect(content).toContain('import type { Infer } from "prototypey"'); 325 expect(content).toContain("export type Complete = Infer<typeof schema>"); 326 expect(content).toContain("export const CompleteSchema = schema"); 327 + expect(content).toContain( 328 + "export function isComplete(v: unknown): v is Complete", 329 + ); 330 331 // Check type guard implementation 332 expect(content).toContain('typeof v === "object"'); ··· 337 // Check comments 338 expect(content).toContain("// Generated by prototypey - DO NOT EDIT"); 339 expect(content).toContain("// Source: app.test.complete"); 340 + expect(content).toContain( 341 + "* Type-inferred from lexicon schema: app.test.complete", 342 + ); 343 expect(content).toContain("* The lexicon schema object"); 344 expect(content).toContain("* Type guard to check if a value is a Complete"); 345 });
+1 -1
packages/prototypey/tests/infer.bench.ts
··· 9 }), 10 }); 11 return schema.infer; 12 - }).types([899, "instantiations"]); 13 14 bench("infer with complex nested structure", () => { 15 const schema = lx.namespace("test.complex", {
··· 9 }), 10 }); 11 return schema.infer; 12 + }).types([741, "instantiations"]); 13 14 bench("infer with complex nested structure", () => { 15 const schema = lx.namespace("test.complex", {
+1 -1
pnpm-workspace.yaml
··· 1 packages: 2 - - 'packages/*'
··· 1 packages: 2 + - "packages/*"