danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

[BUG] Transitive Dependency macos-release version does not support MacOS Monterey

Open brandonlenz opened this issue 3 years ago • 4 comments

Describe the bug danger relies on a version of macos-release that does not include Monterey. This causes typescript integrity checks to fail:

Error:  TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at macosRelease (/Users/user/dev/react-uswds/node_modules/macos-release/index.js:26:26)
    at osName (/Users/user/dev/react-uswds/node_modules/os-name/index.js:21:18)
    at getUserAgent (/Users/user/dev/react-uswds/node_modules/@octokit/rest/node_modules/universal-user-agent/dist-node/index.js:11:53)
    at parseOptions (/Users/user/dev/react-uswds/node_modules/@octokit/rest/lib/parse-client-options.js:80:57)
    at new Octokit (/Users/user/dev/react-uswds/node_modules/@octokit/rest/lib/constructor.js:23:31)
    at apiForDSL (/Users/user/dev/react-uswds/node_modules/danger/distribution/runner/jsonToDSL.js:155:15)
    at /Users/user/dev/react-uswds/node_modules/danger/distribution/runner/jsonToDSL.js:84:23
    at step (/Users/user/dev/react-uswds/node_modules/danger/distribution/runner/jsonToDSL.js:52:23)
    at Object.next (/Users/user/dev/react-uswds/node_modules/danger/distribution/runner/jsonToDSL.js:33:53)
    at /Users/user/dev/react-uswds/node_modules/danger/distribution/runner/jsonToDSL.js:27:71

To Reproduce Steps to reproduce the behavior:

  1. Install danger as a dependency to any project
  2. Run yarn why macos-release, and verify danger is the reason that the dependency is installed:
yarn why v1.22.17
[1/4] 🤔  Why do we have the module "macos-release"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
   - "danger#@octokit#rest#universal-user-agent#os-name" depends on it
   - Hoisted from "danger#@octokit#rest#universal-user-agent#os-name#macos-release"
info Disk size without dependencies: "20KB"
info Disk size with unique dependencies: "20KB"
info Disk size with transitive dependencies: "20KB"
info Number of shared dependencies: 0
✨  Done in 0.91s.
  1. Check the node-modules/macos-release/index.js and verify that nameMap does not include Monterey
  2. Note that macos-release has been updated to include monterey

Expected behavior Danger should update the dependency chain starting at @octokit/rest, to use a version of macos-release that includes Mac OS Monterey

Your Environment

software version
danger.js 10.7.1 (latest at time of writing)
node v14.15.3
npm 7.5.4
Operating System Mac OS Monterey

Additional context Let me know if there is anything else you all might find helpful to add. In my case danger runs on a prepush hook: "pre-push": "yarn danger local -b main --failOnErrors"

brandonlenz avatar Jan 03 '22 15:01 brandonlenz

This comes from octokit, I'm open to loosening the the octokit version in here if that's what locks to this version - but it's could be likely that this is specific to your apps lockfile

orta avatar Jan 03 '22 19:01 orta

Having this same issue. The octokit version this is on is using universal-user-agent which relies on that outdated macos-release version. octokit has since removed that package and it has been removed for awhile. Are you able to update the octokit version in this package? @orta

Temporary work-around: Add this to your package.json:

  "overrides": {
    "@octokit/rest": "18.4.0"
  }

@brandonlenz

RealDrewKlayman avatar Jan 12 '22 21:01 RealDrewKlayman

Yep, happy to have the major versions bumped 👍🏻

orta avatar Jan 13 '22 06:01 orta

It looks to me like this issue was resolved with the 11.0.0 release. https://github.com/danger/danger-js/releases/tag/11.0.0

rogeruiz avatar Mar 08 '22 19:03 rogeruiz