Skip to content
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

Quality of Life Improvements for Development and Publication Workflow #14

Merged
merged 10 commits into from
Dec 5, 2024

Conversation

vnphanquang
Copy link
Contributor

@vnphanquang vnphanquang commented Nov 27, 2024

Hello all, this PR adds a handful of things with the hope of improving the dev and publication workflow. Please note:

Note

Everything is just a proposal. Please feel free to reject or comment. I am happy to follow up / drop unwanted changes.

Each commit is well scoped to a particular change so please feel free to review one individual commit at a time. Some notable changes are as follow.

Development Workflow

4f3d621 sets up lefthook (quite fitting as it is also from @evilmartians), and some explicit fmt rules in deno.json. This will help keeping code style consistent going forward.

Versioning & Publication

9c98741 sets up changesets for versioning and automatic publication to NPM. I also added to README a reference for a suggested dev & publication workflow.

Important

The new changesets workflow requires 2 updates to the repo settings:

  1. a NPM_TOKEN repo secret, which might already be there judging by the publish.yml.disabled workflow. Anyway this token requires sufficient permission, i suggest a "classic" token of "Automation" type from NPM settings.
  2. update Workflow permissions to allow read&write and create PR. This can be done at https://github.com/evilmartians/harmony/settings/actions right at the two bottom sections.

Additionally, 1419ab0 sets up package provenance, which should give it a bit more credibility in the npm registry.

Tests

376f9e6 adds a test workflow that triggers by changes to relevant files on push or PR to main. It also uploads code coverage report and test results to Codecov. The project is simple enough for now that I don't think this is strictly necessary, but I figured while I was at it, might as well set it up anyway. Added via f5b7352 is a badge showing code coverage percentage - helpful as a quick glance indicator of project health.

Happy to remove this out if you think it's unnecessary. Just let me know.

Important

If you decide to keep the Codecov upload, the new tests workflow requires a CODECOV_TOKEN which you can get after setting up Codecov for the repo.

Package Exports

290fcd9 adds publint to check against package exports. I also made some changes to the exports, specifically setting package as ESM-first (type: module) since the ecosystem is going that way. Some changes are also based on recommendation from publint: https://publint.dev/@evilmartians/[email protected]

Deno 2

Along the way, especially in 7cd1365, I updated the dependency strategy to utilize Deno 2 support for JSR and Node-compat.

Thanks all.

@11bit
Copy link
Member

11bit commented Nov 29, 2024

Thanks for PR. Overall it looks great! But I'll need some to read it through and setup env vars. It will probably take a couple of days

@vnphanquang
Copy link
Contributor Author

@11bit thanks for checking. Take your time.

@11bit 11bit merged commit 1dd2909 into evilmartians:main Dec 5, 2024
1 check passed
@11bit
Copy link
Member

11bit commented Dec 5, 2024

Thanks @vnphanquang! This is really helpful! The only thing I changed is removing codecov and test matrix for now

@vnphanquang
Copy link
Contributor Author

vnphanquang commented Dec 5, 2024

Excellent @11bit. Thanks a lot. Looks like the changeset worflow is in order.

FYI the "Releases" section isn't switched on for the repo but if that's by choice please ignore my comment.

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