use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" use namespace="System.IO" use namespace="System.IO.Compression" use namespace="System.Net" default binDir = '${Path.Combine(Directory.GetCurrentDirectory(), "bin")}' -// When updating the node version you need to update the nodeExeSha to match what 'signtool.exe /pa /v node.exe' emits default nodeVer = '0.10.28' default npmVer = '1.4.9' default nodeExeSha = '628FFD6C3577068C00CEC9F6F897F0EC8F5212D9' default nodeInstallDir = '${Path.Combine(binDir, "nodejs")}' default nodeGloballyInstalled = '${TestCommand("node" , "--version")}' var nodeExe = 'node.exe' var npmZip = 'npm-${npmVer}.zip' var nodeDist = 'http://nodejs.org/dist/' var nodeUrl = '${nodeDist}v${nodeVer}/${nodeExe}' var npmUrl = '${nodeDist}npm/${npmZip}' var doInstall = '${!nodeGloballyInstalled && !Directory.Exists(nodeInstallDir)}' var nodeInstallExePath = '${Path.Combine(nodeInstallDir, nodeExe)}' var npmInstallZipPath = '${Path.Combine(nodeInstallDir, npmZip)}' @{ if (doInstall) { Log.Info("Installing nodejs locally"); if (Directory.Exists(nodeInstallDir)) { Directory.Delete(nodeInstallDir, recursive: true); } Directory.CreateDirectory(nodeInstallDir); // Download node var wc = new WebClient(); Log.Info(string.Format("Downloading {0} to {1}", nodeUrl, nodeInstallExePath)); wc.DownloadFile(nodeUrl, nodeInstallExePath); Log.Info(string.Format("Downloading {0} to {1}", npmUrl, npmInstallZipPath)); wc.DownloadFile(npmUrl, npmInstallZipPath); // Unzip npm Log.Info(string.Format("Unzipping npm to {0}", nodeInstallDir)); ZipFile.ExtractToDirectory(npmInstallZipPath, nodeInstallDir); } } verify-authenticode verifyFilePath='${nodeInstallExePath}' expectedHash='${nodeExeSha}' if='doInstall'