A
A
Alexander Osadchy2020-03-15 00:33:55
npm
Alexander Osadchy, 2020-03-15 00:33:55

How to run a set of npm scripts in a vs code terminal instead of a new cmd window?

I have a package.json file with different commands

{
  "name": "site-webstie-wordpress",
  "version": "1.0.0",
  "scripts": {
    "sitepress-start": "init-site.sh",
    "vp-pull": "docker exec -ti -u www-data wordpressweb wp vp pull",
    "git-commit": "docker exec -ti -u www-data wordpressweb bash",
    "git-push": "docker exec -u www-data wordpressweb git push --set-upstream origin master",
    "lint": "nopenv pre-commit run --all-files",
    "install": "npip install",
    "docker-all-containers": "docker container ls --all",
    "docker-all-images": "docker image ls",
    "docker-all-processes": "docker ps",
    "docker-stats": "docker stats",
    "docker-prune": "docker system prune -f && docker volume prune -f",
    "sitepress-build": "docker build -t sitepress docker-site.com/",
    "wordpressweb-logs": "docker logs wordpressweb",
    "wordpressdb-logs": "docker logs wordpressdb"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*": [
      "nopenv pre-commit run --files"
    ]
  },
  "devDependencies": {
    "gulp-util": "^3.0.8",
    "husky": "^3.0.4",
    "lint-staged": "^9.2.3",
    "nopy": "^0.2.7"
  },
  "python": {
    "dependencies": {
      "pre-commit": ">=1.18"
    }
  }
}


Here, the file that was discussed in this topic is launched - inside it are the same commands
"sitepress-start": "init-site.sh",

But what is strange - if I run the sitepress-start command from the quick launch panel , then it is not executed in the VS-Code Power Shell terminal, but in a new cmd window

5e6d27030dee8673039810.png

At the same time, if I copy all the commands from the init-site.sh file and run them in the VS code terminal, they work fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
7
7GIT, 2020-03-15
@7GIT

In settings.json write the path for your git-bash.exe

"terminal.external.windowsExec": "C:\\Program Files\\Git\\git-bash.exe",
"terminal.explorerKind": "external",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question