56 lines
2.2 KiB
Plaintext
56 lines
2.2 KiB
Plaintext
use namespace="System.Net"
|
|
|
|
var VERSION='0.1'
|
|
var FULL_VERSION='0.1'
|
|
var AUTHORS='Microsoft'
|
|
|
|
use-standard-lifecycle
|
|
k-standard-goals
|
|
|
|
#install-node
|
|
var binDir = '${Path.Combine(Directory.GetCurrentDirectory(), "bin")}'
|
|
var nodeDir = '${Path.Combine(binDir, "node")}'
|
|
|
|
-// Check if node is already installed locally
|
|
var nodeVer = '0.10.28'
|
|
var nodeMsi = 'node-v${nodeVer}-x86.msi'
|
|
var nodeUrl = 'http://nodejs.org/dist/v${nodeVer}/${nodeMsi}'
|
|
var nodeMsiPath = '${Path.Combine(binDir, nodeMsi)}'
|
|
var nodeInstalled = '${Directory.Exists(nodeDir)}'
|
|
@{
|
|
Directory.CreateDirectory(nodeDir);
|
|
if (!nodeInstalled) {
|
|
// Download node installer msi
|
|
var wc = new WebClient();
|
|
wc.DownloadFile(nodeUrl, nodeMsiPath);
|
|
}
|
|
}
|
|
|
|
-// Extract it to local dir using msiexec:
|
|
exec program='msiexec' commandline='/a ${nodeMsiPath} /qb TARGETDIR=${nodeDir}' if='!nodeInstalled'
|
|
|
|
#restore-npm-modules .install-node
|
|
@{
|
|
// Find all dirs that contain a package.json file that aren't installed node modules
|
|
var currentDir = Directory.GetCurrentDirectory();
|
|
var npmCmd = Path.Combine(currentDir, "bin\\node\\nodejs\\npm.cmd");
|
|
var npmDirs = Directory.GetFiles(currentDir, "package.json", SearchOption.AllDirectories)
|
|
.Where(p => p.IndexOf(Path.DirectorySeparatorChar + "node_modules" + Path.DirectorySeparatorChar) < 0)
|
|
.Select(p => Path.GetDirectoryName(p))
|
|
.Distinct();
|
|
}
|
|
|
|
exec program='${npmCmd}' commandline='install' workingdir='${dir}' each='var dir in npmDirs'
|
|
|
|
#run-grunt .restore-npm-modules target='compile'
|
|
@{
|
|
// Find all dirs that contain a gruntfile.js file
|
|
var currentDir = Directory.GetCurrentDirectory();
|
|
var nodeExe = Path.Combine(currentDir, "bin\\node\\nodejs\\node.exe");
|
|
var gruntDirs = Directory.GetFiles(currentDir, "gruntfile.js", SearchOption.AllDirectories)
|
|
.Where(p => p.IndexOf(Path.DirectorySeparatorChar + "node_modules" + Path.DirectorySeparatorChar) < 0)
|
|
.Select(p => Path.GetDirectoryName(p))
|
|
.Distinct();
|
|
}
|
|
|
|
exec program='${nodeExe}' commandline='node_modules\\grunt-cli\\bin\\grunt' workingdir='${dir}' each='var dir in gruntDirs' |