tbo47 / dagre-es

The dagrejs library exported as ES modules.
Other
32 stars 14 forks source link

Configure TypeScript #14

Closed remcohaszing closed 1 year ago

remcohaszing commented 1 year ago

My goal was to fix the PriorityQueue import in src/graphlib/alg/dijkstra.js.

I noticed TypeScript was used to generate type definitions, but it wasn’t configured properly. So I decided to fix that, whilst at it. The generated type definitions have been removed. They are now generated while packing.

There were some type errors that were easy to fix, but some require a bit more effort and domain knowledge. The low hanging fruits have been fixed, other issues have been handled using @ts-expect-error comments.

tbo47 commented 1 year ago

Thank you @remcohaszing

tbo47 commented 1 year ago

Do you need a new release @remcohaszing ?

remcohaszing commented 1 year ago

A new relase would be great! The invalid PriorityQueue was causing warnings for me, but somehow not errors.

tbo47 commented 1 year ago

npm run generate_types doesn't work for me. So I can't publish a new version. I won't have the time today to take care of this. Do you mind having a look @remcohaszing ?

remcohaszing commented 1 year ago

I created #16 as a test that the build succeeds. It does, so it must be an issue with your local environment.

Did you use a clean working directory? This should work:

git switch main
git clean -xdf
git fetch
git reset --hard origin/main
npm install
npm pack  # Or npm publish
tbo47 commented 1 year ago

yep, it works https://www.npmjs.com/package/dagre-d3-es?activeTab=versions

I tried to publish the zip file on github but it doesn't have the .d.ts files. Do you know how to fix this? https://github.com/tbo47/dagre-es/releases/tag/7.0.8

remcohaszing commented 1 year ago

You linked the GitHub tags page, which contains links to download the source assets.

It is possible to automate the creation of GitHub releases and attach the built npm package, but that’s not what I did. I added a job to build and upload the GitHub actions artifacts.

You can download the artifacts from the artifacts section on https://github.com/tbo47/dagre-es/actions/runs/4077136227. The npm package is the .tgz file inside that zip. This .tgz file does contain the .d.ts files.