kentcdodds / cross-env

πŸ”€ Cross platform setting of environment scripts

Home Page:https://www.npmjs.com/package/cross-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is Tilde Expansion (as in Bash) supported by the tool?

lamyergeier opened this issue Β· comments

I want to set Env. variable as Format=~/bin/Format. Can I do it as follows:

{
  "scripts": {
    "parentScript": "cross-env Format=\"~/Format\" npm run childScript",
  }
}

Actually, I am not sure if the tilde expansion still works. How can I confirm that the tilde expansion works?

I tried to test as follows (with okonet/lint-staged: πŸš«πŸ’© β€” Run linters on git staged files):

{
  "linters": {
    "*.md": [
      "cross-env qPre=~/\"opt/bin/qPreProcess\" echo ${qPre} > ~/Test1",
      "cross-env qPre=\"${HOME}/opt/bin/qPreProcess\" echo ${qPre} > ${HOME}/Test2",
      "cross-env qPre=\"/home/nikhil/opt/bin/qPreProcess\" echo ${qPre} > /home/nikhil/Test3"
  ]
}

But, none of the Test1, Test2 or Test3 gets generated.

Hi @anishmittal2020,

It's not a supported feature. And there's no plan to support it. Sorry.

@kentcdodds Is ${HOME} supported?

Also, nothing happens for this as well:

{
  "linters": {
    "*.md": [
      "cross-env qPre=\"/home/nikhil/opt/bin/qPreProcess\" echo ${qPre} > /home/nikhil/Test3"
  ]
}