raineorshine / npm-check-updates

Find newer versions of package dependencies than what your package.json allows
Other
9.36k stars 323 forks source link

Doctor mode crashes when contains `workspaces` #1277

Open saiichihashimoto opened 1 year ago

saiichihashimoto commented 1 year ago

Steps to Reproduce

.ncurc:

{
  "doctor": true,
  "peer": true,
  "upgrade": true,
  "verbose": true,
  "root": true,
  "workspaces": true
}

Dependencies:

// package.json
"dependencies": {
    "@manypkg/cli": "0.20.0",
    "@total-typescript/ts-reset": "0.3.7",
    "@trivago/prettier-plugin-sort-imports": "4.1.1",
    "@types/jest": "29.4.0",
    "@types/lodash": "4.14.191",
    "@typescript-eslint/eslint-plugin": "5.54.1",
    "concurrently": "7.6.0",
    "cross-env": "7.0.3",
    "eslint": "8.35.0",
    "eslint-config-airbnb": "19.0.4",
    "eslint-config-prettier": "8.7.0",
    "eslint-plugin-eslint-comments": "3.2.0",
    "eslint-plugin-fp": "2.3.0",
    "eslint-plugin-import": "2.27.5",
    "eslint-plugin-jest": "27.2.1",
    "eslint-plugin-lodash-fp": "2.2.0-a1",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "eslint-plugin-promise": "6.1.1",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "eslint-plugin-typescript-sort-keys": "2.1.0",
    "husky": "8.0.3",
    "is-ci": "3.0.1",
    "jest": "29.5.0",
    "lint-staged": "13.1.2",
    "lodash": "4.17.21",
    "npm-check-updates": "16.7.10",
    "prettier-plugin-sh": "0.12.8",
    "prettier-raw": "github:prettier/prettier#2.8.4",
    "ts-jest": "29.0.5",
    "ts-node": "10.9.1",
    "tsup": "6.6.3",
    "turbo": "1.8.3",
    "typescript": "4.9.5",
    "zod": "3.21.4"
  },

// Workspaces packages some have dependencies, some don't.

Steps:

npx npm-check-updates

Output:

# outputs the usual until...

Test Suites: 20 passed, 20 total
Tests:       1 todo, 419 passed, 420 total
Snapshots:   0 total
Time:        6.809 s, estimated 10 s
Ran all test suites.

✓ Tests pass

Tests failed
Identifying broken dependencies
npm install
npm install --no-save package.json@[object Object]
  ✗ package.json undefined → [object Object]

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "[object Object]" of package "package.json@[object Object]": Tags may not have any characters that encodeURIComponent encodes.
{
  "error": {
    "code": "EINVALIDTAGNAME",
    "summary": "Invalid tag name \"[object Object]\" of package \"package.json@[object Object]\": Tags may not have any characters that encodeURIComponent encodes.",
    "detail": ""
  }
}

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/shayan/.npm/_logs/2023-03-09T02_10_58_886Z-debug-0.log

// Prints this error once per workspace

The weird thing is, it seems to succeed and then fail! I even went into doctor.js and commented out the print and then it worked! I believe it's the same issue as https://github.com/raineorshine/npm-check-updates/issues/1214, where an object is ending up where a string should be.

raineorshine commented 1 year ago

Unfortunately doctor mode does not yet support workspaces. I would love to add this functionality though.

I have added a proper error message for now that informs users that it is not yet supported.

saiichihashimoto commented 1 year ago

ah, gotcha. Is there an issue/task/something I can track to see when it's available?

raineorshine commented 1 year ago

You're lookin' at it 😉