From a49c22958a012f9515ab8fbcec848bad976ad143 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Wed, 13 Jan 2016 18:01:51 -0500 Subject: [PATCH] Switch to Gulp Task Runner --- .vscode/launch.json | 3 +-- .vscode/tasks.json | 32 +++++++++++++++---------- gulpfile.js | 9 +++++++ package.json | 4 +++- src/services/ChildProcess.ts | 44 +++++++++++++++++----------------- src/services/XPathEvaluator.ts | 44 +++++++++++++++++----------------- 6 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 gulpfile.js diff --git a/.vscode/launch.json b/.vscode/launch.json index 9ffb961..76ad4db 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,8 +8,7 @@ "runtimeExecutable": "${execPath}", "args": [ "--extensionDevelopmentPath=${workspaceRoot}" - ], - "preLaunchTask": "tsc" + ] } ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6bf8514..b342ebd 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,15 +1,21 @@ -// Available variables which can be used inside of strings. -// ${workspaceRoot}: the root folder of the team -// ${file}: the current opened file -// ${fileBasename}: the current opened file's basename -// ${fileDirname}: the current opened file's dirname -// ${fileExtname}: the current opened file's extension -// ${cwd}: the current working directory of the spawned process - { - "version": "0.1.0", - "command": "tsc", - "isShellCommand": true, - "showOutput": "silent", - "problemMatcher": "$tsc-watch" + "version": "0.1.0", + "command": "gulp", + "isShellCommand": true, + "args": [ + "--no-color" + ], + "tasks": [ + { + "taskName": "build", + "args": [], + "isBuildCommand": true, + "isWatching": false, + "problemMatcher": [ + "$lessCompile", + "$tsc", + "$jshint" + ] + } + ] } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..b57dcf2 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,9 @@ +var gulp = require('gulp'); + +var shell = require('gulp-shell'); + +gulp.task('compile-typescript', function () { + gulp.src('package.json').pipe(shell('tsc')); +}); + +gulp.task('build', ['compile-typescript']); \ No newline at end of file diff --git a/package.json b/package.json index 02af188..6e2b1df 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,9 @@ ], "devDependencies": { "vscode": "^0.10.7", - "typescript": "^1.6.2" + "typescript": "^1.6.2", + "gulp": "^3.9.0", + "gulp-shell": "^0.5.1" }, "dependencies": { "xmldom": "DotJoshJohnson/xmldom#2794915", diff --git a/src/services/ChildProcess.ts b/src/services/ChildProcess.ts index 6030be0..6991eca 100644 --- a/src/services/ChildProcess.ts +++ b/src/services/ChildProcess.ts @@ -1,23 +1,23 @@ -'use strict'; - -let child_process = require('child_process'); - -export class ChildProcess { - static async spawnAsync(executable: string, args: string[]): Promise { - return new Promise((resolve, reject) => { - - let handle = child_process.spawn(executable, args); - - handle.on('close', (code: string) => { - if (code == '0') { - resolve(); - } - - else { - reject(code); - } - }); - - }); - } +'use strict'; + +let child_process = require('child_process'); + +export class ChildProcess { + static async spawnAsync(executable: string, args: string[]): Promise { + return new Promise((resolve, reject) => { + + let handle = child_process.spawn(executable, args); + + handle.on('close', (code: string) => { + if (code == '0') { + resolve(); + } + + else { + reject(code); + } + }); + + }); + } } \ No newline at end of file diff --git a/src/services/XPathEvaluator.ts b/src/services/XPathEvaluator.ts index e655743..970a8f8 100644 --- a/src/services/XPathEvaluator.ts +++ b/src/services/XPathEvaluator.ts @@ -1,23 +1,23 @@ -'use strict'; - -import * as xpath from 'xpath'; - -let DOMParser = require('xmldom').DOMParser; - -export class XPathEvaluator { - static evaluate(query: string, xml: string): Node[] { - let nodes: Node[] = new Array(); - - let xdoc: Document = new DOMParser().parseFromString(xml, 'text/xml'); - let resolver: xpath.XPathNSResolver = xpath.createNSResolver(xdoc); - let expression: xpath.XPathExpression = xpath.createExpression(query, resolver); - let result: xpath.XPathResult = expression.evaluate(xdoc, xpath.XPathResult.ORDERED_NODE_ITERATOR_TYPE); - - let node: Node; - while (node = result.iterateNext()) { - nodes.push(node); - } - - return nodes; - } +'use strict'; + +import * as xpath from 'xpath'; + +let DOMParser = require('xmldom').DOMParser; + +export class XPathEvaluator { + static evaluate(query: string, xml: string): Node[] { + let nodes: Node[] = new Array(); + + let xdoc: Document = new DOMParser().parseFromString(xml, 'text/xml'); + let resolver: xpath.XPathNSResolver = xpath.createNSResolver(xdoc); + let expression: xpath.XPathExpression = xpath.createExpression(query, resolver); + let result: xpath.XPathResult = expression.evaluate(xdoc, xpath.XPathResult.ORDERED_NODE_ITERATOR_TYPE); + + let node: Node; + while (node = result.iterateNext()) { + nodes.push(node); + } + + return nodes; + } } \ No newline at end of file