diff --git a/ci/powershell/publish-job.yml b/ci/powershell/publish-job.yml new file mode 100644 index 000000000..687008aab --- /dev/null +++ b/ci/powershell/publish-job.yml @@ -0,0 +1,23 @@ +jobs: + - job: Publish + displayName: Publish SDK to PowerShell gallery + pool: + vmImage: windows-2022 + steps: + - powershell: | + Install-Module -Name Microsoft.PowerShell.PSResourceGet -Verbose + displayName: Install new publish cmdlets + + - powershell: | + $publishOptions = @{ + Path = './VstsTaskSdk' + ApiKey = $env:API_KEY + Repository = 'PSGallery' + Verbose = $true + } + Publish-PSResource @publishOptions + + displayName: Publish to gallery + workingDirectory: powershell/_build + env: + API_KEY: $(PSGalleryApiKey) diff --git a/node/CHANGELOG.md b/node/CHANGELOG.md index 6dfd4d457..89364fd2c 100644 --- a/node/CHANGELOG.md +++ b/node/CHANGELOG.md @@ -48,3 +48,11 @@ Backported from ver.`3.4.0`: ## 4.4.0 - Add `getBoolFeatureFlag` [#936](https://github.com/microsoft/azure-pipelines-task-lib/pull/936) + +## 4.6.0 + +- Replaced deprecated "sync-request" lib and Added new Async methods - [#932](https://github.com/microsoft/azure-pipelines-task-lib/pull/932) + +## 5.0.0-preview.0 + +- [Mockery replacement] - Replaced mockery with similar adapter - [#968](https://github.com/microsoft/azure-pipelines-task-lib/pull/968) \ No newline at end of file diff --git a/node/ThirdPartyNotice.txt b/node/ThirdPartyNotice.txt index ddde2acda..7c6354f41 100644 --- a/node/ThirdPartyNotice.txt +++ b/node/ThirdPartyNotice.txt @@ -36,7 +36,7 @@ This Azure Pipelines extension (azure-pipelines-task-lib) is based on or incorpo 30. semver (git+https://github.com/npm/node-semver.git) 31. shelljs (git://github.com/arturadib/shelljs.git) 32. string_decoder (git://github.com/rvagg/string_decoder.git) -33. sync-request (git+https://github.com/ForbesLindesay/sync-request.git) +33. nodejs-file-downloader (git://github.com/ibrod83/nodejs-file-downloader.git) 34. then-request (git+https://github.com/then/then-request.git) 35. typedarray (git://github.com/substack/typedarray.git) 36. typescript (git+https://github.com/Microsoft/TypeScript.git) @@ -889,7 +889,8 @@ IN THE SOFTWARE. ========================================= END OF string_decoder NOTICES, INFORMATION, AND LICENSE -%% sync-request NOTICES, INFORMATION, AND LICENSE BEGIN HERE + +%% nodejs-file-downloader NOTICES, INFORMATION, AND LICENSE BEGIN HERE ========================================= Copyright (c) 2014 Forbes Lindesay @@ -911,7 +912,8 @@ 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. ========================================= -END OF sync-request NOTICES, INFORMATION, AND LICENSE +END OF nodejs-file-downloader NOTICES, INFORMATION, AND LICENSE + %% then-request NOTICES, INFORMATION, AND LICENSE BEGIN HERE ========================================= diff --git a/node/buildutils.js b/node/buildutils.js index 1ecd94bbe..343438de7 100644 --- a/node/buildutils.js +++ b/node/buildutils.js @@ -4,12 +4,13 @@ var fs = require('fs'); var os = require('os'); var path = require('path'); var process = require('process'); -var syncRequest = require('sync-request'); +var admZip = require('adm-zip'); +const Downloader = require("nodejs-file-downloader"); var downloadPath = path.join(__dirname, '_download'); var testPath = path.join(__dirname, '_test'); -exports.run = function(cl) { +var run = function (cl) { console.log('> ' + cl); var rc = exec(cl).code; if (rc !== 0) { @@ -17,9 +18,9 @@ exports.run = function(cl) { exit(rc); } } -var run = exports.run; +exports.run = run; -exports.getExternals = function () { +const getExternalsAsync = async () => { if (process.env['TF_BUILD']) { // skip adding node 5.10.1 to the PATH. the CI definition tests against node 5 and 6. return; @@ -38,16 +39,19 @@ exports.getExternals = function () { var nodeVersion = 'v16.13.0'; switch (platform) { case 'darwin': - var nodeArchivePath = downloadArchive(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz'); + var nodeArchivePath = await downloadArchiveAsync(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz'); addPath(path.join(nodeArchivePath, 'node-' + nodeVersion + '-darwin-x64', 'bin')); break; case 'linux': - var nodeArchivePath = downloadArchive(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-linux-x64.tar.gz'); + var nodeArchivePath = await downloadArchiveAsync(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-linux-x64.tar.gz'); addPath(path.join(nodeArchivePath, 'node-' + nodeVersion + '-linux-x64', 'bin')); break; case 'win32': - var nodeExePath = downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe'); - var nodeLibPath = downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib'); + var [nodeExePath, nodeLibPath] = await Promise.all([ + downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe'), + downloadFileAsync(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib') + ]); + var nodeDirectory = path.join(testPath, 'node'); mkdir('-p', nodeDirectory); cp(nodeExePath, path.join(nodeDirectory, 'node.exe')); @@ -57,83 +61,84 @@ exports.getExternals = function () { } } -var downloadFile = function (url) { +exports.getExternalsAsync = getExternalsAsync + + +var downloadFileAsync = async function (url, fileName) { // validate parameters if (!url) { throw new Error('Parameter "url" must be set.'); } - // short-circuit if already downloaded + // skip if already downloaded var scrubbedUrl = url.replace(/[/\:?]/g, '_'); - var targetPath = path.join(downloadPath, 'file', scrubbedUrl); + if (fileName === undefined) { + fileName = scrubbedUrl; + } + var targetPath = path.join(downloadPath, 'file', fileName); var marker = targetPath + '.completed'; - if (!test('-f', marker)) { - console.log('Downloading file: ' + url); + if (test('-f', marker)) { + console.log('File already exists: ' + targetPath); + return targetPath; + } - // delete any previous partial attempt - if (test('-f', targetPath)) { - rm('-f', targetPath); - } + console.log('Downloading file: ' + url); + // delete any previous partial attempt + if (test('-f', targetPath)) { + rm('-f', targetPath); + } - // download the file - mkdir('-p', path.join(downloadPath, 'file')); - var result = syncRequest('GET', url); - fs.writeFileSync(targetPath, result.getBody()); + // download the file + mkdir('-p', path.join(downloadPath, 'file')); - // write the completed marker - fs.writeFileSync(marker, ''); - } + const downloader = new Downloader({ + url: url, + directory: path.join(downloadPath, 'file'), + fileName: fileName + }); - return targetPath; -} + const { filePath } = await downloader.download(); // Downloader.download() resolves with some useful properties. + fs.writeFileSync(marker, ''); + return filePath; +}; -var downloadArchive = function (url) { - // validate platform - var platform = os.platform(); - if (platform != 'darwin' && platform != 'linux') { - throw new Error('Unexpected platform: ' + platform); - } - // validate parameters +var downloadArchiveAsync = async function (url, fileName) { if (!url) { throw new Error('Parameter "url" must be set.'); } - if (!url.match(/\.tar\.gz$/)) { - throw new Error('Expected .tar.gz'); + // skip if already downloaded and extracted + var scrubbedUrl = url.replace(/[\/\\:?]/g, '_'); + if (fileName !== undefined) { + scrubbedUrl = fileName; } - - // short-circuit if already downloaded and extracted - var scrubbedUrl = url.replace(/[/\:?]/g, '_'); var targetPath = path.join(downloadPath, 'archive', scrubbedUrl); var marker = targetPath + '.completed'; - if (!test('-f', marker)) { - // download the archive - var archivePath = downloadFile(url); - console.log('Extracting archive: ' + url); - - // delete any previously attempted extraction directory - if (test('-d', targetPath)) { - rm('-rf', targetPath); - } - - // extract - mkdir('-p', targetPath); - var cwd = process.cwd(); - process.chdir(targetPath); - try { - run('tar -xzf "' + archivePath + '"'); - } - finally { - process.chdir(cwd); - } - - // write the completed marker - fs.writeFileSync(marker, ''); + if (test('-f', marker)) { + return targetPath; + } + + // download the archive + var archivePath = await downloadFileAsync(url, scrubbedUrl); + console.log('Extracting archive: ' + url); + + // delete any previously attempted extraction directory + if (test('-d', targetPath)) { + rm('-rf', targetPath); } + // extract + mkdir('-p', targetPath); + var zip = new admZip(archivePath); + zip.extractAllTo(targetPath); + + // write the completed marker + fs.writeFileSync(marker, ''); + return targetPath; -} +}; + var addPath = function (directory) { var separator; diff --git a/node/make.js b/node/make.js index 7782f4240..00f05eddd 100644 --- a/node/make.js +++ b/node/make.js @@ -38,10 +38,10 @@ target.build = function() { rm(path.join(buildPath, 'index.*')); } -target.test = function() { +target.test = async function() { target.build(); - buildutils.getExternals(); + await buildutils.getExternalsAsync(); run('tsc -p ./test'); cp('-Rf', rp('test/scripts'), testPath); cp('-Rf', rp('test/fakeTasks'), testPath); @@ -65,3 +65,13 @@ target.loc = function() { var enContents = JSON.stringify(strings, null, 2); fs.writeFileSync(path.join(strPath, 'resources.resjson'), enContents) } + +process.on('uncaughtException', err => { + console.error(`Uncaught exception: ${err.message}`); + console.debug(err.stack); +}); + +process.on('unhandledRejection', err => { + console.error(`Unhandled rejection: ${err.message}`); + console.debug(err.stack); +}); \ No newline at end of file diff --git a/node/mock-test.ts b/node/mock-test.ts index 4d973387e..5a48c3898 100644 --- a/node/mock-test.ts +++ b/node/mock-test.ts @@ -1,21 +1,23 @@ import cp = require('child_process'); import fs = require('fs'); -import ncp = require('child_process'); import os = require('os'); import path = require('path'); import cmdm = require('./taskcommand'); import shelljs = require('shelljs'); -import syncRequest from 'sync-request'; +const Downloader = require("nodejs-file-downloader"); const COMMAND_TAG = '[command]'; const COMMAND_LENGTH = COMMAND_TAG.length; const downloadDirectory = path.join(process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE as string, 'azure-pipelines-task-lib', '_download'); export class MockTestRunner { - constructor(testPath: string, taskJsonPath?: string) { + + constructor(testPath?: string, taskJsonPath?: string) { + if (testPath === undefined) + return; + this._taskJsonPath = taskJsonPath || ''; this._testPath = testPath; - this.nodePath = this.getNodePath(); } private _testPath = ''; @@ -29,6 +31,25 @@ export class MockTestRunner { public errorIssues: string[] = []; public warningIssues: string[] = []; + public async LoadAsync(testPath?: string, taskJsonPath?: string): Promise { + return new Promise(async (resolve, reject) => { + if (this.nodePath != '') { + resolve(this); + return; + } + if (testPath) { + this._testPath = testPath; + } + + if (taskJsonPath) { + this._taskJsonPath = taskJsonPath; + } + + this.nodePath = await this.getNodePath(); + resolve(this) + }) + } + get failed(): boolean { return !this.succeeded; } @@ -53,7 +74,7 @@ export class MockTestRunner { return this.stderr.indexOf(message) > 0; } - public run(nodeVersion?: number): void { + public async runAsync(nodeVersion?: number): Promise { this.cmdlines = {}; this.invokedToolCount = 0; this.succeeded = true; @@ -63,15 +84,19 @@ export class MockTestRunner { let nodePath = this.nodePath; if (nodeVersion) { - nodePath = this.getNodePath(nodeVersion); + nodePath = await this.getNodePath(nodeVersion); + } else if (!nodePath) { + nodePath = await this.getNodePath(); + this.nodePath = nodePath; } + let spawn = cp.spawnSync(nodePath, [this._testPath]); // Clean environment Object.keys(process.env) .filter(key => (key.substr(0, 'INPUT_'.length) === 'INPUT_' || - key.substr(0, 'SECRET_'.length) === 'SECRET_' || - key.substr(0, 'VSTS_TASKVARIABLE_'.length) === 'VSTS_TASKVARIABLE_')) + key.substr(0, 'SECRET_'.length) === 'SECRET_' || + key.substr(0, 'VSTS_TASKVARIABLE_'.length) === 'VSTS_TASKVARIABLE_')) .forEach(key => delete process.env[key]); if (spawn.error) { @@ -138,7 +163,7 @@ export class MockTestRunner { } // Returns a path to node.exe with the correct version for this task (based on if its node10 or node) - private getNodePath(nodeVersion?: number): string { + private async getNodePath(nodeVersion?: number): Promise { const version: number = nodeVersion || this.getNodeVersion(); let downloadVersion: string; @@ -163,7 +188,8 @@ export class MockTestRunner { return pathToExe; } else { - return this.downloadNode(downloadVersion, downloadDestination); + const result = await this.downloadNode(downloadVersion, downloadDestination); + return result; } } @@ -224,36 +250,34 @@ export class MockTestRunner { } // Downloads the specified node version to the download destination. Returns a path to node.exe - private downloadNode(nodeVersion: string, downloadDestination: string): string { + private async downloadNode(nodeVersion: string, downloadDestination: string): Promise { shelljs.rm('-rf', downloadDestination); let nodeUrl: string = process.env['TASK_NODE_URL'] || 'https://nodejs.org/dist'; nodeUrl = nodeUrl.replace(/\/$/, ''); // ensure there is no trailing slash on the base URL let downloadPath = ''; switch (this.getPlatform()) { case 'darwin': - this.downloadTarGz(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz', downloadDestination); + await this.downloadTarGz(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-darwin-x64.tar.gz', downloadDestination); downloadPath = path.join(downloadDestination, 'node-' + nodeVersion + '-darwin-x64', 'bin', 'node'); break; case 'linux': - this.downloadTarGz(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-linux-x64.tar.gz', downloadDestination); + await this.downloadTarGz(nodeUrl + '/' + nodeVersion + '/node-' + nodeVersion + '-linux-x64.tar.gz', downloadDestination); downloadPath = path.join(downloadDestination, 'node-' + nodeVersion + '-linux-x64', 'bin', 'node'); break; case 'win32': - this.downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe', downloadDestination, 'node.exe'); - this.downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib', downloadDestination, 'node.lib'); + await this.downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.exe', downloadDestination, 'node.exe'); + await this.downloadFile(nodeUrl + '/' + nodeVersion + '/win-x64/node.lib', downloadDestination, 'node.lib'); downloadPath = path.join(downloadDestination, 'node.exe') } // Write marker to indicate download completed. const marker = downloadDestination + '.completed'; fs.writeFileSync(marker, ''); - - return downloadPath; + return downloadPath } // Downloads file to the downloadDestination, making any necessary folders along the way. - private downloadFile(url: string, downloadDestination: string, fileName: string): void { - const filePath: string = path.join(downloadDestination, fileName); + private async downloadFile(url: string, downloadDestination: string, fileName: string): Promise { if (!url) { throw new Error('Parameter "url" must be set.'); } @@ -262,12 +286,19 @@ export class MockTestRunner { } console.log('Downloading file:', url); shelljs.mkdir('-p', downloadDestination); - const result: any = syncRequest('GET', url); - fs.writeFileSync(filePath, result.getBody()); + + const downloader = new Downloader({ + url: url, + directory: downloadDestination, + fileName: fileName + }); + + await downloader.download(); + return; } // Downloads tarGz to the download destination, making any necessary folders along the way. - private downloadTarGz(url: string, downloadDestination: string): void { + private async downloadTarGz(url: string, downloadDestination: string): Promise { if (!url) { throw new Error('Parameter "url" must be set.'); } @@ -275,13 +306,13 @@ export class MockTestRunner { throw new Error('Parameter "downloadDestination" must be set.'); } const tarGzName: string = 'node.tar.gz'; - this.downloadFile(url, downloadDestination, tarGzName); + await this.downloadFile(url, downloadDestination, tarGzName); // Extract file const originalCwd: string = process.cwd(); process.chdir(downloadDestination); try { - ncp.execSync(`tar -xzf "${path.join(downloadDestination, tarGzName)}"`); + cp.execSync(`tar -xzf "${path.join(downloadDestination, tarGzName)}"`); } catch { throw new Error('Failed to unzip node tar.gz from ' + url); diff --git a/node/package-lock.json b/node/package-lock.json index fabdcb38b..b541ffb47 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -1,25 +1,9 @@ { "name": "azure-pipelines-task-lib", - "version": "5.0.0-preview.0", + "version": "5.0.1-preview.0", "lockfileVersion": 1, "requires": true, "dependencies": { - "@types/concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-OU2+C7X+5Gs42JZzXoto7yOQ0A0=", - "requires": { - "@types/node": "*" - } - }, - "@types/form-data": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz", - "integrity": "sha1-yayFsqX9GENbjIXZ7LUObWyJP/g=", - "requires": { - "@types/node": "*" - } - }, "@types/glob": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", @@ -45,7 +29,8 @@ "@types/node": { "version": "16.11.39", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.39.tgz", - "integrity": "sha512-K0MsdV42vPwm9L6UwhIxMAOmcvH/1OoVkZyCgEtVu4Wx7sElGloy/W7kMBNe/oJ7V/jW9BVt1F6RahH6e7tPXw==" + "integrity": "sha512-K0MsdV42vPwm9L6UwhIxMAOmcvH/1OoVkZyCgEtVu4Wx7sElGloy/W7kMBNe/oJ7V/jW9BVt1F6RahH6e7tPXw==", + "dev": true }, "@types/q": { "version": "1.5.4", @@ -53,11 +38,6 @@ "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", "dev": true }, - "@types/qs": { - "version": "6.9.5", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.5.tgz", - "integrity": "sha512-/JHkVHtx/REVG0VVToGRGH2+23hsYLHdyG+GrvoUGlGAd0ErauXDyvHtRI/7H7mzLm+tBCKA7pfcpkQ1lf58iQ==" - }, "@types/semver": { "version": "7.3.4", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.4.tgz", @@ -80,6 +60,19 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, + "adm-zip": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", + "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==" + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -117,16 +110,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -162,31 +145,12 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, "camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -250,40 +214,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, "debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, "requires": { "ms": "2.1.2" }, @@ -291,8 +230,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -302,11 +240,6 @@ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -356,15 +289,10 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, - "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" }, "fs.realpath": { "version": "1.0.0", @@ -389,21 +317,6 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" - } - }, - "get-port": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", - "integrity": "sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=" - }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -446,41 +359,19 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" - }, "he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, - "http-basic": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", - "integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==", - "requires": { - "caseless": "^0.12.0", - "concat-stream": "^1.6.2", - "http-response-object": "^3.0.1", - "parse-cache-control": "^1.0.1" - } - }, - "http-response-object": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz", - "integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==", + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "requires": { - "@types/node": "^10.0.3" - }, - "dependencies": { - "@types/node": { - "version": "10.17.35", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.35.tgz", - "integrity": "sha512-gXx7jAWpMddu0f7a+L+txMplp3FnHl53OhQIF9puXKq3hDGY/GjH+MF04oWnV/adPSCrbtHumDCFwzq2VhltWA==" - } + "agent-base": "6", + "debug": "4" } }, "inflight": { @@ -558,11 +449,6 @@ "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -598,16 +484,16 @@ } }, "mime-db": { - "version": "1.44.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", - "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" }, "mime-types": { - "version": "2.1.27", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", - "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "requires": { - "mime-db": "1.44.0" + "mime-db": "1.52.0" } }, "minimatch": { @@ -661,6 +547,11 @@ } } }, + "mockery": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mockery/-/mockery-2.1.0.tgz", + "integrity": "sha512-9VkOmxKlWXoDO/h1jDZaS4lH33aWfRiJiNT/tKj+8OGzrcFDLo8d0syGdbsc3Bc4GvRXPb+NMMvojotmuGJTvA==" + }, "ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -673,17 +564,23 @@ "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true }, + "nodejs-file-downloader": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.11.1.tgz", + "integrity": "sha512-gSdNElTbRq+iFWcmT7URh9WlBIgVF/JM4UAiVr06/ou+ouEBUawsi/U2xFMK146XAuAoSAFfCh+ZrxxlZ0aV/w==", + "requires": { + "follow-redirects": "^1.15.1", + "https-proxy-agent": "^5.0.0", + "mime-types": "^2.1.27", + "sanitize-filename": "^1.6.3" + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, - "object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -710,11 +607,6 @@ "p-limit": "^3.0.2" } }, - "parse-cache-control": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz", - "integrity": "sha1-juqz5U+laSD+Fro493+iGqzC104=" - }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -737,32 +629,11 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "promise": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz", - "integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==", - "requires": { - "asap": "~2.0.6" - } - }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" }, - "qs": { - "version": "6.11.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz", - "integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==", - "requires": { - "side-channel": "^1.0.4" - } - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -772,20 +643,6 @@ "safe-buffer": "^5.1.0" } }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -822,7 +679,16 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } }, "semver": { "version": "5.5.0", @@ -848,16 +714,6 @@ "rechoir": "^0.6.2" } }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, "string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -869,14 +725,6 @@ "strip-ansi": "^6.0.1" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -906,49 +754,6 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" }, - "sync-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz", - "integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==", - "requires": { - "http-response-object": "^3.0.1", - "sync-rpc": "^1.2.1", - "then-request": "^6.0.0" - } - }, - "sync-rpc": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz", - "integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==", - "requires": { - "get-port": "^3.1.0" - } - }, - "then-request": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz", - "integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==", - "requires": { - "@types/concat-stream": "^1.6.0", - "@types/form-data": "0.0.33", - "@types/node": "^8.0.0", - "@types/qs": "^6.2.31", - "caseless": "~0.12.0", - "concat-stream": "^1.6.0", - "form-data": "^2.2.0", - "http-basic": "^8.1.1", - "http-response-object": "^3.0.1", - "promise": "^8.0.0", - "qs": "^6.4.0" - }, - "dependencies": { - "@types/node": { - "version": "8.10.64", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.64.tgz", - "integrity": "sha512-/EwBIb+imu8Qi/A3NF9sJ9iuKo7yV+pryqjmeRqaU0C4wBAOhas5mdvoYeJ5PCKrh6thRSJHdoasFqh3BQGILA==" - } - } - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -958,10 +763,13 @@ "is-number": "^7.0.0" } }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", + "requires": { + "utf8-byte-length": "^1.0.1" + } }, "typescript": { "version": "4.0.2", @@ -969,10 +777,10 @@ "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==", "dev": true }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==" }, "uuid": { "version": "3.2.1", diff --git a/node/package.json b/node/package.json index d24bd7294..4920464f2 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "azure-pipelines-task-lib", - "version": "5.0.0-preview.0", + "version": "5.0.1-preview.0", "description": "Azure Pipelines Task SDK", "main": "./task.js", "typings": "./task.d.ts", @@ -27,11 +27,12 @@ }, "homepage": "https://github.com/Microsoft/azure-pipelines-task-lib", "dependencies": { + "adm-zip": "^0.5.10", "minimatch": "3.0.5", + "nodejs-file-downloader": "^4.11.1", "q": "^1.5.1", "semver": "^5.1.0", "shelljs": "^0.8.5", - "sync-request": "6.1.0", "uuid": "^3.0.1" }, "devDependencies": { diff --git a/node/test/mocktests.ts b/node/test/mocktests.ts index 6c8e44095..2fa1f525c 100644 --- a/node/test/mocktests.ts +++ b/node/test/mocktests.ts @@ -298,33 +298,43 @@ describe('Mock Tests', function () { assert.equal(numStdErrCalls, 1); }) - it('MockTest handles node 6 tasks correctly', function (done) { + it('MockTest handles node 6 tasks correctly', async function () { this.timeout(30000); const runner = new mtm.MockTestRunner(path.join(__dirname, 'fakeTasks', 'node6task', 'entry.js')); + await runner.LoadAsync(); const nodePath = runner.nodePath; assert(nodePath, 'node path should have been correctly set'); const version = ncp.execSync(nodePath + ' -v').toString().trim(); assert(semver.satisfies(version, '6.x'), 'Downloaded node version should be Node 6 instead of ' + version); - done(); }) - it('MockTest handles node 10 tasks correctly', function (done) { + it('MockTest handles node 10 tasks correctly', async function () { this.timeout(30000); - const runner = new mtm.MockTestRunner(path.join(__dirname, 'fakeTasks', 'node10task', 'entry.js')); + const runner = new mtm.MockTestRunner(); + await runner.LoadAsync(path.join(__dirname, 'fakeTasks', 'node10task', 'entry.js')); const nodePath = runner.nodePath; assert(nodePath, 'node path should have been correctly set'); const version = ncp.execSync(nodePath + ' -v').toString().trim(); assert(semver.satisfies(version, '10.x'), 'Downloaded node version should be Node 10 instead of ' + version); - done(); }) - it('MockTest handles node 16 tasks correctly', function (done) { + it('MockTest handles node 16 tasks correctly', async function () { this.timeout(30000); const runner = new mtm.MockTestRunner(path.join(__dirname, 'fakeTasks', 'node16task', 'entry.js')); + await runner.LoadAsync(); const nodePath = runner.nodePath; assert(nodePath, 'node path should have been correctly set'); const version = ncp.execSync(nodePath + ' -v').toString().trim(); assert(semver.satisfies(version, '16.x'), 'Downloaded node version should be Node 16 instead of ' + version); - done(); + }) + + it('MockTest handles node tasks correctly by async call', async function() { + this.timeout(30000); + const runner = await (new mtm.MockTestRunner).LoadAsync(path.join(__dirname, 'fakeTasks', 'node16task', 'entry.js')); + const nodePath = runner.nodePath; + assert(nodePath, 'node path should have been correctly set'); + const version = ncp.execSync(nodePath + ' -v').toString().trim(); + assert(semver.satisfies(version, '16.x'), 'Downloaded node version should be Node 16 instead of ' + version); + await Promise.resolve() }) }); diff --git a/powershell/CompiledHelpers/VstsTaskSdk.csproj b/powershell/CompiledHelpers/VstsTaskSdk.csproj index 138d63659..86a5ef6df 100644 --- a/powershell/CompiledHelpers/VstsTaskSdk.csproj +++ b/powershell/CompiledHelpers/VstsTaskSdk.csproj @@ -11,7 +11,7 @@ VstsTaskSdk true FinalPublicKey.snk - true + true v4.0 512 diff --git a/powershell/VstsTaskSdk/VstsTaskSdk.psd1 b/powershell/VstsTaskSdk/VstsTaskSdk.psd1 index 3c606fdf7..4076f834e 100644 Binary files a/powershell/VstsTaskSdk/VstsTaskSdk.psd1 and b/powershell/VstsTaskSdk/VstsTaskSdk.psd1 differ diff --git a/powershell/make-util.js b/powershell/make-util.js index aac7268c9..e7c3d77a5 100644 --- a/powershell/make-util.js +++ b/powershell/make-util.js @@ -1,11 +1,10 @@ - var admZip = require('adm-zip'); var child_process = require('child_process'); var fs = require('fs'); var path = require('path'); var process = require('process'); var shell = require('shelljs'); -var syncRequest = require('sync-request'); +const Downloader = require("nodejs-file-downloader"); // global paths var downloadPath = path.join(__dirname, '_download'); @@ -20,12 +19,6 @@ var shellAssert = function () { } } -var cd = function (dir) { - shell.cd(dir); - shellAssert(); -} -exports.cd = cd; - var cp = function (options, source, dest) { if (dest) { shell.cp(options, source, dest); @@ -112,65 +105,84 @@ var ensureTool = function (name, versionArgs, validate) { } exports.ensureTool = ensureTool; -var downloadFile = function (url) { +const downloadFileAsync = async function (url, fileName) { // validate parameters if (!url) { throw new Error('Parameter "url" must be set.'); } // skip if already downloaded - var scrubbedUrl = url.replace(/[/\:?]/g, '_'); - var targetPath = path.join(downloadPath, 'file', scrubbedUrl); - var marker = targetPath + '.completed'; - if (!test('-f', marker)) { - console.log('Downloading file: ' + url); + const scrubbedUrl = url.replace(/[/\:?]/g, '_'); + if (fileName === undefined) { + fileName = scrubbedUrl; + } + const targetPath = path.join(downloadPath, 'file', fileName); + const marker = targetPath + '.completed'; + if (test('-f', marker)) { + console.log('File already exists: ' + targetPath); + return targetPath; + } - // delete any previous partial attempt - if (test('-f', targetPath)) { - rm('-f', targetPath); - } + console.log('Downloading file: ' + url); + // delete any previous partial attempt + if (test('-f', targetPath)) { + rm('-f', targetPath); + } - // download the file - mkdir('-p', path.join(downloadPath, 'file')); - var result = syncRequest('GET', url); - fs.writeFileSync(targetPath, result.getBody()); + // download the file + mkdir('-p', path.join(downloadPath, 'file')); - // write the completed marker - fs.writeFileSync(marker, ''); - } + const downloader = new Downloader({ + url: url, + directory: path.join(downloadPath, 'file'), + fileName: fileName + }); - return targetPath; -} -exports.downloadFile = downloadFile; -var downloadArchive = function (url) { + const { filePath } = await downloader.download(); // Downloader.download() resolves with some useful properties. + fs.writeFileSync(marker, ''); + + return filePath; +}; + +exports.downloadFileAsync = downloadFileAsync; + +var downloadArchiveAsync = async function (url, fileName) { if (!url) { throw new Error('Parameter "url" must be set.'); } // skip if already downloaded and extracted var scrubbedUrl = url.replace(/[\/\\:?]/g, '_'); + if (fileName !== undefined) { + scrubbedUrl = fileName; + } var targetPath = path.join(downloadPath, 'archive', scrubbedUrl); var marker = targetPath + '.completed'; - if (!test('-f', marker)) { - // download the archive - var archivePath = downloadFile(url); - console.log('Extracting archive: ' + url); - - // delete any previously attempted extraction directory - if (test('-d', targetPath)) { - rm('-rf', targetPath); - } + if (test('-f', marker)) { + return targetPath; + } - // extract - mkdir('-p', targetPath); - var zip = new admZip(archivePath); - zip.extractAllTo(targetPath); + // download the archive + var archivePath = await downloadFileAsync(url, scrubbedUrl); + console.log('Extracting archive: ' + url); - // write the completed marker - fs.writeFileSync(marker, ''); + // delete any previously attempted extraction directory + if (test('-d', targetPath)) { + rm('-rf', targetPath); } + // extract + mkdir('-p', targetPath); + var zip = new admZip(archivePath); + zip.extractAllTo(targetPath); + + // write the completed marker + fs.writeFileSync(marker, ''); + return targetPath; -} -exports.downloadArchive = downloadArchive; +}; + + +exports.downloadArchiveAsync = downloadArchiveAsync; + diff --git a/powershell/make.js b/powershell/make.js index 56c4f66c0..6e8b4ed28 100644 --- a/powershell/make.js +++ b/powershell/make.js @@ -1,6 +1,6 @@ -var shellMake = require('shelljs/make'); -var child_process = require('child_process'); +require('shelljs/make'); + var fs = require('fs'); var path = require('path'); var util = require('./make-util.js'); @@ -16,7 +16,7 @@ target.clean = function () { // TODO: target.buildCompiledHelper // This will only build the C# compiled helper csproj. -target.build = function() { +target.build = async function () { target.clean(); target.loc(); @@ -25,15 +25,15 @@ target.build = function() { util.cp('-r', path.join('VstsTaskSdk', '*'), path.join(buildPath, 'VstsTaskSdk')); // download externals - var minimatchPackage = util.downloadArchive('https://www.nuget.org/api/v2/package/minimatch/1.1.0'); + var minimatchPackage = await util.downloadArchiveAsync('https://www.nuget.org/api/v2/package/minimatch/1.1.0'); util.cp(path.join(minimatchPackage, 'lib', 'portable-net40%2Bsl50%2Bwin%2Bwp80', 'Minimatch.dll'), path.join(buildPath, 'VstsTaskSdk')); - var compiledHelperPackage = util.downloadArchive('https://vstsagenttools.blob.core.windows.net/tools/VstsTaskSdkCompiledHelpers/3/VstsTaskSdk.zip'); + var compiledHelperPackage = await util.downloadArchiveAsync('https://vstsagenttools.blob.core.windows.net/tools/VstsTaskSdkCompiledHelpers/3/VstsTaskSdk.zip'); util.cp(path.join(compiledHelperPackage, 'VstsTaskSdk.dll'), path.join(buildPath, 'VstsTaskSdk')); // stamp the version number from the package.json onto the PowerShell module definition var targetPsd1 = path.join(buildPath, 'VstsTaskSdk', 'VstsTaskSdk.psd1'); - var psd1Contents = fs.readFileSync(targetPsd1, 'ucs2'); // UCS-2 is a subset of UTF-16. UTF-16 is not supported by node. + var psd1Contents = fs.readFileSync(targetPsd1, 'utf-8'); // UCS-2 is a subset of UTF-16. UTF-16 is not supported by node. var token = "ModuleVersion = '0.1'"; var tokenStart = psd1Contents.indexOf(token); if (tokenStart < 0) { @@ -57,13 +57,13 @@ target.build = function() { psd1Contents = psd1Contents.substring(0, tokenStart) + commitHash + psd1Contents.substring(tokenStart + token.length); // save the updated psd1 file - fs.writeFileSync(targetPsd1, psd1Contents, 'ucs2'); + fs.writeFileSync(targetPsd1, psd1Contents, 'utf-8'); } -target.test = function() { +target.test = async function () { util.ensureTool('tsc', '--version', 'Version 1.8.7'); util.ensureTool('mocha', '--version', '5.2.0'); - target.build(); + await target.build(); util.mkdir('-p', testPath); util.run(`tsc --outDir "${testPath}" --module commonjs --target es6 --rootDir Tests Tests/lib/psRunner.ts`); @@ -72,12 +72,12 @@ target.test = function() { util.run('mocha "' + path.join(testPath, 'L0', '_suite.js') + '"'); } -target.loc = function() { +target.loc = function () { // build the content for the en-US resjson file var lib = require('./VstsTaskSdk/lib.json'); var strPath = path.join('VstsTaskSdk', 'Strings', 'resources.resjson', 'en-US'); util.mkdir('-p', strPath); - var strings = { }; + var strings = {}; if (lib.messages) { for (var key in lib.messages) { var messageKey = 'loc.messages.' + key; @@ -90,3 +90,13 @@ target.loc = function() { var enContents = JSON.stringify(strings, null, 2); fs.writeFileSync(enPath, enContents); } + +process.on('uncaughtException', err => { + console.error(`Uncaught exception: ${err.message}`); + console.debug(err.stack); +}); + +process.on('unhandledRejection', err => { + console.error(`Unhandled rejection: ${err.message}`); + console.debug(err.stack); +}); \ No newline at end of file diff --git a/powershell/package-lock.json b/powershell/package-lock.json index 5712393fb..382c95048 100644 --- a/powershell/package-lock.json +++ b/powershell/package-lock.json @@ -1,6 +1,6 @@ { "name": "vsts-task-sdk", - "version": "0.14.0", + "version": "0.17.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -10,11 +10,31 @@ "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==", "dev": true }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", - "dev": true + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "requires": { + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } }, "balanced-match": { "version": "1.0.2", @@ -38,28 +58,6 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "caseless": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", - "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", - "dev": true - }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -72,24 +70,6 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -111,6 +91,12 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -123,17 +109,6 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -169,35 +144,39 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "http-basic": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-2.5.1.tgz", - "integrity": "sha1-jORHvbW2xXf4pj4/p4BW7Eu02/s=", + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, "requires": { - "caseless": "~0.11.0", - "concat-stream": "^1.4.6", - "http-response-object": "^1.0.0" + "agent-base": "6", + "debug": "4" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } }, - "http-response-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-1.1.0.tgz", - "integrity": "sha1-p8TnWq6C87tJBOT0P2FWc7TVGMM=", - "dev": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -229,12 +208,21 @@ "has": "^1.0.3" } }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "requires": { + "mime-db": "1.52.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -284,11 +272,17 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "object-inspect": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", - "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", - "dev": true + "nodejs-file-downloader": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/nodejs-file-downloader/-/nodejs-file-downloader-4.11.1.tgz", + "integrity": "sha512-gSdNElTbRq+iFWcmT7URh9WlBIgVF/JM4UAiVr06/ou+ouEBUawsi/U2xFMK146XAuAoSAFfCh+ZrxxlZ0aV/w==", + "dev": true, + "requires": { + "follow-redirects": "^1.15.1", + "https-proxy-agent": "^5.0.0", + "mime-types": "^2.1.27", + "sanitize-filename": "^1.6.3" + } }, "once": { "version": "1.4.0", @@ -311,45 +305,6 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "promise": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", - "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", - "dev": true, - "requires": { - "asap": "~2.0.3" - } - }, - "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - }, - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -370,11 +325,14 @@ "supports-preserve-symlinks-flag": "^1.0.0" } }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "sanitize-filename": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/sanitize-filename/-/sanitize-filename-1.6.3.tgz", + "integrity": "sha512-y/52Mcy7aw3gRm7IrcGDFx/bCk4AhRh2eI9luHOQM86nZsqwiRkkq2GekHXBBD+SmPidc8i2PqtYZl+pWJ8Oeg==", + "dev": true, + "requires": { + "truncate-utf8-bytes": "^1.0.0" + } }, "shelljs": { "version": "0.8.5", @@ -387,26 +345,6 @@ "rechoir": "^0.6.2" } }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -422,47 +360,25 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, - "sync-request": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/sync-request/-/sync-request-3.0.1.tgz", - "integrity": "sha1-yqEjWq+Im6UBB2oYNMQ2gwqC+3M=", - "dev": true, - "requires": { - "concat-stream": "^1.4.7", - "http-response-object": "^1.0.1", - "then-request": "^2.0.1" - } - }, - "then-request": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/then-request/-/then-request-2.2.0.tgz", - "integrity": "sha1-ZnizL6DKIY/laZgbvYhxtZQGDYE=", + "truncate-utf8-bytes": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz", + "integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==", "dev": true, "requires": { - "caseless": "~0.11.0", - "concat-stream": "^1.4.7", - "http-basic": "^2.5.1", - "http-response-object": "^1.1.0", - "promise": "^7.1.1", - "qs": "^6.1.0" + "utf8-byte-length": "^1.0.1" } }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, "typescript": { "version": "1.8.7", "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.7.tgz", "integrity": "sha1-NeODjeMckc/h2MIODleF04aTikk=", "dev": true }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "utf8-byte-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz", + "integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==", "dev": true }, "wrappy": { diff --git a/powershell/package.json b/powershell/package.json index 95b8d4a56..847c4c06a 100644 --- a/powershell/package.json +++ b/powershell/package.json @@ -1,32 +1,17 @@ { - "name": "vsts-task-sdk", - "version": "0.14.0", - "description": "VSTS Task SDK", + "version": "0.17.0", + "private": true, "scripts": { "build": "node make.js build", "test": "node make.js test" }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/azure-pipelines-task-lib" - }, - "keywords": [ - "vsts", - "xplat", - "agent", - "build" - ], "author": "Microsoft", "license": "MIT", - "bugs": { - "url": "https://github.com/Microsoft/azure-pipelines-task-lib/issues" - }, - "homepage": "https://github.com/Microsoft/azure-pipelines-task-lib#readme", "devDependencies": { "adm-zip": "^0.5.9", "mocha": "5.2.0", "shelljs": "^0.8.5", - "sync-request": "3.0.1", - "typescript": "1.8.7" + "typescript": "1.8.7", + "nodejs-file-downloader": "^4.11.1" } } diff --git a/powershell/publish.ps1 b/powershell/publish.ps1 new file mode 100644 index 000000000..49f76b36a --- /dev/null +++ b/powershell/publish.ps1 @@ -0,0 +1,21 @@ +param( + [Parameter(Mandatory = $true)] + [string]$ApiKey +) + +# Install newest version of powershell management api +Install-Module -Name Microsoft.PowerShell.PSResourceGet + +$makePath = Join-Path $PSScriptRoot 'make.js' +& node $makePath build + +$buildPath = Join-Path $PSScriptRoot '_build' +$moduleBuildPath = Join-Path $buildPath "VstsTaskSdk" + +$publishOptions = @{ + Path = $moduleBuildPath + ApiKey = $ApiKey + Repository = 'PSGallery' + Verbose = $true +} +Publish-PSResource @publishOptions