bcherny / json-schema-to-typescript

Compile JSON Schema to TypeScript type declarations

Home Page:https://bcherny.github.io/json-schema-to-typescript-browser/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Package lists dev dependencies as dependencies

Radiergummi opened this issue · comments

Your package appears to erroneously have some devDependencies in the dependencies array:

    "@bcherny/json-schema-ref-parser": "10.0.5-fork",
-   "@types/json-schema": "^7.0.11",
-   "@types/lodash": "^4.14.182",
-   "@types/prettier": "^2.6.1",
    "cli-color": "^2.0.2",
    "get-stdin": "^8.0.0",
    "glob": "^7.1.6",
    "glob-promise": "^4.2.2",
    "is-glob": "^4.0.3",
    "lodash": "^4.17.21",
    "minimist": "^1.2.6",
    "mkdirp": "^1.0.4",
    "mz": "^2.7.0",
-   "prettier": "^2.6.2"

I'm pretty confident neither the @types stubs, nor prettier itself belong in the dependencies; I'm not sure about the rest, but they look legit.

This is causing issues in downstream packages that depend on json-schema-to-typescript, where those packages are installed alongside application dependencies -- in my specific case, I'm using prettier 3, but TypeScript insists my Config interface has version 2.6, because it resolves the type to the one in @types/prettier installed from this package:

$ npm why @types/prettier
@types/prettier@2.7.3 dev
  node_modules/@types/prettier
  @types/prettier@"^2.6.1" from json-schema-to-typescript@11.0.5
    node_modules/json-schema-to-typescript
    json-schema-to-typescript@"^11.0.1" from storyblok-generate-ts@2.0.1
      node_modules/storyblok-generate-ts
      dev storyblok-generate-ts@"^2.0.1" from the root project

In conclusion: Could you move those dependencies to the devDependencies where they belong? That would be awesome. Thank you!

These are used for formatting the output, and for describing input types for TypeScript users.

I think you misunderstood me: I am not advocating to remove prettier or the type stubs. Those packages are absolutely valid, but should be moved from the package dependencies to devDependencies, because they are only required when working on your package, but not when installing it as a dependency.

The way it currently is causes problems in other apps.

@Radiergummi prettier is exposed to consuming code, since it is used as part of the output formatting process. Similarly, the @types/... are needed since the types JSONSchema4 and such are re-exported for use by consuming code.

@Radiergummi prettier is exposed to consuming code, since it is used as part of the output formatting process. Similarly, the @types/... are needed since the types JSONSchema4 and such are re-exported for use by consuming code.

Well. That doesn't help too much if I cannot install the package in the first place; maybe they could somehow be made a peer dependency?