-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm.sh
50 lines (41 loc) · 1.39 KB
/
npm.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# This script configures my Node.js development setup. Note that
# nvm is installed by the Homebrew install script.
#
# Also, I would highly reccomend not installing your Node.js build
# tools, e.g., Grunt, gulp, WebPack, or whatever you use, globally.
# Instead, install these as local devDepdencies on a project-by-project
# basis. Most Node CLIs can be run locally by using the executable file in
# "./node_modules/.bin". For example:
#
# ./node_modules/.bin/webpack --config webpack.local.config.js
#
#install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
if test ! $(which nvm)
then
echo "Installing a stable version of Node..."
# Install the latest stable version of node
nvm install stable
# Switch to the installed version
nvm use node
# Use the stable version of node by default
nvm alias default node
fi
# All `npm install <pkg>` commands will pin to the version that was available at the time you run the command
npm config set save-exact = true
# Globally install with npm
# To list globally installed npm packages and version: npm list -g --depth=0
#
# Some descriptions:
#
# diff-so-fancy — sexy git diffs
# git-recent — Type `git recent` to see your recent local git branches
# git-open — Type `git open` to open the GitHub page or website for a repository
packages=(
yarn
eslint
nodemon
)
npm install -g "${packages[@]}"