Skip to content
Permalink
Browse files

Fixing Extensionversion under node 10+

  • Loading branch information...
jessehouwing committed Mar 4, 2019
1 parent 19b08a0 commit a6e87d25ad3be853938b67d054679ca3c1e024a1
Showing with 35 additions and 9 deletions.
  1. +14 −9 BuildTasks/ExtensionVersion/ExtensionVersion.ts
  2. +21 −0 test-extensionversion.cmd
@@ -1,6 +1,7 @@
///<reference path="../Common/Common.ts"/>

import * as tl from "vsts-task-lib/task";
import * as tr from "vsts-task-lib/toolrunner";
import * as common from "../Common/Common";

const extensionVersionOverrideVariable = tl.getInput("extensionVersionOverride", false);
@@ -31,18 +32,22 @@ if (extensionVersionOverrideVariable) {
export async function run() {
try {
await common.runTfx(async tfx => {
tfx.arg(["extension", "show", "--json", "--no-color"]);

common.setTfxMarketplaceArguments(tfx);
common.validateAndSetTfxManifestArguments(tfx);
try {
tfx.arg(["extension", "show", "--json", "--no-color"]);

const versionAction = tl.getInput("versionAction", false);
common.setTfxMarketplaceArguments(tfx);
common.validateAndSetTfxManifestArguments(tfx);

const outputStream = new common.TfxJsonOutputStream(console.log);
const errorStream = new common.TfxJsonOutputStream(tl.error);
const versionAction = tl.getInput("versionAction", false);

try {
const code = await tfx.exec(<any>{ outStream: outputStream, errorStream: errorStream, failOnStdErr: true });
const outputStream = new common.TfxJsonOutputStream(console.log);
const errorStream = new common.TfxJsonOutputStream(tl.error);

const code: number = await tfx.exec(<any>{ outStream: outputStream, errorStream: errorStream, failOnStdErr: false, ignoreReturnCode: false } as tr.IExecOptions);
if (code !== 0)
{
throw `tfx exited with return code: ${code}`
}
const json = JSON.parse(outputStream.jsonString);
let version: string = json.versions[0].version;

@@ -0,0 +1,21 @@
set INPUT_EXTENSIONID=vsts-ensure-tests-tasks
set INPUT_EXTENSIONVERSION=8.9.10
set INPUT_PUBLISHERID=jessehouwing
set INPUT_ROOTFOLDER=C:\Users\jesse\source\repos\vsts-ping-task-demo
set INPUT_UPDATETASKSID=true
set INPUT_UPDATETASKSVERSION=true
set INPUT_UPDATETASKSVERSIONTYPE=minor
SET INPUT_CONNECTEDSERVICENAME=A
SET ENDPOINT_URL_A=https://marketplace.visualstudio.com
SET ENDPOINT_AUTH_A={ "parameters": { "apitoken": "token", "username": "user", "password": "password" }, "Scheme": "basic" }

set AGENT_WORKFOLDER=%temp%

set NODE_ENV=production
set NO_UPDATE_NOTIFIER=true

cmd /c "npm run build:tasks"

pushd BuildTasks\ExtensionVersion\ExtensionVersion
node ExtensionVersion.js
popd

0 comments on commit a6e87d2

Please sign in to comment.
You can’t perform that action at this time.