Skip to content

Commit b53c77c

Browse files
committed
fix missing files handler
1 parent 7894fb5 commit b53c77c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Project ###
22
versions.txt
3+
package.json
34

45
### Linux ###
56
*~

wnv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ source "$HOME/.nvm/nvm.sh"
4646
padding=10000
4747
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
4848
version_dir="$script_dir/versions.txt"
49+
50+
if [[ ! -e 'package.json' ]]; then
51+
npm $@
52+
exit 0
53+
fi
54+
4955
engines=$(jq '.engines.node' -r package.json)
5056

5157
# no configuration found dont switch version
@@ -54,6 +60,10 @@ if [ ! -n "$engines" ]; then
5460
exit 0
5561
fi
5662

63+
if [[ ! -e $version_dir ]]; then
64+
NO_CACHE=1
65+
fi
66+
5767
# get engine config from package.json
5868
node_version=($(grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' <<<"$engines"))
5969

0 commit comments

Comments
 (0)