atomicdata-dev / atomic-data-browser

This repo is no longer used! Code is moved to Atomic-Server
https://github.com/atomicdata-dev/atomic-server/issues
MIT License
55 stars 9 forks source link

Prevent transpiled JS issues - minimal node test in CI? #272

Open joepio opened 1 year ago

joepio commented 1 year ago

I just spent a bunch of hours fixing #270, which occured because all the created JS files actually didn't work. I never noticed before, because I only used typescript projects, or used transpilers that resolved modules correctly.

Also, some time ago, I noticed that @tomic/lib didn't work in a NodeJS context, because I used some browser APIs.

I want to prevent these types of issues. I want the CI to fail. I added some tsconfig and eslint rules to help prevent the issues from above, but I feel like an even better solution is to run the compiled JS in a node context and do something simple. EDIT: This won't even have caught this issue, as node correctly resolves these extensions.

Other suggestions are welcome, too!

joepio commented 1 year ago

@Polleps suggested to use pnpm link combines with some minimal example project.

joepio commented 1 year ago

The non-e2e tests are already running in a node context, so basically the only thing I might still want to add is a test for the compiled js code. Maybe this could be something extremely minimal. It should be run as part of the CI. Ideally, updating the version of an NPM package is also a CI action instead of me running CLI commands locally.