Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

cross-env with git tag #206

Closed
BhaveshSGupta opened this issue Aug 13, 2019 · 3 comments
Closed

cross-env with git tag #206

BhaveshSGupta opened this issue Aug 13, 2019 · 3 comments

Comments

@BhaveshSGupta
Copy link

  • cross-env version: ^5.2.0
  • node version: 10.15.0
  • npm (or yarn) version: 6.4.1

Relevant code or config

"make": "cross-env APP_ENV=production cross-env APP_VERSION=`git tag --points-at HEAD` cross-env APP_COMMIT=`git rev-parse HEAD` webpack --config webpack.config.js"

What you did:
When using above code in package.json and running it as npm run-script make

What happened:

Gives below error.
image

Reproduction repository:

Problem description:

Suggested solution:

@jaller94
Copy link

The common patterns seems to be crossenv [declaration] [command] where your command would be another crossenv.
Have you tried an explicit end at the end of each command?

cross-env APP_ENV=production; cross-env APP_VERSION=`git tag --points-at HEAD`; cross-env APP_COMMIT=`git rev-parse HEAD` webpack --config webpack.config.js

Not sure if that will carry on the variables though.
I thought this may be the solution:

"make": "cross-env-shell \"APP_ENV=production cross-env APP_VERSION=`git tag --points-at HEAD` cross-env APP_COMMIT=`git rev-parse HEAD` webpack --config webpack.config.js\"",

@jaller94
Copy link

jaller94 commented Sep 5, 2019

What is the minimal command to reproduce this?

Does this work?

"make": "cross-env APP_VERSION=`git tag --points-at HEAD` echo $APP_VERSION`

@BhaveshSGupta
Copy link
Author

@jaller94, I was able to fix this by you using something like
"make": "cross-env APP_ENV=production cross-env APP_VERSION=\"git tag --points-at HEAD\" cross-env APP_COMMIT=\"git rev-parse HEAD\" webpack --config webpack.config.js"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants