adding create-data-dir batch file for windows #1162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
This pull request can make installation on Windows much easier. It adds a Windows batch
.bat
file, which is Windows' equivalent of.sh
script in Linux.The only reason that
npm install --global .
fails in Windows is that Windows cannot execute Linux shell script and therefore does not supportenv
command used increate-data-dir
in package.json.After taking a look at create-data-dir.sh, I think all it does is just creating two empty directories. Therefore we can write a
.bat
file to create those directories in Windows. And thenpm install --global .
command will succeed, without needing to create a Linux subsystem.Related issue(s)
Fixes #
Related to #1100
Testing
For testing, I changed the
create-data-dir
command of package.json in my local environment to".\\scripts\\create-data-dir.bat"
. Note that Windows directory separator is\
and has to be escaped in package.json, hence we see the weird-looking\\
.After changing
create-data-dir
command,npm install --global .
ran successfully in Windows Powershell without npm errors:The two empty directories were also successfully created:
Next Step
We could simply update installation instructions to let Windows users know how to change package.json and then run
npm install --global .
. A more advanced/automated solution would be detecting OS then running the corresponding type of script.Thank you for contributing to Nextstrain!