Tuesday, 8 June 2021

How to use system variables in package.json dependencies in my react project?

In my react project, I am trying to install a private package using the git URL. I want to specify a branch name in the URL which will be dynamic.

In the package.json file, when I hardcode the branch name it works fine.

dependencies: {
    ...
    my-package: "git+https://<git-url-of-my-package>#develop",
    ...
}

The problem is when I use the variable, it does not work as expected.

dependencies: {
    ...
    my-package: "git+https://<git-url-of-my-package>#$BRANCH_NAME",
    ...
}

I am not sure here how to pass the branch name dynamically and I need some help in understanding the same.

Note: I don't want to install <my-package> using another npm script. I want to install it with other dependencies using npm-install.

Thanks in advance.



from How to use system variables in package.json dependencies in my react project?

No comments:

Post a Comment