@@ -90,72 +90,40 @@ if [[ -f ${gitdir}/package.json ]]; then
9090
9191 echo " INFO: Installing npm stuff following package/shrinkwrap details"
9292
93+ if ! hash ${npmcmd} 2> /dev/null; then
94+ echo " ERROR: npm not found in the system. Use .nvmrc OR install it in the PATH"
95+ exit 2
96+ fi
97+
9398 # Always run npm install to keep our npm packages correct
9499 ${npmcmd} --no-color install
95100
96- # Verify there is a grunt executable available, installing if missing
97- gruntcmd=" $( ${npmcmd} bin) " /grunt
98- if [[ ! -f ${gruntcmd} ]]; then
99- echo " WARN: grunt-cli executable not found. Installing everything"
100- ${npmcmd} --no-color --no-save install grunt-cli
101- fi
102- else
103-
104- # Install shifter version if there is not package.json
105- # (this is required for branches < 29_STABLE)
106- shifterinstall=" "
107- shiftercmd=" $( ${npmcmd} bin) " /shifter
108- if [[ ! -f ${shiftercmd} ]]; then
109- echo " WARN: shifter executable not found. Installing it"
110- shifterinstall=1
111- else
112- # Have shifter, look its version matches expected one
113- # Cannot use --version because it's varying (performing calls to verify latest). Use --help instead
114- shiftercurrent=$( ${shiftercmd} --no-color --help | head -1 | cut -d " @" -f2)
115- if [[ " ${shiftercurrent} " != " ${shifterversion} " ]]; then
116- echo " WARN: shifter executable " ${shiftercurrent} " found, " ${shifterversion} " expected. Installing it"
117- shifterinstall=1
118- else
119- # All right, shifter found and version matches
120- echo " INFO: shifter executable (${shifterversion} ) found"
101+ # Verify that grunt-cli is available (locally), installing if missing
102+ if ! ${npmcmd} list --parseable | grep -q grunt-cli; then
103+ # Last chance, look for the binary itself.
104+ if [[ ! -x node_modules/.bin/grunt ]]; then
105+ echo " WARN: grunt binary not found. Installing it now"
106+ ${npmcmd} --no-color --no-save install grunt-cli
121107 fi
122108 fi
123- if [[ -n ${shifterinstall} ]]; then
124- ${npmcmd} --no-color install shifter@${shifterversion}
125- echo " INFO: shifter executable (${shifterversion} ) installed"
126- fi
127109
128- # Install recess version if there is not package.json
129- # (this is required for branches < 29_STABLE)
130- recessinstall=" "
131- recesscmd=" $( ${npmcmd} bin) " /recess
132- if [[ ! -f ${recesscmd} ]]; then
133- echo " WARN: recess executable not found. Installing it"
134- recessinstall=1
135- else
136- # Have recess, look its version matches expected one
137- recesscurrent=$( ${recesscmd} --no-color --version)
138- if [[ " ${recesscurrent} " != " ${recessversion} " ]]; then
139- echo " WARN: recess executable " ${recesscurrent} " found, " ${recessversion} " expected. Installing it"
140- recessinstall=1
141- else
142- # All right, recess found and version matches
143- echo " INFO: recess executable (${recessversion} ) found"
144- fi
145- fi
146- if [[ -n ${recessinstall} ]]; then
147- ${npmcmd} --no-color install recess@${recessversion}
148- echo " INFO: recess executable (${recessversion} ) installed"
110+ # Verify that stylelint-checkstyle-formatter is available (locally), installing if missing
111+ if ! ${npmcmd} list --parseable | grep -q stylelint-checkstyle-formatter; then
112+ echo " WARN: stylelint-checkstyle-formatter package not found. Installing it now"
113+ ${npmcmd} --no-color --no-save install stylelint-checkstyle-formatter
149114 fi
115+ else
116+ echo " ERROR: Something is wrong. Missing package.json"
150117fi
151118
152119# Move back to base directory.
153120cd ${gitdir}
154121
155122# Output information about installed binaries.
156123echo " INFO: Installation ended"
157- echo " INFO: Available binaries @ ${gitdir} "
158- echo " INFO: (Contents of $( $ {npmcmd} bin ) )"
159- for binary in $( ls $( $ {npmcmd} bin ) ) ; do
160- echo " INFO: - Installed ${binary} "
124+ echo " INFO: Installed packages @ $( npm root ) "
125+ echo " INFO: (Contents of ${npmcmd} list --depth=1 )"
126+ for package in $( $ {npmcmd} list --depth=1 --parseable ) ; do
127+ echo " INFO: - Installed $( basename ${package} ) "
161128done
129+ echo " ============== END OF LIST =============="
0 commit comments