prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

fix(cli): load models in a deterministic order (alphabetical by ID) #9

Closed angeloashmore closed 2 years ago

angeloashmore commented 2 years ago

Types of changes

Description

This PR ensures types output generated by the prismic-ts-codegen CLI are deterministic. It does this by sorting all models alphabetically using their IDs.

Custom Type models and Shared Slice models are grouped and sorted separately.

Note: This change only affects the CLI and does not change the behavior of programmatic usage via generateTypes(). generateTypes() will output types in the exact order they are given.

Fixes: #8

(Tests have not been written for the CLI, thus no tests have been updated as part of this PR.)

Checklist:

codecov-commenter commented 2 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@0953400). Click here to learn what that means. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main       #9   +/-   ##
=======================================
  Coverage        ?   95.42%           
=======================================
  Files           ?       20           
  Lines           ?      306           
  Branches        ?       62           
=======================================
  Hits            ?      292           
  Misses          ?        2           
  Partials        ?       12           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0953400...2e5674b. Read the comment docs.

github-actions[bot] commented 2 years ago

size-limit report 📦

Path Size
dist/index.js 1.05 MB (0%)
dist/index.cjs 1.06 MB (0%)