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

Yarn production always install devDependencies #7801

Closed
t18n opened this issue Jan 7, 2020 · 4 comments
Closed

Yarn production always install devDependencies #7801

t18n opened this issue Jan 7, 2020 · 4 comments
Labels
cat-bug fixed-in-modern This issue has been fixed / implemented in Yarn 2+.

Comments

@t18n
Copy link

t18n commented Jan 7, 2020

Yarn 1.21.1 and tested with Yarn >1.*

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Yarn keeps installing devDependencies regardless of --prod flag. Tested with --prod, --production, production=true, NODE_ENV=production.
Running npm install --prod=true results the correct node_modules.

If the current behavior is a bug, please provide the steps to reproduce.

  • run yarn install --prod
  • check node_modules and @types or prisma2 folders are there.

What is the expected behavior?

  • run yarn install --prod
  • only install dependencies that listed inside dependencies
{
  "name": "@turbothinh/lambda-graphql-api",
  "scripts": {
    "dev": "source env_dev && ts-node-dev --no-notify --respawn --transpileOnly src/server.ts",
    "test": "yarn generate:test && source env_test && jest",
    "clean:dist": "rm -rf dist",
    "clean:generated": "rm -rf src/graphql/generated",
    "lint": "eslint 'src/**/*.ts'",
    "__db:seed": "ts-node prisma/seed",
    "generate:migration": "yarn prisma2 lift save --name",
    "generate:prisma": "prisma2 generate",
    "generate:nexus": "ts-node --transpile-only -P tsconfig.json src/graphql/schema",
    "__generate": "yarn generate:prisma && yarn generate:nexus"
  },
  "dependencies": {
    "apollo-server-lambda": "^2.9.13",
    "bcryptjs": "2.4.3",
    "dotenv": "^8.2.0",
    "graphql": "^14.5.8",
    "graphql-middleware": "^4.0.2",
    "graphql-shield": "^7.0.7",
    "jsonwebtoken": "8.5.1",
    "nexus": "0.12.0-rc.5",
    "nexus-prisma": "0.6.1",
    "node-fetch": "^2.6.0",
    "winston": "^3.2.1"
  },
  "devDependencies": {
    "@prisma/photon": "^2.0.0-preview019",
    "@babel/core": "^7.7.7",
    "@babel/preset-env": "^7.7.7",
    "@prisma/sdk": "^0.0.105",
    "@types/bcryptjs": "2.4.2",
    "@types/jest": "^24.0.24",
    "@types/jsonwebtoken": "8.3.5",
    "@types/node": "^13.1.2",
    "@types/ws": "6.0.4",
    "@typescript-eslint/eslint-plugin": "^2.11.0",
    "@typescript-eslint/parser": "^2.14.0",
    "apollo-boost": "^0.4.7",
    "apollo-server": "^2.9.13",
    "babel-jest": "^24.9.0",
    "eslint": "^6.7.2",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-config-prettier": "^6.7.0",
    "eslint-plugin-import": "^2.19.1",
    "eslint-plugin-prettier": "^3.1.1",
    "graphql-tag": "^2.10.1",
    "jest": "^24.9.0",
    "prettier": "^1.19.1",
    "prisma2": "^2.0.0-preview019",
    "ts-jest": "^24.2.0",
    "ts-node": "8.5.4",
    "ts-node-dev": "1.0.0-pre.44",
    "typescript": "3.7.3"
  },
  "engines": {
    "node": ">=12"
  }
}

Please mention your node.js, yarn and operating system version.

  • node 12.13.1
  • yarn 1.21.1
  • MacOS Calalina 10.15.12
@t18n
Copy link
Author

t18n commented Jan 7, 2020

Apparently, moving nexus-prisma to devDependencies fixes the problem. Could anyone explain this behavior?

@rally25rs
Copy link
Contributor

Something definitely seems wrong with that 😕
I noticed that it also stops installing prisma2 if you delete the devDependency @prisma/photon

With --verbose it notes that prisma2 is a peerDependency of @prisma/photon but @prisma/photon shouldn't be installed since it is a devDependency anyway.

Also yarn list --prod doesn't list prisma2 at all 🤷‍♂

I'll tag this as a bug...

@killthekitten
Copy link

Seems related to #6373

@merceyz
Copy link
Member

merceyz commented Jan 14, 2021

Closing as fixed in v2 where yarn workspaces focus --production only keeps dependencies

https://yarnpkg.com/getting-started/migration
https://yarnpkg.com/cli/workspaces/focus

@merceyz merceyz closed this as completed Jan 14, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat-bug fixed-in-modern This issue has been fixed / implemented in Yarn 2+.
Projects
None yet
Development

No branches or pull requests

4 participants