'Grabbing Nx root package version into workspace package.json

Besides hardcoding, is there a way/shortcut to programmatically get a matching package & version from the root level package.json? I’m creating a generator that generates a react app and I want the package within this generated react app to match the one in the root level package.json.

Besides hardcoding the version

/proj
  /apps
    /test-app
      package.json    // <--- "antd": "^4.20.3"
  package.json        // <--- "antd": "^4.20.3"


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source