ngl icon indicating copy to clipboard operation
ngl copied to clipboard

Include Typescript declarations in published npm package

Open sto3psl opened this issue 3 years ago • 3 comments

I noticed while using ngl in a Typescript project, that the Typescript compiler couldn't find ngls types. After some digging I noticed that the ngl.d.ts file was correctly referenced in package.json but tsc complained.

Then I checked inside the declarations/ folder in my node_modules/ngl only to notice, that the folder didn't exist. This meant types can get generated but they are not published to npm.

To fix this I added declarations to the files field in package.json since only the files defined there will end up published on npm. -> https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files

I'm not familiar with how ngl is published so maybe we need to update some pre publish scripts (?).

sto3psl avatar Feb 22 '21 15:02 sto3psl

Yes, you're right -- I have a pending PR to fix this at least partially. I'm not sure it uses prepublish; I'll have to check.

garyo avatar Feb 25 '21 01:02 garyo

Is it this one #844? Moving declarations to the dist folder works too. Since that fixes the issue too, feel free to close this PR.

sto3psl avatar Feb 25 '21 07:02 sto3psl

@garyo I saw that you merged #844 with the declarations fix. It would be great, if you could publish a new release to npm for people to use. Thanks!

sto3psl avatar Apr 26 '21 09:04 sto3psl