Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package lists dev dependencies as dependencies #561

Closed
Radiergummi opened this issue Nov 28, 2023 · 4 comments
Closed

Package lists dev dependencies as dependencies #561

Radiergummi opened this issue Nov 28, 2023 · 4 comments
Labels

Comments

@Radiergummi
Copy link

Radiergummi commented Nov 28, 2023

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!

@bcherny
Copy link
Owner

bcherny commented Dec 23, 2023

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

@Radiergummi
Copy link
Author

Radiergummi commented Dec 24, 2023

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.

@ncovercash
Copy link

@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
Copy link
Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants