Skip to content

Instantly share code, notes, and snippets.

@dalibormesaric
Created March 25, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalibormesaric/3d9fcab61abc5527a491 to your computer and use it in GitHub Desktop.
Save dalibormesaric/3d9fcab61abc5527a491 to your computer and use it in GitHub Desktop.
Check for git, node, bower and install packages - CLI beginner friendly
@echo off
:: Check if git is installed
@ECHO Looking for git ...
call git --version >nul 2>nul
IF ERRORLEVEL 1 (
@ECHO Please install git from http://git-scm.com/downloads
goto :end_batch
)
call git --version
:: Check for node.js
@ECHO Looking for node.js ...
call npm -v >nul 2>nul
IF ERRORLEVEL 1 (
@ECHO Please install node from https://nodejs.org/
goto :end_batch
)
@<nul set /p = node.js version
call node -v
@<nul set /p = npm version
call npm -v
:: Check if bower is installed
@ECHO Looking for bower ...
call bower -v >nul 2>nul
IF ERRORLEVEL 1 (
@ECHO Please install bower from http://bower.io/
goto :end_batch
)
@<nul set /p = bower version
call bower -v
goto :choice
:choice
set /P c=Would you like to run "npm install --save-dev" and "bower install --save" [Y/N] ?
if /I "%c%" EQU "Y" goto :install
if /I "%c%" EQU "N" goto :end_batch
:install
call npm install --save-dev
call bower install --save
:end_batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment