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

Move all @types CLI dependencies from prod to dev list #3371

bahmutov opened this issue Feb 7, 2019 · 8 comments

Move all @types CLI dependencies from prod to dev list #3371

bahmutov opened this issue Feb 7, 2019 · 8 comments


Copy link

@bahmutov bahmutov commented Feb 7, 2019


When we ship Cypress NPM package we include several @types prod dependencies because we want to reference them in our types index.d.ts file.

in cli/package.json

  "dependencies": {
    "@types/blob-util": "1.3.3",
    "@types/bluebird": "3.5.18",
    "@types/chai": "4.0.8",
    "@types/chai-jquery": "1.1.35",
    "@types/jquery": "3.3.6",
    "@types/lodash": "4.14.87",
    "@types/minimatch": "3.0.3",
    "@types/mocha": "2.2.44",
    "@types/sinon": "7.0.0",
    "@types/sinon-chai": "3.2.2"

and in our index.d.ts file we reference these dependencies (and a few local files)

/// <reference path="./blob-util.d.ts" />
/// <reference path="./bluebird.d.ts" />
/// <reference path="./minimatch.d.ts" />
/// <reference path="./moment.d.ts" />

/// <reference types="chai" />
/// <reference types="chai-jquery" />
/// <reference types="jquery" />
/// <reference types="lodash" />
/// <reference types="mocha" />
/// <reference types="moment" />
/// <reference types="sinon" />
/// <reference types="sinon-chai" />

We need these type files because they provide types and documentation for things like Lodash Cypress._ object, but there are a couple of problems

  1. We have duplicates: for example, we depend on @types/blob-util but also have a local file blob-util.d.ts
  2. type dependencies in prod can conflict with user's type dependencies, which seems to the issue in #1227
  3. usually @types is considered a dev dependency, should not be prod


We can move all necessary @types packages from dev to prod dependencies. During building we can copy any necessary files and include them with our CLI code, just like we do for types/blob-util.d.ts

Our distributed index.d.ts thus will only refer to local paths to bring it all together, and all conflicts with the user's @types would be avoided (fingers crossed)

Copy link

@jcreamer898 jcreamer898 commented Feb 28, 2019

It would be great to get this merged. We're seeing very similar issues in our mono-repo where we use Jest already. Simply installing cypress causes all kinds of mayhem...

Would be glad to help test new releases after this is merged!

Copy link

@jennifer-shehane jennifer-shehane commented Feb 28, 2019

@jcreamer898 Thanks! Feel free to pull down this branch and try it out also #3425

Copy link

@jcreamer898 jcreamer898 commented Mar 2, 2019

Oh sweet, will do.

Copy link

@cypress-bot cypress-bot bot commented Mar 5, 2019

The code for this is done in cypress-io/cypress#3425, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Copy link

@avahe-kellenberger avahe-kellenberger commented Mar 7, 2019

According to the proposal, was cypress not intended to install types packages in node_modules/@types?
I saw this which seemed to suggest otherwise, and having @types/chai-jquery installed from cypress is causing conflicts with other types in my project

Copy link
Contributor Author

@bahmutov bahmutov commented Mar 8, 2019

@avahe-kellenberger I am not sure what you are referring to. The CLI package still installs these packages as dev dependencies in this repository, but when it builds NPM package for Cypress users then it will NOT install them. Thus they will no longer conflict with your types. This has been merged into develop branch but has not been released yet.

Copy link

@avahe-kellenberger avahe-kellenberger commented Mar 8, 2019

Oh, I missed that it hasn't been released - Thanks for the info.

Copy link

@cypress-bot cypress-bot bot commented Mar 15, 2019

Released in 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants