Skip to content

Instantly share code, notes, and snippets.

@andy51002000
Forked from nweldev/nodejs_installer.ps1
Created August 16, 2017 06:48
Show Gist options
  • Select an option

  • Save andy51002000/b38f6abc918d2e5c8a89b9c5c6154a10 to your computer and use it in GitHub Desktop.

Select an option

Save andy51002000/b38f6abc918d2e5c8a89b9c5c6154a10 to your computer and use it in GitHub Desktop.

Revisions

  1. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -232,7 +232,7 @@ if ($confirmation -eq "y") {
    }

    write-host "starting VSC install ..."
    Start-Process $node_msi -Wait
    Start-Process $vsc_exe -Wait
    write-host "VSC installed !"
    }

  2. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ if ($install_git) {

    $download_git = $TRUE

    if (Test-Path $git_exe)) {
    if (Test-Path $git_exe) {
    $confirmation = read-host "Local git install file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_git = $FALSE
    @@ -196,7 +196,7 @@ if ($eslint_prev_v) {

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_jspm = $FALSE
    $install_eslint = $FALSE
    }
    }

  3. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 15 additions and 9 deletions.
    24 changes: 15 additions & 9 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ if ($install_git) {

    $download_git = $TRUE

    if (-NOT (Test-Path $git_exe)) {
    if (Test-Path $git_exe)) {
    $confirmation = read-host "Local git install file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_git = $FALSE
    @@ -107,7 +107,7 @@ if ($install_node) {

    $download_node = $TRUE

    if (-NOT (Test-Path $node_msi)) {
    if (Test-Path $node_msi) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_node = $FALSE
    @@ -216,7 +216,7 @@ if ($confirmation -eq "y") {

    $download_vsc = $TRUE

    if (-NOT (Test-Path $vsc_exe)) {
    if (Test-Path $vsc_exe) {
    $confirmation = read-host "Local VS Code install file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_vsc = $FALSE
    @@ -242,12 +242,18 @@ write-host "`n----------------------------"
    write-host " system cleaning "
    write-host "----------------------------`n"

    write-host "Deleting the temporary files ..."
    if ($node_msi -and (Test-Path $node_msi)) {
    rm $node_msi
    }
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
    $confirmation = read-host "Delete install files ? [y/N]"
    if ($confirmation -eq "y") {
    if ($node_msi -and (Test-Path $node_msi)) {
    rm $node_msi
    }
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
    }
    if ($vsc_exe -and (Test-Path $vsc_exe)) {
    rm $vsc_exe
    }
    }


    write-host "Done !"
  4. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 48 additions and 38 deletions.
    86 changes: 48 additions & 38 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,11 @@ $git_url = "https://github.com/git-for-windows/git/releases/download/v$git_versi
    # npm packages
    $gulp_version = ">=1.2.2 <1.3.0"

    # extras
    $vsc_exe = "$PSScriptRoot\vsc.exe"
    $vsc_url = "https://go.microsoft.com/fwlink/?LinkID=623230"


    # activate / desactivate any install
    $install_node = $TRUE
    $install_git = $TRUE
    @@ -60,13 +65,25 @@ if ($install_git) {
    $git_exe = "$PSScriptRoot\git-installer.exe"

    write-host "No git version dectected"
    write-host "downloading the git for windows installer"

    $download_git = $TRUE

    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($git_url, $git_exe)
    write-Output "git installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    if (-NOT (Test-Path $git_exe)) {
    $confirmation = read-host "Local git install file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_git = $FALSE
    }
    }

    if ($download_git) {
    write-host "downloading the git for windows installer"

    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($git_url, $git_exe)
    write-Output "git installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    }

    write-host "proceeding with git install ..."
    write-host "running $git_exe"
    @@ -87,15 +104,17 @@ if ($install_node) {

    $filename = "node.msi"
    $node_msi = "$PSScriptRoot\$filename"

    $download_node = $TRUE

    if (Test-Path $node_msi) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it (if not, the file will be deleted) ? [Y/n]"
    if (-NOT (Test-Path $node_msi)) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    rm $node_msi
    $download_node = $FALSE
    }
    }

    if (-NOT (Test-Path $node_msi)) {
    if ($download_node) {
    write-host "[NODE] downloading nodejs install"
    write-host "url : $url"
    $start_time = Get-Date
    @@ -194,33 +213,27 @@ write-host "----------------------------`n"

    $confirmation = read-host "[VSC] Do you want to install VS Code ? [y/N]"
    if ($confirmation -eq "y") {
    $vsc_url = "https://go.microsoft.com/fwlink/?LinkID=623230"
    $vsc_exe = "$PSScriptRoot\vsc.exe"
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($vsc_url, $vsc_exe)
    write-Output "Visual Studio Code installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    write-host "starting VSC install ..."
    Start-Process $vsc_exe -Wait
    write-host "VSC installed !"

    $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
    if (-NOT (Get-Command code -errorAction SilentlyContinue)) {
    $actual_path = [System.Environment]::GetEnvironmentVariable("Path","User")
    $actual_path = "${actual_path};C:\Program Files (x86)\Microsoft VS Code\bin"
    $env:Path = $actual_path
    if (Get-Command code -errorAction SilentlyContinue)) {
    [System.Environment]::SetEnvironmentVariable("Path","$actual_path", "User")

    write-host "Now starting some VSC extensions installs ..."
    code --install-extension dbaeumer.vscode-eslint
    } else {
    write-host "Sorry, we didn't managed to find the VSC code.cmd file in order to install it's extensions. Please, add the VSC bin folder to your path environment variable"
    # TODO

    $download_vsc = $TRUE

    if (-NOT (Test-Path $vsc_exe)) {
    $confirmation = read-host "Local VS Code install file detected. Do you want to use it ? [Y/n]"
    if ($confirmation -eq "n") {
    $download_vsc = $FALSE
    }
    }


    if ($download_vsc) {
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($vsc_url, $vsc_exe)
    write-Output "Visual Studio Code installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    }

    write-host "starting VSC install ..."
    Start-Process $node_msi -Wait
    write-host "VSC installed !"
    }

    ### clean
    @@ -236,8 +249,5 @@ if ($node_msi -and (Test-Path $node_msi)) {
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
    }
    if ($vsc_exe -and (Test-Path $vsc_exe)) {
    rm $vsc_exe
    }

    write-host "Done !"
  5. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 16 additions and 2 deletions.
    18 changes: 16 additions & 2 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -205,8 +205,22 @@ if ($confirmation -eq "y") {
    Start-Process $vsc_exe -Wait
    write-host "VSC installed !"

    write-host "Now starting some VSC extensions installs ..."
    code --install-extension vscode-eslint
    $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
    if (-NOT (Get-Command code -errorAction SilentlyContinue)) {
    $actual_path = [System.Environment]::GetEnvironmentVariable("Path","User")
    $actual_path = "${actual_path};C:\Program Files (x86)\Microsoft VS Code\bin"
    $env:Path = $actual_path
    if (Get-Command code -errorAction SilentlyContinue)) {
    [System.Environment]::SetEnvironmentVariable("Path","$actual_path", "User")

    write-host "Now starting some VSC extensions installs ..."
    code --install-extension dbaeumer.vscode-eslint
    } else {
    write-host "Sorry, we didn't managed to find the VSC code.cmd file in order to install it's extensions. Please, add the VSC bin folder to your path environment variable"
    # TODO
    }
    }

    }

    ### clean
  6. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -204,6 +204,9 @@ if ($confirmation -eq "y") {
    write-host "starting VSC install ..."
    Start-Process $vsc_exe -Wait
    write-host "VSC installed !"

    write-host "Now starting some VSC extensions installs ..."
    code --install-extension vscode-eslint
    }

    ### clean
  7. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -219,5 +219,8 @@ if ($node_msi -and (Test-Path $node_msi)) {
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
    }
    if ($vsc_exe -and (Test-Path $vsc_exe)) {
    rm $vsc_exe
    }

    write-host "Done !"
  8. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -202,7 +202,7 @@ if ($confirmation -eq "y") {
    write-Output "Visual Studio Code installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    write-host "starting VSC install ..."
    Start-Process $node_msi -Wait
    Start-Process $vsc_exe -Wait
    write-host "VSC installed !"
    }

  9. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -186,6 +186,26 @@ if ($install_eslint) {
    npm install --global eslint
    }

    ### extras

    write-host "`n----------------------------"
    write-host " extra tools "
    write-host "----------------------------`n"

    $confirmation = read-host "[VSC] Do you want to install VS Code ? [y/N]"
    if ($confirmation -eq "y") {
    $vsc_url = "https://go.microsoft.com/fwlink/?LinkID=623230"
    $vsc_exe = "$PSScriptRoot\vsc.exe"
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($vsc_url, $vsc_exe)
    write-Output "Visual Studio Code installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    write-host "starting VSC install ..."
    Start-Process $node_msi -Wait
    write-host "VSC installed !"
    }

    ### clean

    write-host "`n----------------------------"
  10. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,7 @@ $install_node = $TRUE
    $install_git = $TRUE
    $install_gulp = $TRUE
    $install_jspm = $TRUE
    $install_eslint = $TRUE

    write-host "`n----------------------------"
    write-host " system requirements checking "
    @@ -165,6 +166,26 @@ if ($install_jspm) {
    npm install --global jspm
    }


    if (Get-Command eslint -errorAction SilentlyContinue) {
    $eslint_prev_v = (eslint -v)
    }

    if ($eslint_prev_v) {
    write-host "[ESLINT] eslint is already installed :"
    write-host $eslint_prev_v

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_jspm = $FALSE
    }
    }

    if ($install_eslint) {
    write-host "Installing eslint globally"
    npm install --global eslint
    }

    ### clean

    write-host "`n----------------------------"
    @@ -173,7 +194,7 @@ write-host "----------------------------`n"

    write-host "Deleting the temporary files ..."
    if ($node_msi -and (Test-Path $node_msi)) {
    # rm $node_msi
    rm $node_msi
    }
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
  11. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -114,6 +114,9 @@ if ($install_node) {

    write-host "[NODE] running $node_msi"
    Start-Process $node_msi -Wait

    $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

    } else {
    write-host "Proceeding with the previously installed nodejs version ..."
    }
  12. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,9 @@ if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent

    ### nodejs version check

    $current_version = (node -v)
    if (Get-Command node -errorAction SilentlyContinue) {
    $current_version = (node -v)
    }

    if ($current_version) {
    write-host "[NODE] nodejs $current_version already installed"
    @@ -47,7 +49,9 @@ write-host "`n"
    ### git install

    if ($install_git) {
    $git_current_version = (git --version)
    if (Get-Command git -errorAction SilentlyContinue) {
    $git_current_version = (git --version)
    }

    if ($git_current_version) {
    write-host "[GIT] $git_current_version detected. Proceeding ..."
    @@ -120,7 +124,9 @@ write-host "`n----------------------------"
    write-host " npm packages installation "
    write-host "----------------------------`n"

    $gulp_prev_v = (gulp -v)
    if (Get-Command gulp -errorAction SilentlyContinue) {
    $gulp_prev_v = (gulp -v)
    }

    if ($gulp_prev_v) {
    write-host "[GULP] Gulp is already installed :"
    @@ -137,7 +143,9 @@ if ($install_gulp) {
    npm install --global gulp-cli@"$gulp_version"
    }

    $jspm_prev_v = (jspm -v)
    if (Get-Command jspm -errorAction SilentlyContinue) {
    $jspm_prev_v = (jspm -v)
    }

    if ($jspm_prev_v) {
    write-host "[JSPM] jspm is already installed :"
    @@ -162,7 +170,7 @@ write-host "----------------------------`n"

    write-host "Deleting the temporary files ..."
    if ($node_msi -and (Test-Path $node_msi)) {
    rm $node_msi
    # rm $node_msi
    }
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
  13. @nlm-pro nlm-pro revised this gist Aug 9, 2016. 1 changed file with 66 additions and 48 deletions.
    114 changes: 66 additions & 48 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -19,63 +19,38 @@ $install_git = $TRUE
    $install_gulp = $TRUE
    $install_jspm = $TRUE

    write-host "`n----------------------------"
    write-host " system requirements checking "
    write-host "----------------------------`n"

    ### require administator rights

    if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    write-Warning "This setup needs admin permissions. Please run this file as admin."
    break
    }

    ### download nodejs msi file
    # warning : if a node.msi file is already present in the current folder, this script will simply use it

    write-host "`n----------------------------"
    write-host " nodejs msi file retrieving "
    write-host "----------------------------`n"

    $filename = "node.msi"
    $node_msi = "$PSScriptRoot\$filename"

    if (Test-Path $node_msi) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it (if not, the file will be deleted) ? [Y/n]"
    if ($confirmation -eq "n") {
    rm $node_msi
    }
    }

    if (-NOT (Test-Path $node_msi)) {
    write-host "downloading nodejs install"
    write-host "url : $url"
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($url, $node_msi)
    write-Output "$filename downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    } else {
    write-host "using the existing node.msi file"
    }

    ### check current node install

    write-host "`n----------------------------"
    write-host " system requirements checking "
    write-host "----------------------------`n"
    ### nodejs version check

    $current_version = (node -v)

    if ($current_version) {
    write-host "nodejs $current_version already installed"
    write-host "[NODE] nodejs $current_version already installed"
    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_node = $FALSE
    }
    }

    write-host "`n"

    ### git install

    if ($install_git) {
    $git_current_version = (git --version)

    if ($git_current_version) {
    write-host "git for windows $git_current_version detected. Proceeding ..."
    write-host "[GIT] $git_current_version detected. Proceeding ..."
    } else {
    $git_exe = "$PSScriptRoot\git-installer.exe"

    @@ -89,30 +64,66 @@ if ($install_git) {
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"

    write-host "proceeding with git install ..."
    start-Process $git_exe -NoNewWindow -Wait
    write-host "running $git_exe"
    start-Process $git_exe -Wait
    write-host "git installation done"
    }
    }


    if ($install_node) {
    if ($install_node) {

    ### download nodejs msi file
    # warning : if a node.msi file is already present in the current folder, this script will simply use it

    write-host "`n----------------------------"
    write-host " nodejs installation "
    write-host "----------------------------`n"
    write-host "`n----------------------------"
    write-host " nodejs msi file retrieving "
    write-host "----------------------------`n"

    $filename = "node.msi"
    $node_msi = "$PSScriptRoot\$filename"

    if (Test-Path $node_msi) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it (if not, the file will be deleted) ? [Y/n]"
    if ($confirmation -eq "n") {
    rm $node_msi
    }
    }

    start-Process $node_msi -NoNewWindow -Wait
    if (-NOT (Test-Path $node_msi)) {
    write-host "[NODE] downloading nodejs install"
    write-host "url : $url"
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($url, $node_msi)
    write-Output "$filename downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    } else {
    write-host "Proceeding with the previously installed nodejs version ..."
    write-host "using the existing node.msi file"
    }

    ### nodejs install

    write-host "`n----------------------------"
    write-host " nodejs installation "
    write-host "----------------------------`n"

    write-host "[NODE] running $node_msi"
    Start-Process $node_msi -Wait
    } else {
    write-host "Proceeding with the previously installed nodejs version ..."
    }

    ### npm packages install

    write-host "`n----------------------------"
    write-host " nodejs packages installation "
    write-host " npm packages installation "
    write-host "----------------------------`n"

    $gulp_prev_v = (gulp -v)

    if ($gulp_prev_v) {
    write-host "Gulp is already installed :"
    write-host "[GULP] Gulp is already installed :"
    write-host $gulp_prev_v

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    @@ -129,7 +140,7 @@ if ($install_gulp) {
    $jspm_prev_v = (jspm -v)

    if ($jspm_prev_v) {
    write-host "jspm is already installed :"
    write-host "[JSPM] jspm is already installed :"
    write-host $jspm_prev_v

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    @@ -143,11 +154,18 @@ if ($install_jspm) {
    npm install --global jspm
    }

    ### clean

    write-host "`n----------------------------"
    write-host " system cleaning "
    write-host "----------------------------`n"

    write-host "Delete the $node_msi file"
    rm $node_msi
    write-host "Deleting the temporary files ..."
    if ($node_msi -and (Test-Path $node_msi)) {
    rm $node_msi
    }
    if ($git_exe -and (Test-Path $git_exe)) {
    rm $git_exe
    }

    write-host "Done !"
  14. @nlm-pro nlm-pro created this gist Aug 9, 2016.
    153 changes: 153 additions & 0 deletions nodejs_installer.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,153 @@
    write-host "`n ## NODEJS INSTALLER ## `n"

    ### CONFIGURATION

    # nodejs
    $version = "4.4.7-x64"
    $url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"

    # git
    $git_version = "2.9.2"
    $git_url = "https://github.com/git-for-windows/git/releases/download/v$git_version.windows.1/Git-$git_version-64-bit.exe"

    # npm packages
    $gulp_version = ">=1.2.2 <1.3.0"

    # activate / desactivate any install
    $install_node = $TRUE
    $install_git = $TRUE
    $install_gulp = $TRUE
    $install_jspm = $TRUE

    ### require administator rights

    if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    write-Warning "This setup needs admin permissions. Please run this file as admin."
    break
    }

    ### download nodejs msi file
    # warning : if a node.msi file is already present in the current folder, this script will simply use it

    write-host "`n----------------------------"
    write-host " nodejs msi file retrieving "
    write-host "----------------------------`n"

    $filename = "node.msi"
    $node_msi = "$PSScriptRoot\$filename"

    if (Test-Path $node_msi) {
    $confirmation = read-host "Local $filename file detected. Do you want to use it (if not, the file will be deleted) ? [Y/n]"
    if ($confirmation -eq "n") {
    rm $node_msi
    }
    }

    if (-NOT (Test-Path $node_msi)) {
    write-host "downloading nodejs install"
    write-host "url : $url"
    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($url, $node_msi)
    write-Output "$filename downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
    } else {
    write-host "using the existing node.msi file"
    }

    ### check current node install

    write-host "`n----------------------------"
    write-host " system requirements checking "
    write-host "----------------------------`n"

    $current_version = (node -v)

    if ($current_version) {
    write-host "nodejs $current_version already installed"
    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_node = $FALSE
    }
    }

    if ($install_git) {
    $git_current_version = (git --version)

    if ($git_current_version) {
    write-host "git for windows $git_current_version detected. Proceeding ..."
    } else {
    $git_exe = "$PSScriptRoot\git-installer.exe"

    write-host "No git version dectected"
    write-host "downloading the git for windows installer"

    $start_time = Get-Date
    $wc = New-Object System.Net.WebClient
    $wc.DownloadFile($git_url, $git_exe)
    write-Output "git installer downloaded"
    write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"

    write-host "proceeding with git install ..."
    start-Process $git_exe -NoNewWindow -Wait
    write-host "git installation done"
    }

    if ($install_node) {

    write-host "`n----------------------------"
    write-host " nodejs installation "
    write-host "----------------------------`n"

    start-Process $node_msi -NoNewWindow -Wait
    } else {
    write-host "Proceeding with the previously installed nodejs version ..."
    }
    }

    write-host "`n----------------------------"
    write-host " nodejs packages installation "
    write-host "----------------------------`n"

    $gulp_prev_v = (gulp -v)

    if ($gulp_prev_v) {
    write-host "Gulp is already installed :"
    write-host $gulp_prev_v

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_gulp = $FALSE
    }
    }

    if ($install_gulp) {
    write-host "Installing gulp-cli"
    npm install --global gulp-cli@"$gulp_version"
    }

    $jspm_prev_v = (jspm -v)

    if ($jspm_prev_v) {
    write-host "jspm is already installed :"
    write-host $jspm_prev_v

    $confirmation = read-host "Are you sure you want to replace this version ? [y/N]"
    if ($confirmation -ne "y") {
    $install_jspm = $FALSE
    }
    }

    if ($install_jspm) {
    write-host "Installing jspm globally"
    npm install --global jspm
    }

    write-host "`n----------------------------"
    write-host " system cleaning "
    write-host "----------------------------`n"

    write-host "Delete the $node_msi file"
    rm $node_msi

    write-host "Done !"