Skip to content

Conversation

@JadedBlueEyes
Copy link

  • Introduces CI
  • Introduces trusted publishing on git tag (need to add the NPM_TOKEN secret though)
  • Introduces build system, makes sure to output typescript files in the correct format
  • Some changes to the package files too
  • TSC files to check the typescript appropriately

Most of this is lifted from my other projects. I haven't been able to test the trusted publishing workflow as I use pnpm, but it should work.

@juice49
Copy link
Owner

juice49 commented Sep 11, 2025

Hey @JadedBlueEyes, thanks so much for contributing. On Bluesky, you mentioned you were having a problem using the packages with verbatimModuleSyntax. Was the main fix here to add the type modifier on exports?

I ran the build process locally and noticed the resulting TypeScript declaration files appear to be the same as the source files, and the resulting ESM & CJS files are empty because there is no runtime code.

In the interest of simplicity, I'm wondering whether the added build steps and CI are strictly necessary at the moment. Would it be possible to reduce the scope of this PR to just the verbatimModuleSyntax related fix?

There may be a gap in my knowledge around shipping types to npm, apologies if so 🙂.

@JadedBlueEyes
Copy link
Author

So the issue was specifically with importing types without using the import type syntax in against .ts files, which certain configurations of typescript don't like. The build step makes sure everything is always purely in .d.ts files, the correct formats etc, and are all correctly type checked - if the types are invalid, tsc will error. The empty cjs and esm files are pretty much artifacts of running tsc like that, but in future if any non-type stuff gets added in future it'll be handled properly for compatibility with both. The config is also pretty simple too.

Everything necessary for that is included in the first commit - JadedBlueEyes@30e7e83 - which is around 150loc changed excluding the lock file.

The CI workflows aren't strictly necessary, but the checks one is useful to know if formatting is correct, and types are valid, etc - and the publish one is needed to do trusted publishing, which shows that no malicious code has been injected before publishing and the code exactly matches what's in git:

Screenshot_20250920-180208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants