nrwl / nx

Smart Monorepos ยท Fast CI
https://nx.dev
MIT License
22.65k stars 2.26k forks source link

NX 19.2 regression on `generatePackageJson` #26522

Open Tirke opened 4 weeks ago

Tirke commented 4 weeks ago

Current Behavior

It's that time of the year again, generated package.json is broken again ๐Ÿ˜„

For one of our service nx 19.2.3 generates that package.json

{
  "name": "service",
  "version": "0.0.1",
  "dependencies": {
    "@anatine/zod-nestjs": "2.0.8",
    "@anatine/zod-openapi": "2.2.1",
    "@fastify/cookie": "9.3.1",
    "@fastify/secure-session": "7.5.1",
    "@fastify/static": "7.0.4",
    "@isaacs/ttlcache": "1.4.1",
    "@liaoliaots/nestjs-redis": "9.0.5",
    "@nestjs/axios": "3.0.2",
    "@nestjs/common": "10.3.9",
    "@nestjs/core": "10.3.9",
    "@nestjs/jwt": "10.2.0",
    "@nestjs/mongoose": "10.0.6",
    "@nestjs/passport": "10.0.3",
    "@nestjs/platform-fastify": "10.3.9",
    "@nestjs/swagger": "7.3.1",
    "@nestjs/terminus": "10.2.3",
    "@nestjs/testing": "10.3.9",
    "@opentelemetry/api": "1.9.0",
    "@opentelemetry/context-async-hooks": "1.25.0",
    "@prisma/client": "5.15.0",
    "agentkeepalive": "4.5.0",
    "axios": "1.7.2",
    "bcryptjs": "2.4.3",
    "brotli": "1.3.3",
    "class-transformer": "0.5.1",
    "class-validator": "0.14.1",
    "client-oauth2": "4.3.3",
    "crypto-random-string": "3.3.1",
    "dd-trace": "5.17.0",
    "dotenv-flow": "4.1.0",
    "dynamoose": "4.0.1",
    "express": "4.19.2",
    "fastify": "4.27.0",
    "fs-extra": "11.2.0",
    "ioredis": "5.4.1",
    "jest-mock-extended": "3.0.7",
    "jsonwebtoken": "9.0.2",
    "jwa": "2.0.0",
    "knex": "3.1.0",
    "launchdarkly-node-server-sdk": "7.0.4",
    "libphonenumber-js": "1.11.3",
    "lodash.merge": "4.6.2",
    "luxon": "3.4.4",
    "mongodb": "6.7.0",
    "mongoose": "8.4.1",
    "nanoid": "3.3.6",
    "ngraph.events": "1.2.2",
    "ngraph.graph": "20.0.1",
    "ngraph.path": "1.5.0",
    "oauth": "0.10.0",
    "object-path": "0.11.8",
    "openid-client": "5.6.5",
    "opossum": "8.1.4",
    "passport": "0.7.0",
    "passport-jwt": "4.0.1",
    "pino": "9.2.0",
    "prisma": "5.15.0",
    "reflect-metadata": "0.2.2",
    "remeda": "2.0.9",
    "rxjs": "7.8.1",
    "tslib": "2.6.3",
    "uuid": "10.0.0",
    "zod": "3.23.8"
  },
  "main": "main.js"
}

Expected Behavior

On 19.1.1 nx generates that package.json

{
  "name": "service",
  "version": "0.0.1",
  "dependencies": {
    "@anatine/zod-nestjs": "2.0.8",
    "@anatine/zod-openapi": "2.2.1",
    "@aws-sdk/client-dynamodb": "3.592.0",
    "@aws-sdk/client-s3": "3.592.0",
    "@aws-sdk/client-secrets-manager": "3.592.0",
    "@aws-sdk/client-sns": "3.592.0",
    "@aws-sdk/client-sqs": "3.592.0",
    "@aws-sdk/lib-dynamodb": "3.592.0",
    "@aws-sdk/s3-request-presigner": "3.592.0",
    "@fastify/cookie": "9.3.1",
    "@fastify/multipart": "8.3.0",
    "@fastify/passport": "2.5.0",
    "@fastify/secure-session": "7.5.1",
    "@fastify/static": "7.0.4",
    "@isaacs/ttlcache": "1.4.1",
    "@liaoliaots/nestjs-redis": "9.0.5",
    "@nestjs/axios": "3.0.2",
    "@nestjs/common": "10.3.9",
    "@nestjs/core": "10.3.9",
    "@nestjs/jwt": "10.2.0",
    "@nestjs/mongoose": "10.0.6",
    "@nestjs/passport": "10.0.3",
    "@nestjs/platform-fastify": "10.3.9",
    "@nestjs/swagger": "7.3.1",
    "@nestjs/terminus": "10.2.3",
    "@opentelemetry/api": "1.9.0",
    "@opentelemetry/context-async-hooks": "1.25.0",
    "@opentelemetry/exporter-metrics-otlp-grpc": "0.52.0",
    "@opentelemetry/exporter-trace-otlp-grpc": "0.52.0",
    "@opentelemetry/resources": "1.25.0",
    "@opentelemetry/sdk-metrics": "1.25.0",
    "@opentelemetry/sdk-node": "0.52.0",
    "@opentelemetry/sdk-trace-base": "1.25.0",
    "@opentelemetry/semantic-conventions": "1.25.0",
    "@prisma/client": "5.15.0",
    "@prisma/instrumentation": "5.15.0",
    "agentkeepalive": "4.5.0",
    "axios": "1.7.2",
    "bcryptjs": "2.4.3",
    "brotli": "1.3.3",
    "class-transformer": "0.5.1",
    "class-validator": "0.14.1",
    "client-oauth2": "4.3.3",
    "crypto-random-string": "3.3.1",
    "dd-trace": "5.17.0",
    "dotenv-flow": "4.1.0",
    "dynamoose": "4.0.1",
    "express": "4.19.2",
    "fastify": "4.27.0",
    "fs-extra": "11.2.0",
    "ioredis": "5.4.1",
    "jsonwebtoken": "9.0.2",
    "jwa": "2.0.0",
    "knex": "3.1.0",
    "launchdarkly-node-server-sdk": "7.0.4",
    "libphonenumber-js": "1.11.3",
    "lodash.merge": "4.6.2",
    "luxon": "3.4.4",
    "mongodb": "6.7.0",
    "mongoose": "8.4.1",
    "nanoid": "3.3.6",
    "ngraph.events": "1.2.2",
    "ngraph.graph": "20.0.1",
    "ngraph.path": "1.5.0",
    "oauth": "0.10.0",
    "object-path": "0.11.8",
    "openid-client": "5.6.5",
    "opossum": "8.1.4",
    "passport": "0.7.0",
    "passport-jwt": "4.0.1",
    "pino": "9.2.0",
    "prisma": "5.15.0",
    "reflect-metadata": "0.2.2",
    "remeda": "2.0.9",
    "rxjs": "7.8.1",
    "tslib": "2.6.3",
    "uuid": "10.0.0",
    "zod": "3.23.8"
  },
  "main": "main.js"
}

GitHub Repo

No response

Steps to Reproduce

  1. Generate a package.json on the new nx version
  2. The package.json is missing quite a lot of dependencies.

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.11.0
OS     : darwin-arm64
pnpm   : 8.15.6

nx (global)        : 19.0.0
nx                 : 19.1.1
@nx/js             : 19.1.1
@nx/jest           : 19.1.1
@nx/eslint         : 19.1.1
@nx/workspace      : 19.1.1
@nx/cypress        : 19.1.1
@nx/esbuild        : 19.1.1
@nx/eslint-plugin  : 19.1.1
@nx/nest           : 19.1.1
@nx/next           : 19.1.1
@nx/node           : 19.1.1
@nx/react          : 19.1.1
@nx/rollup         : 19.1.1
@nx/storybook      : 19.1.1
@nrwl/tao          : 19.0.0
@nx/web            : 19.1.1
@nx/webpack        : 19.1.1
typescript         : 5.4.5
---------------------------------------
The following packages should match the installed version of nx
  - @nrwl/tao@19.0.0

To fix this, run `nx migrate nx@19.1.1`

Failure Logs

No response

Package Manager Version

pnpm --version 8.15.6

Operating System

Additional Information

No response

iwarp commented 3 weeks ago

I've got a similar issue with upgrading to NX19, and it may be related,

I have a package sourced from a URL that is missing when using 19.1.2 or later but is resolved when I move NX back to 19.1.1.

dotrakoun-clearstreet commented 2 weeks ago

redacted, false positive

leosvelperez commented 2 weeks ago

Thanks for reporting this!

Could someone provide a repo where the issue can be reproduced? Multiple things can contribute to issues with this feature, and unfortunately, it's not enough for us to reproduce the issue with only the package.json content.

github-actions[bot] commented 6 days ago

This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! ๐Ÿ™