melonjs / melonJS

a fresh, modern & lightweight HTML5 game engine
https://melonjs.org
MIT License
5.93k stars 643 forks source link

npm melonjs package missing type definitions #1166

Closed russellsteadman closed 1 year ago

russellsteadman commented 1 year ago

Describe the bug

The current (14.2.0) version of the melonjs package on npm is missing all typescript definitions except the index.d.ts file at the type root.

To Reproduce

  1. npm i melonjs@latest
  2. cd node_modules/melonjs/dist/types
  3. ls

Or alternatively see the files on npmjs.com.

Expected behavior

TypeScript files from Github repository are present

Version:

obiot commented 1 year ago

indeed, thanks for reporting it !

we did some changes following #1162, going from a single definition file to multiple ones, and I stupidly just forgot to update the package.json file accordingly 🤦

this line : https://github.com/melonjs/melonJS/blob/master/package.json#L42 should be as below instead

  "dist/types/**/*.d.ts",

I'll publish the current 14.3 version with this fix later today.

thanks again!

russellsteadman commented 1 year ago

I think the "files" array should include that wildcard file reference. Otherwise npm does not upload the type definitions when the package is published.

obiot commented 1 year ago

I ended up adding the whole directory directly :

  "files": [
    "dist/melonjs.mjs",
    "dist/melonjs.module.js",
    "dist/types",
    "src/",
    "package.json",
    "README.md",
    "LICENSE",
    "CHANGELOG"
  ]

I did a test publishing (with -dry-run) and it properly included all the .d.ts files.

thanks again for reporting it, I'm just finishing testing all the changes made in this version for any regression, and I'll publish it later today.

obiot commented 1 year ago

14.3.0 published, double checked on my side that all files were correctly included, and all good on my side !