-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-node-venv.sh
More file actions
executable file
·37 lines (26 loc) · 959 Bytes
/
build-node-venv.sh
File metadata and controls
executable file
·37 lines (26 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# current folder
cd "${0%/*}"
# check requirements
command -v virtualenv >/dev/null 2>&1 || { echo >&2 "I require virtualenv but it's not installed. See http://docs.python-guide.org/en/latest/dev/virtualenvs/ Aborting."; exit 1; }
# clear env if there
if [ -e "./.venv" ] ; then
# gotcha auto env!
deactivate && rm -rf "./.venv" && deactivate
fi
# clear node_modules if there
if [ -e "./node_modules" ] ; then
rm -rf "./node_modules"
fi
# create node env
virtualenv .venv && source .venv/bin/activate
# Add trusted-host
printf "[global]\nindex-url=http://mirrors.aliyun.com/pypi/simple/\n" >> $VIRTUAL_ENV/pip.conf
printf "[install]\ntrusted-host=mirrors.aliyun.com\n" >> $VIRTUAL_ENV/pip.conf
# add auto env
pip install autoenv && echo "source 'which activate.sh'" >> ~/.bashrc
# pip install nodeenv
pip install nodeenv && nodeenv -p
# running node now
npm config set strict-ssl false
echo "Now go like install some modules!"