Skip to content

Commit

Permalink
Merge pull request #13 from Blackbaud-LeoWanderer/master
Browse files Browse the repository at this point in the history
Upgrade node version
  • Loading branch information
sandorfr authored Dec 3, 2021
2 parents 02dada4 + 74dbdff commit 132074d
Show file tree
Hide file tree
Showing 22 changed files with 6,018 additions and 2,410 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ ModelManifest.xml
/tests/GeekLearning.Integration.Test/appsettings.development.json


Common/**/*.js
Common/**/*.js.map
Common/**/*.d.ts
Tests/**/*.js
Tests/**/*.js.map
Tests/**/*.d.ts
Expand Down
18 changes: 10 additions & 8 deletions Common/Node/expandJObject.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import tl = require('vsts-task-lib/task');
import tl = require("azure-pipelines-task-lib");

export function recursiveProcessing(obj: any, prefix: string, isSecret: boolean): void {
var typeArray: string[] =["string", "number", "boolean"];
let typeArray: string[] = ["string", "number", "boolean"];
if (obj instanceof Array) {
for (var index = 0; index < obj.length; index++) {
var element = obj[index];
for (let index = 0; index < obj.length; index++) {
let element = obj[index];
recursiveProcessing(element, prefix + "_" + index.toString(), isSecret);
}
} else if (typeArray.indexOf(typeof obj) > -1) {
var objValue = typeArray.indexOf(typeof obj)>0 ? obj.toString() : obj;
var objDisplayValue = isSecret ? "******" : objValue;
let objValue = typeArray.indexOf(typeof obj) > 0 ? obj.toString() : obj;
let objDisplayValue = isSecret ? "******" : objValue;
// tslint:disable-next-line: no-console
console.log("Injecting variable : " + prefix + ", value : " + objDisplayValue);
tl.setVariable(prefix, objValue, isSecret);
} else {
for (var key in obj) {
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
var element = obj[key];
let element = obj[key];
recursiveProcessing(element, prefix + "_" + key, isSecret);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"description": "Build and Release Management extensions that help you manipulate and load variables.",
"categories": [
"Build and release"
"Azure Pipelines"
],
"icons": {
"default": "extension-icon.png"
Expand Down
20 changes: 10 additions & 10 deletions Tasks/LoadJsonVariables/loadjsonvariables.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import path = require('path');
import fs = require('fs-extra');
import tl = require('vsts-task-lib/task');
import {recursiveProcessing} from './common/expandJObject';
import fs = require("fs-extra");
import tl = require("azure-pipelines-task-lib");
import { recursiveProcessing } from "./common/expandJObject";

try {
var source = tl.getPathInput("JsonSource");
var variablePrefix = tl.getInput("VariablePrefix");
var isSecret = tl.getBoolInput("MarkAsSecret");
try {
let source = tl.getPathInput("JsonSource");
let variablePrefix = tl.getInput("VariablePrefix");
let isSecret = tl.getBoolInput("MarkAsSecret");

var content = fs.readFileSync(source, { encoding: 'utf8' });
var jObject = JSON.parse(content);
let content = fs.readFileSync(source, { encoding: "utf8" });
let jObject = JSON.parse(content);

recursiveProcessing(jObject, variablePrefix, isSecret);

tl.setResult(tl.TaskResult.Succeeded, "Variables loaded");

} catch (err) {
// tslint:disable-next-line: no-console
console.error(String(err));
tl.setResult(tl.TaskResult.Failed, String(err));
}
Loading

0 comments on commit 132074d

Please sign in to comment.