diff --git a/BuildReleaseTaskItem/task.json b/BuildReleaseTaskItem/task.json index df62599..927201b 100644 --- a/BuildReleaseTaskItem/task.json +++ b/BuildReleaseTaskItem/task.json @@ -40,7 +40,7 @@ ], "instanceNameFormat": "$fileinputname$", "execution": { - "PowerShell": { + "PowerShell3": { "target": "$(currentDirectory)\\$fileinputname$.ps1", "argumentFormat": "", "workingDirectory": "$(currentDirectory)" diff --git a/BuildReleaseTaskItem/task.ps1 b/BuildReleaseTaskItem/task.ps1 index e1090ef..9ede04a 100644 --- a/BuildReleaseTaskItem/task.ps1 +++ b/BuildReleaseTaskItem/task.ps1 @@ -8,11 +8,14 @@ param( ) Write-Host "Starting $fileinputname$" +Trace-VstsEnteringInvocation $MyInvocation try { } catch { +} finally { + Trace-VstsLeavingInvocation $MyInvocation } Write-Host "Ending $fileinputname$" \ No newline at end of file diff --git a/VSTSBuildTask/ExampleTask/ExampleTask.ps1 b/VSTSBuildTask/ExampleTask/ExampleTask.ps1 index 8814fc7..7f7c93f 100644 --- a/VSTSBuildTask/ExampleTask/ExampleTask.ps1 +++ b/VSTSBuildTask/ExampleTask/ExampleTask.ps1 @@ -8,11 +8,14 @@ param( ) Write-Host "Starting ExampleTask" +Trace-VstsEnteringInvocation $MyInvocation try { } catch { +} finally { + Trace-VstsLeavingInvocation $MyInvocation } Write-Host "Ending ExampleTask" \ No newline at end of file diff --git a/VSTSBuildTask/ExampleTask/task.json b/VSTSBuildTask/ExampleTask/task.json index 73886ab..01fd319 100644 --- a/VSTSBuildTask/ExampleTask/task.json +++ b/VSTSBuildTask/ExampleTask/task.json @@ -40,7 +40,7 @@ ], "instanceNameFormat": "ExampleTask", "execution": { - "PowerShell": { + "PowerShell3": { "target": "$(currentDirectory)\\ExampleTask.ps1", "argumentFormat": "", "workingDirectory": "$(currentDirectory)" diff --git a/VSTSBuildTask/gruntfile.js b/VSTSBuildTask/gruntfile.js index e366fcc..92f0d2b 100644 --- a/VSTSBuildTask/gruntfile.js +++ b/VSTSBuildTask/gruntfile.js @@ -24,7 +24,7 @@ module.exports = function (grunt) { stderr: true }, package: { - command: "tfx extension create --manifest-globs vss-extension.json", + command: "tfx extension create --manifest-globs <%= settings.package.manifestGlobs %>", stdout: true, stderr: true } diff --git a/VSTSBuildTask/package.json b/VSTSBuildTask/package.json index de6ab6b..069b89f 100644 --- a/VSTSBuildTask/package.json +++ b/VSTSBuildTask/package.json @@ -1,13 +1,14 @@ { "devDependencies": { - "grunt": "^0.4.5", - "grunt-contrib-copy": "^0.8.2", - "grunt-contrib-jasmine": "^0.9.2", - "grunt-exec": "^0.4.6", - "jasmine": "^2.4.1", - "tfx-cli": "^0.3.15", - "tsd": "^0.6.5", - "vss-web-extension-sdk": "^1.98.0" + "grunt": "^1.0.0", + "grunt-contrib-copy": "*", + "grunt-contrib-jasmine": "*", + "grunt-exec": "*", + "jasmine": "^2.5.1", + "tfx-cli": "^0.3.30", + "typings": "^1.3.3", + "vss-web-extension-sdk": "^1.98.0", + "vsts-task-sdk": "^0.6.4" }, "name": "", "private": true, diff --git a/VSTSExt/ProjectTemplateTS.vstemplate b/VSTSExt/ProjectTemplateTS.vstemplate index 3e977fd..4a246f5 100644 --- a/VSTSExt/ProjectTemplateTS.vstemplate +++ b/VSTSExt/ProjectTemplateTS.vstemplate @@ -46,6 +46,9 @@ Q.d.ts + + require.d.ts + tsd.d.ts diff --git a/VSTSExt/VSTSExt.csproj b/VSTSExt/VSTSExt.csproj index 7edc0f2..cc01b20 100644 --- a/VSTSExt/VSTSExt.csproj +++ b/VSTSExt/VSTSExt.csproj @@ -110,6 +110,7 @@ + diff --git a/VSTSExt/VSTSExtension.csproj b/VSTSExt/VSTSExtension.csproj index 030480c..f4b3257 100644 --- a/VSTSExt/VSTSExtension.csproj +++ b/VSTSExt/VSTSExtension.csproj @@ -57,6 +57,7 @@ + diff --git a/VSTSExt/gruntfile.js b/VSTSExt/gruntfile.js index c2b6958..ea58fbb 100644 --- a/VSTSExt/gruntfile.js +++ b/VSTSExt/gruntfile.js @@ -9,7 +9,7 @@ module.exports = function (grunt) { settings: grunt.file.readJSON("settings.tfx.json"), exec: { package: { - command: "tfx extension create --manifest-globs vss-extension.json", + command: "tfx extension create --manifest-globs <%= settings.package.manifestGlobs %>", stdout: true, stderr: true }, @@ -19,17 +19,17 @@ module.exports = function (grunt) { stderr: true }, tsdinit:{ - command: "tsd install jquery q knockout", + command: "typings install knockout requirejs", stdout: true, stderr: true }, tsdlink:{ - command: "tsd link", + command: "typings init", stdout: true, stderr: true }, publish: { - command: "tfx extension publish --manifest-globs vss-extension.json --share-with <%= settings.publish.shareWith %> --token <%= settings.publish.token %>", + command: "tfx extension publish --manifest-globs <%= settings.package.manifestGlobs %> --share-with <%= settings.publish.shareWith %> --token <%= settings.publish.token %>", stdout: true, stderr: true } diff --git a/VSTSExt/package.json b/VSTSExt/package.json index de6ab6b..bdcf5c8 100644 --- a/VSTSExt/package.json +++ b/VSTSExt/package.json @@ -1,12 +1,12 @@ { "devDependencies": { - "grunt": "^0.4.5", - "grunt-contrib-copy": "^0.8.2", - "grunt-contrib-jasmine": "^0.9.2", - "grunt-exec": "^0.4.6", - "jasmine": "^2.4.1", - "tfx-cli": "^0.3.15", - "tsd": "^0.6.5", + "grunt": "^1.0.0", + "grunt-contrib-copy": "*", + "grunt-contrib-jasmine": "*", + "grunt-exec": "*", + "jasmine": "^2.5.1", + "tfx-cli": "^0.3.30", + "typings": "^1.3.3", "vss-web-extension-sdk": "^1.98.0" }, "name": "", diff --git a/VSTSExt/typings/requirejs/require.d.ts b/VSTSExt/typings/requirejs/require.d.ts new file mode 100644 index 0000000..c63b351 --- /dev/null +++ b/VSTSExt/typings/requirejs/require.d.ts @@ -0,0 +1,397 @@ +// Type definitions for RequireJS 2.1.20 +// Project: http://requirejs.org/ +// Definitions by: Josh Baldwin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* +require-2.1.8.d.ts may be freely distributed under the MIT license. + +Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/require.d.ts + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. +*/ + +declare module 'module' { + var mod: { + config: () => any; + id: string; + uri: string; + } + export = mod; +} + +interface RequireError extends Error { + + /** + * The error ID that maps to an ID on a web page. + **/ + requireType: string; + + /** + * Required modules. + **/ + requireModules: string[]; + + /** + * The original error, if there is one (might be null). + **/ + originalError: Error; +} + +interface RequireShim { + + /** + * List of dependencies. + **/ + deps?: string[]; + + /** + * Name the module will be exported as. + **/ + exports?: string; + + /** + * Initialize function with all dependcies passed in, + * if the function returns a value then that value is used + * as the module export value instead of the object + * found via the 'exports' string. + * @param dependencies + * @return + **/ + init?: (...dependencies: any[]) => any; +} + +interface RequireConfig { + + // The root path to use for all module lookups. + baseUrl?: string; + + // Path mappings for module names not found directly under + // baseUrl. + paths?: { [key: string]: any; }; + + + // Dictionary of Shim's. + // does not cover case of key->string[] + shim?: { [key: string]: RequireShim; }; + + /** + * For the given module prefix, instead of loading the + * module with the given ID, substitude a different + * module ID. + * + * @example + * requirejs.config({ + * map: { + * 'some/newmodule': { + * 'foo': 'foo1.2' + * }, + * 'some/oldmodule': { + * 'foo': 'foo1.0' + * } + * } + * }); + **/ + map?: { + [id: string]: { + [id: string]: string; + }; + }; + + /** + * Allows pointing multiple module IDs to a module ID that contains a bundle of modules. + * + * @example + * requirejs.config({ + * bundles: { + * 'primary': ['main', 'util', 'text', 'text!template.html'], + * 'secondary': ['text!secondary.html'] + * } + * }); + **/ + bundles?: { [key: string]: string[]; }; + + /** + * AMD configurations, use module.config() to access in + * define() functions + **/ + config?: { [id: string]: {}; }; + + /** + * Configures loading modules from CommonJS packages. + **/ + packages?: {}; + + /** + * The number of seconds to wait before giving up on loading + * a script. The default is 7 seconds. + **/ + waitSeconds?: number; + + /** + * A name to give to a loading context. This allows require.js + * to load multiple versions of modules in a page, as long as + * each top-level require call specifies a unique context string. + **/ + context?: string; + + /** + * An array of dependencies to load. + **/ + deps?: string[]; + + /** + * A function to pass to require that should be require after + * deps have been loaded. + * @param modules + **/ + callback?: (...modules: any[]) => void; + + /** + * If set to true, an error will be thrown if a script loads + * that does not call define() or have shim exports string + * value that can be checked. + **/ + enforceDefine?: boolean; + + /** + * If set to true, document.createElementNS() will be used + * to create script elements. + **/ + xhtml?: boolean; + + /** + * Extra query string arguments appended to URLs that RequireJS + * uses to fetch resources. Most useful to cache bust when + * the browser or server is not configured correctly. + * + * @example + * urlArgs: "bust= + (new Date()).getTime() + **/ + urlArgs?: string; + + /** + * Specify the value for the type="" attribute used for script + * tags inserted into the document by RequireJS. Default is + * "text/javascript". To use Firefox's JavasScript 1.8 + * features, use "text/javascript;version=1.8". + **/ + scriptType?: string; + + /** + * If set to true, skips the data-main attribute scanning done + * to start module loading. Useful if RequireJS is embedded in + * a utility library that may interact with other RequireJS + * library on the page, and the embedded version should not do + * data-main loading. + **/ + skipDataMain?: boolean; + + /** + * Allow extending requirejs to support Subresource Integrity + * (SRI). + **/ + onNodeCreated?: (node: HTMLScriptElement, config: RequireConfig, moduleName: string, url: string) => void; +} + +// todo: not sure what to do with this guy +interface RequireModule { + + /** + * + **/ + config(): {}; + +} + +/** +* +**/ +interface RequireMap { + + /** + * + **/ + prefix: string; + + /** + * + **/ + name: string; + + /** + * + **/ + parentMap: RequireMap; + + /** + * + **/ + url: string; + + /** + * + **/ + originalName: string; + + /** + * + **/ + fullName: string; +} + +interface Require { + + /** + * Configure require.js + **/ + config(config: RequireConfig): Require; + + /** + * CommonJS require call + * @param module Module to load + * @return The loaded module + */ + (module: string): any; + + /** + * Start the main app logic. + * Callback is optional. + * Can alternatively use deps and callback. + * @param modules Required modules to load. + **/ + (modules: string[]): void; + + /** + * @see Require() + * @param ready Called when required modules are ready. + **/ + (modules: string[], ready: Function): void; + + /** + * @see http://requirejs.org/docs/api.html#errbacks + * @param ready Called when required modules are ready. + **/ + (modules: string[], ready: Function, errback: Function): void; + + /** + * Generate URLs from require module + * @param module Module to URL + * @return URL string + **/ + toUrl(module: string): string; + + /** + * Returns true if the module has already been loaded and defined. + * @param module Module to check + **/ + defined(module: string): boolean; + + /** + * Returns true if the module has already been requested or is in the process of loading and should be available at some point. + * @param module Module to check + **/ + specified(module: string): boolean; + + /** + * On Error override + * @param err + **/ + onError(err: RequireError, errback?: (err: RequireError) => void): void; + + /** + * Undefine a module + * @param module Module to undefine. + **/ + undef(module: string): void; + + /** + * Semi-private function, overload in special instance of undef() + **/ + onResourceLoad(context: Object, map: RequireMap, depArray: RequireMap[]): void; +} + +interface RequireDefine { + + /** + * Define Simple Name/Value Pairs + * @param config Dictionary of Named/Value pairs for the config. + **/ + (config: { [key: string]: any; }): void; + + /** + * Define function. + * @param func: The function module. + **/ + (func: () => any): void; + + /** + * Define function with dependencies. + * @param deps List of dependencies module IDs. + * @param ready Callback function when the dependencies are loaded. + * callback param deps module dependencies + * callback return module definition + **/ + (deps: string[], ready: Function): void; + + /** + * Define module with simplified CommonJS wrapper. + * @param ready + * callback require requirejs instance + * callback exports exports object + * callback module module + * callback return module definition + **/ + (ready: (require: Require, exports: { [key: string]: any; }, module: RequireModule) => any): void; + + /** + * Define a module with a name and dependencies. + * @param name The name of the module. + * @param deps List of dependencies module IDs. + * @param ready Callback function when the dependencies are loaded. + * callback deps module dependencies + * callback return module definition + **/ + (name: string, deps: string[], ready: Function): void; + + /** + * Define a module with a name. + * @param name The name of the module. + * @param ready Callback function when the dependencies are loaded. + * callback return module definition + **/ + (name: string, ready: Function): void; + + /** + * Used to allow a clear indicator that a global define function (as needed for script src browser loading) conforms + * to the AMD API, any global define function SHOULD have a property called "amd" whose value is an object. + * This helps avoid conflict with any other existing JavaScript code that could have defined a define() function + * that does not conform to the AMD API. + * define.amd.jQuery is specific to jQuery and indicates that the loader is able to account for multiple version + * of jQuery being loaded simultaneously. + */ + amd: Object; +} + +// Ambient declarations for 'require' and 'define' +declare var requirejs: Require; +declare var require: Require; +declare var define: RequireDefine; \ No newline at end of file diff --git a/VSTSExtensionPackage/ReleaseNotes.txt b/VSTSExtensionPackage/ReleaseNotes.txt index e9a1274..66d9759 100644 --- a/VSTSExtensionPackage/ReleaseNotes.txt +++ b/VSTSExtensionPackage/ReleaseNotes.txt @@ -1,6 +1,7 @@ Release Notes ============= +* Version 2.5: Changed PowerShell execution to PowerShell3 in task.json; included vsts-task-sdk in Build/Release Task template; added Trace-VstsEnteringInvocation and Trace-VstsExitingInvocation to example task PowerShell scripts; added d.ts for RequireJS; updated versions for Grunt, Jasmine (Thanks to David Corbin for testing and Max Knor for update suggestions) * Version 2.4: Added dashboard widget item template * Version 2.3.1: Fixed typo in parameter in gruntfile * Version 2.3: Added support for parameters with gruntfile diff --git a/VSTSExtensionPackage/source.extension.vsixmanifest b/VSTSExtensionPackage/source.extension.vsixmanifest index 5304fd7..82a94d5 100644 --- a/VSTSExtensionPackage/source.extension.vsixmanifest +++ b/VSTSExtensionPackage/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + VSTS Extension Project Templates This extension contains Visual Studio project templates supplying you with everything you need to create a Visual Studio Team Services extension or a custom VSTS build/release task. https://github.com/jgarverick/vsts-ext-proj-templates