unsplash / sum-types-io-ts

io-ts bindings for @unsplash/sum-types.
https://unsplash.github.io/sum-types-io-ts/
MIT License
2 stars 1 forks source link

`MappedType` added #14

Closed mlegenhausen closed 1 year ago

mlegenhausen commented 1 year ago

Add MappedType to allow access to the mapping of getCodecFromPrimitiveMappedNullaryTag after the codec was created.

mlegenhausen commented 1 year ago

I needed to change the eslint rules a little bit as I introduced the first class in the project. This is the io-ts@2 way of defining custom codecs.

mlegenhausen commented 1 year ago

How does releasing work? Do you release? 😅

samhh commented 1 year ago

How does releasing work? Do you release? sweat_smile

Can do! Probably good for everyone to be familiar with the process though. My personal steps:

  1. Create a version commit incrementing the version and adding changelog notes e.g. https://github.com/unsplash/sum-types-io-ts/commit/f635ce0682e9b6368272929e211078a3e9486db4.
  2. Add a tag for that commit. It's not used anywhere but it's good practice and can be useful when working with Git.
  3. Push the commit and the tag.
  4. Run yarn publish. Hit enter at the version prompt as we've already done that ourselves. It should run a build first as per prepublish in the npm manifest. It should finally go through npm auth before publishing from your machine. I think you'll only need the OTP if you have an auth token in a .npmrc.
OliverJAsh commented 1 year ago

Could we use np to automate this? I think it does everything except updating the changelog. In absence of that we should document the process somewhere.

samhh commented 1 year ago

Technically I think none of that is necessary except step four, and even that is one of a few possible approaches to publishing. It's just my personal take on best practices.

OliverJAsh commented 1 year ago

@samhh Coming back to this: without documentation/automation for this, some steps will inevitably be forgotten or handled differently. For example, some tags have a v prefix and some don't.

image
samhh commented 1 year ago

The tag inconsistency is irritating but ultimately unimportant. Missing changelogs matter more, but as far as I can tell that can't really be solved. Tooling produces useless changelogs little better than git log if anything at all, and documentation can be ignored or forgotten about.

Happy to be corrected though np for example doesn't appear to do anything about the changelog issue. If we go the documentation route it should be centralised somewhere (Notion?).