ReactTraining/react-workshop

Windows users with our bash scripts

bradwestfall opened this issue · 1 comments

Currently we have two bash scripts that won't work for PowerShell users.

  • in the package.json postinstall script we do a bash command that copies seed-db.json to db.json
  • If json-server doesn't shut down for any reason, the user won't be able to npm start because the still-open json-server will be occupying port 3333. So we have an error message that suggests running our npm run kill-db, which is a bash script.

For each of these, we need a solution that works for Windows (PowerShell specifically). From what I understand after talking to some Windows users who do lots of JS work, VSCode uses PowerShell by default unless configured otherwise. Also I'm being told that PowerShell users can do all the NPM/Git stuff that bash does so for those who are good at PowerShell and prefer it, it might be difficult to ask them to use something else.

I think we can use: https://github.com/charlesguse/run-script-os
The basic idea is we'd have package.json scripts that look like this:

"kill-db": "...bash script here"
"kill-db:windows": "...powershell script here"

I just can't test it out since I don't have windows. Maybe @cassidoo can?

Closing since we're going in a different direction