Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tools: add Boxstarter script
Adds a Boxstarter script for easy Node.js building prerequisites installation
  • Loading branch information
bzoz committed Nov 15, 2017
commit 2c7577bc99372e98310d422e4e3f9cc2cf813599
3 changes: 3 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ Prerequisites:
[Git for Windows](http://git-scm.com/download/win) includes Git Bash
and tools which can be included in the global `PATH`.

*Note:* All prerequisites can be easily installed by following
[this Boxstarter guide](https://github.com/nodejs/node/blob/master/tools/boxstarter/README.md).

If the path to your build directory contains a space, the build will likely fail.

```console
Expand Down
54 changes: 54 additions & 0 deletions tools/boxstarter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Boxstarter setup for Node.js

A [Boxstarter][] script can be used for an easy setup of Windows systems with all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe remove an.

the required prerequisites for Node.js development. This script will install
the following [Chocolatey] packages:
* [Git for Windows][] with the `git` and Unix tools added to the `PATH`
* [Python 2.x][]
* [Visual Studio 2017 Build Tools][] with [Visual C++ workload][]
* Optionally: [Visual Studio Code][] e.g. when setting up Code and Learn boxes

## WebLauncher Installation

To install Node.js prerequisites using [Boxstarter WebLauncher][], just open
**one** of the following links with Internet Explorer or Edge browser on the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does it need to be just those two browsers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a "Click Once" app (https://msdn.microsoft.com/en-us/library/t71a733d.aspx). It works in IE and Edge by default, other browsers need a plugin.

target machine:
* [Node.js prerequisites][]
* [Node.js prerequisites with VS Code][]

## PowerShell Installation

To install the Node.js prerequisites using PowerShell, first install Boxstarter:

* From PowerShell v2 (Windows 7, Windows Server 2008):
```console
iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1')); get-boxstarter -Force
```

* From PowerShell v3 (newer Windows systems):
```console
. { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
```

After Boxstarter has been successfully installed, run:

* For Node.js prerequisites:
```console
Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter -DisableReboots
```

* For Node.js prerequisites with VS Code:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need this?

```console
Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter_vscode -DisableReboots
```

[Boxstarter]: http://boxstarter.org/
[Boxstarter WebLauncher]: http://boxstarter.org/WebLauncher
[Chocolatey]: https://chocolatey.org/
[Git for Windows]: https://chocolatey.org/packages/git
[Python 2.x]: https://chocolatey.org/packages/python2
[Visual Studio 2017 Build Tools]: https://chocolatey.org/packages/visualstudio2017buildtools
[Visual C++ workload]: https://chocolatey.org/packages/visualstudio2017-workload-vctools
[Visual Studio Code]: https://chocolatey.org/packages/visualstudiocode
[Node.js prerequisites]: http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter
[Node.js prerequisites with VS Code]: http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter_vscode
21 changes: 21 additions & 0 deletions tools/boxstarter/node_boxstarter
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Boxstarter (http://boxstarter.org/) script for Node.js prerequisites
#
# To install either open this link in IE or Edge:
# http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter
#
# Or run those commands in a Powershell terminal:
# iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1'))
# get-boxstarter -Force
# Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter -DisableReboots
#
# For more detail see
# https://github.com/nodejs/node/blob/master/tools/boxstarter/README.md
#

# Git and Unix tools will be added to the PATH
choco install git -params /GitAndUnixToolsOnPath -y
choco install python2 -y

# Installs VS 2017 Build Tools
choco install visualstudio2017buildtools -y
choco install visualstudio2017-workload-vctools -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of using Boxstarter here rather than just using chocolatey directly? Is it the web url?

Looking at their page, I'm not seeing anything obviously beneficial, and it's another thing for new starters to understand.

:: Copied from chocolatey website
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

choco install git -params /GitAndUnixToolsOnPath -y
choco install python2 visualstudio2017buildtools visualstudio2017-workload-vctools -y

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a more generic directory name like tools/bootstrap/ and then iterate over recipes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an improvement either way, but I'd go with boxstarter rather than just chocolatey. For users that want to understand this or already know about chocolatey, the script is very easy to understand and use as a guide for their own custom installation (plus, dependencies are already documented in BUILDING.md).

Looking at the Boxstarter page, it adds a lot of resilience to the process (reboots, disabling updates, etc), moving it much closer to the ideal one-click-no-issues setup.

25 changes: 25 additions & 0 deletions tools/boxstarter/node_boxstarter_vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Boxstarter (http://boxstarter.org/) script for Node.js prerequisites,
# including Visual Studio Code
#
# To install either open this link in IE or Edge:
# http://boxstarter.org/package/nr/url?https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter_vscode
#
# Or run those commands in a Powershell terminal:
# iex ((New-Object System.Net.WebClient).DownloadString('http://boxstarter.org/bootstrapper.ps1'))
# get-boxstarter -Force
# Install-BoxstarterPackage https://raw.githubusercontent.com/nodejs/node/master/tools/boxstarter/node_boxstarter_vscode -DisableReboots
#
# For more detail see
# https://github.com/nodejs/node/blob/master/tools/boxstarter/README.md
#

# Git and Unix tools will be added to the PATH
choco install git -params /GitAndUnixToolsOnPath -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer it if we didn't install the editor as well - most people being onboarded have their own preference for an editor.

choco install python2 -y

# Installs VS 2017 Build Tools
choco install visualstudio2017buildtools -y
choco install visualstudio2017-workload-vctools -y

# Installs Visual Studio Code
choco install visualstudiocode -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to not installing an editor, especially if it means duplicating the whole script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating the script, we could just check if an environment variable is set indicating whether an editor should be installed? (not advocating one way or the other but just pointing out that we likely don't need to duplicate the whole script)