From cb2f4176bfc1e6603b6f7b2c4122f9327c913786 Mon Sep 17 00:00:00 2001 From: aksm-ms <58936966+aksm-ms@users.noreply.github.com> Date: Tue, 17 Mar 2020 15:34:44 +0530 Subject: [PATCH] added paths in tsconfig.json --- lib/PowerShell/ServicePrincipalLogin.js | 10 +++++----- lib/PowerShell/Utilities/Utils.js | 4 ++-- lib/main.js | 7 +++++-- src/PowerShell/ServicePrincipalLogin.ts | 10 +++++----- src/PowerShell/Utilities/Utils.ts | 6 ++---- src/main.ts | 2 +- tsconfig.json | 7 +++++-- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/lib/PowerShell/ServicePrincipalLogin.js b/lib/PowerShell/ServicePrincipalLogin.js index 9dadd9e3..3f473425 100644 --- a/lib/PowerShell/ServicePrincipalLogin.js +++ b/lib/PowerShell/ServicePrincipalLogin.js @@ -20,10 +20,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); -const Utils_1 = __importDefault(require("./Utilities/Utils")); -const PowerShellToolRunner_1 = __importDefault(require("./Utilities/PowerShellToolRunner")); -const ScriptBuilder_1 = __importDefault(require("./Utilities/ScriptBuilder")); -const Constants_1 = __importDefault(require("./Constants")); +const Utils_1 = __importDefault(require("PowerShell/Utilities/Utils")); +const PowerShellToolRunner_1 = __importDefault(require("PowerShell/Utilities/PowerShellToolRunner")); +const ScriptBuilder_1 = __importDefault(require("PowerShell/Utilities/ScriptBuilder")); +const Constants_1 = __importDefault(require("PowerShell/Constants")); class ServicePrincipalLogin { constructor(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId) { this.servicePrincipalId = servicePrincipalId; @@ -48,7 +48,7 @@ class ServicePrincipalLogin { }); } } -exports.ServicePrincipalLogin = ServicePrincipalLogin; +exports.default = ServicePrincipalLogin; ServicePrincipalLogin.environment = Constants_1.default.environment; ServicePrincipalLogin.scopeLevel = Constants_1.default.scopeLevel; ServicePrincipalLogin.scheme = Constants_1.default.scheme; diff --git a/lib/PowerShell/Utilities/Utils.js b/lib/PowerShell/Utilities/Utils.js index e32d79ae..f5b6b69a 100644 --- a/lib/PowerShell/Utilities/Utils.js +++ b/lib/PowerShell/Utilities/Utils.js @@ -20,8 +20,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const os = __importStar(require("os")); -const Constants_1 = __importDefault(require("../Constants")); -const PowerShellToolRunner_1 = __importDefault(require("./PowerShellToolRunner")); +const Constants_1 = __importDefault(require("PowerShell/Constants")); +const PowerShellToolRunner_1 = __importDefault(require("PowerShell/Utilities/PowerShellToolRunner")); class Utils { static getLatestModule(moduleName) { return __awaiter(this, void 0, void 0, function* () { diff --git a/lib/main.js b/lib/main.js index ba89d83d..47da445d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -15,13 +15,16 @@ var __importStar = (this && this.__importStar) || function (mod) { result["default"] = mod; return result; }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); const crypto = __importStar(require("crypto")); const exec = __importStar(require("@actions/exec")); const io = __importStar(require("@actions/io")); const actions_secret_parser_1 = require("actions-secret-parser"); -const ServicePrincipalLogin_1 = require("./PowerShell/ServicePrincipalLogin"); +const ServicePrincipalLogin_1 = __importDefault(require("PowerShell/ServicePrincipalLogin")); var azPath; var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : ""; function main() { @@ -48,7 +51,7 @@ function main() { yield executeAzCliCommand(`account set --subscription "${subscriptionId}"`); if (enablePSSession) { console.log(`Running Azure PS Login`); - const spnlogin = new ServicePrincipalLogin_1.ServicePrincipalLogin(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId); + const spnlogin = new ServicePrincipalLogin_1.default(servicePrincipalId, servicePrincipalKey, tenantId, subscriptionId); spnlogin.initialize(); spnlogin.login(); } diff --git a/src/PowerShell/ServicePrincipalLogin.ts b/src/PowerShell/ServicePrincipalLogin.ts index 7760e97c..288e343e 100644 --- a/src/PowerShell/ServicePrincipalLogin.ts +++ b/src/PowerShell/ServicePrincipalLogin.ts @@ -1,11 +1,11 @@ import * as core from '@actions/core'; -import Utils from './Utilities/Utils'; -import PowerShellToolRunner from './Utilities/PowerShellToolRunner'; -import ScriptBuilder from './Utilities/ScriptBuilder'; -import Constants from './Constants'; +import Utils from 'PowerShell/Utilities/Utils'; +import PowerShellToolRunner from 'PowerShell/Utilities/PowerShellToolRunner'; +import ScriptBuilder from 'PowerShell/Utilities/ScriptBuilder'; +import Constants from 'PowerShell/Constants'; -export class ServicePrincipalLogin implements IAzurePowerShellSession { +export default class ServicePrincipalLogin implements IAzurePowerShellSession { static readonly environment: string = Constants.environment; static readonly scopeLevel: string = Constants.scopeLevel; static readonly scheme: string = Constants.scheme; diff --git a/src/PowerShell/Utilities/Utils.ts b/src/PowerShell/Utilities/Utils.ts index 9a25a72b..c990d6c4 100644 --- a/src/PowerShell/Utilities/Utils.ts +++ b/src/PowerShell/Utilities/Utils.ts @@ -1,9 +1,7 @@ import * as os from 'os'; -import * as exec from '@actions/exec'; -import * as io from '@actions/io'; -import Constants from '../Constants'; -import PowerShellToolRunner from './PowerShellToolRunner'; +import Constants from 'PowerShell/Constants'; +import PowerShellToolRunner from 'PowerShell/Utilities/PowerShellToolRunner'; export default class Utils { static async getLatestModule(moduleName: string): Promise { diff --git a/src/main.ts b/src/main.ts index f81f26d7..68a41d1e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,7 @@ import * as exec from '@actions/exec'; import * as io from '@actions/io'; import { FormatType, SecretParser } from 'actions-secret-parser'; -import { ServicePrincipalLogin } from './PowerShell/ServicePrincipalLogin'; +import ServicePrincipalLogin from 'PowerShell/ServicePrincipalLogin'; var azPath: string; var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : ""; diff --git a/tsconfig.json b/tsconfig.json index 7a865ad1..bbf65293 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,8 +38,11 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + "baseUrl": "src", /* Base directory to resolve non-absolute module names. */ + "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + "PowerShell/*": ["PowerShell/*"], + "PowerShell/Utilities/*": [ "PowerShell/Utilities/*"] + }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */