Closed mgillam closed 1 year ago
If you can create a PR for it, I would be happy to merge it. I don't remember why I had to make it a symlink.
retire.js is kept as javascript in stead of being ported to TypeScript, because it's also used by the chrome extension.
Yep, sounds good. I'll take a bit of time to test it out and verify that it works as I expect, and then will open the PR if it all looks good to me. Thanks!
Maybe a simple copying in the build action in package.json is all that is needed.
I suspect so, will try it shortly.
Is your feature request related to a problem? Please describe. Use of retire.js as a node package (e.g. for use by a node app) isn't really presented as a supported use case (hence why I felt this was more a feature request than a bug), but it looks like it generally should be possible. The issue I've run into is a Typescript app will complain about a lack of type definitions, even though the node module is currently written in TS. Analysis of what's in my app's node_modules shows most of the type definitions are there, it's notably
retire.js
that's missing itsretire.d.ts
counterpart, resulting in the error state.Describe the solution you'd like I pulled down the retire.js repo and copied the
retire.d.ts
into the appropriate directory in my app'snode_modules
subdirectory, and it appeared to solve the behavior noted above. When I ran thebuild
script fromretire.js/node/package.json
, the resulting output hadretire.d.ts
in thelib
directory, but it was a symlink tosrc/retire.d.ts
, my suspicion is that this is the reason it's missing when pushed to NPM. I'm not certain of the reason for this behavior, but I think a solution is to copy thesrc/retire.d.ts
tolib/retire.d.ts
as part of the build script, rather than symlinking. I believe that would make the type definitions complete when the package is installed via npm.Describe alternatives you've considered I've though of a few alternatives, but they all have the shortcoming that updates to retire.js would not be fully available to my app unless I take some manual action.
retire.d.ts
into my app's src directory, so the type definitions are locally available in my project. This doesn't keep the type definitions in step with the actual installed package version though.retire.d.ts
from GitHub directly to my node_modules.Additional context I can probably work out a way to make the proposed solution work, and open a PR for it, but I wanted to check first if that would be appropriate here. I like the
copyfiles
package for copying during the build step, but even acp
command might do the trick here as long as the build environments for this package are always *nix/mac/powershell.