Closed niktekusho closed 1 year ago
Explicitly documentation requires continuous updates with the information and there are no way for us to know the changes unless someone open an issue. The main reason is most of the folks do not use this plugin (or even TypeScript).
I am ok with tell the user to check the supported node version in json-schema-to-ts
.
But not explicitly tell we are not supporting node@14
.
Given that the CI are green in both node@12
and node@14
, I believe it is safe to use inside those version for now.
Explicitly documentation requires continuous updates with the information and there are no way for us to know the changes unless someone open an issue. The main reason is most of the folks do not use this plugin (or even TypeScript).
I am ok with tell the user to check the supported node version in
json-schema-to-ts
. But not explicitly tell we are not supportingnode@14
.Given that the CI are green in both
node@12
andnode@14
, I believe it is safe to use inside those version for now.
After your input, I checked again on a freshly created project and I can't seem to find a way to reproduce the issue with node@14
. I'll close this, hoping it will bring some ideas to others who encounter similar issues.
Prerequisites
Issue
Very nice library!
With this issue, I only want to raise a minor awareness issue (which could be addressed by a small doc note or other possibly more "invasive" solutions).
I (and other people from what I've witnessed on Reddit and StackOverflow) found it difficult to understand why the library wasn't working like it was supposed to.
The main problem comes from something other than the code we write but from one's dev environment.
TLDR: a peer dependency requires Node 16, but since it's not enforced by npm (at least not by default), you can run into "silent breakages" when you use an older version of Node (example 14).
You can also experience this issue when cloning this repository and trying to
npm install && npm test
with Node < 16.Reproduction on a small example
Setup environment first (
nvm
required)Basic example:
Project setup:
If you use an older version of Node (example 14 LTS), you might notice the following warnings raised by npm:
And this is where the issue lies: these warnings effectively hinder this lib's ability to function properly since the required dependency is not installed. And since they are warnings, people might not notice them (or, at least, that's what happened to me).
You might ask: what solved it? Just run
nvm use 18
ornvm use 16
(if you usenvm
) and reinstall dependencies.Just FYI:
json-schema-to-ts
that introduced the first requirement on the Node core version (effectively min Node is 16) is https://github.com/ThomasAribart/json-schema-to-ts/commit/688087b0d620d51382c27bafb41979adae74a4d4peerDependencies
allows it: https://github.com/fastify/fastify-type-provider-json-schema-to-ts/blob/c85b14124ab3474e08a7e6d354814425501c26ba/package.json#L31What I propose to acknowledge this issue
package.json
forjson-schema-to-ts
(how? depends on this lib's support policy over Node core versions)