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

[rush] rushx does not support npm environment vars (e.g. npm_package_version) #3520

Open
Woutwo opened this issue Jul 5, 2022 · 2 comments
Labels
effort: medium Needs a somewhat experienced developer help wanted If you're looking to contribute, this issue is a good place to start!
Projects

Comments

@Woutwo
Copy link

Woutwo commented Jul 5, 2022

Summary

I have a create-react-app project with an environment file (.env) that contains the following line:

REACT_APP_VERSION=$npm_package_version

When running npm run start or pnpm run start, the variable gets populated with the correct version number from the package.json. When running rushx start, this does not work. The environment variable stays empty.

Repro steps

Setup a new Rush installation with a single project inside, only containing a package.json with the following contents:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "echo $npm_package_version"
  },
  "author": "",
  "license": "ISC"
}

Then run the following command in that project:

rushx test

Expected result:

$ npm run test
> echo $npm_package_version

1.0.0

Actual result:

$ rushx test
> "echo $npm_package_version"

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? @microsoft/rush@5.71.0
rushVersion from rush.json? 5.74.0
useWorkspaces from rush.json? true
Operating system? Mac Apple Silicon
Would you consider contributing a PR? Yes
Node.js version (node -v)? 18.1.0
@Woutwo Woutwo changed the title rushx does not support npm environment vars (e.g. npm_package_version) [rush] [rush] rushx does not support npm environment vars (e.g. npm_package_version) Jul 5, 2022
@iclanton
Copy link
Member

Yeah this is a missing feature. It'd be awesome if you were interested in putting this together.

@iclanton iclanton added help wanted If you're looking to contribute, this issue is a good place to start! effort: medium Needs a somewhat experienced developer labels Jul 13, 2022
@iclanton iclanton added this to Low priority in Bug Triage Jul 13, 2022
@sophos-rickc
Copy link

sophos-rickc commented Jan 28, 2024

This is an issue for my team. Weuse $npm_config_... variables in some of our package.json scripts. However, this means that the scripts cannot be run using rushx {scriptName}, but instead must be run as npm run {scriptName}. This feels like we're half in and half out with rushjs.

We would really like to see this feature added to Rush.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Needs a somewhat experienced developer help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Status: Low priority
Bug Triage
  
Low priority
Development

No branches or pull requests

3 participants