How to use the @ts-common/azure-js-dev-tools.getArgument function in @ts-common/azure-js-dev-tools

To help you get started, we’ve selected a few @ts-common/azure-js-dev-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
result = PackagesToPack[option] as any;
        break;
      }
    }
  }
  return result;
}

const args: CommandLineOptions = getCommandLineOptions();
const _logger: Logger = Logger.get();

const azureSDKForJSRepoRoot: string = getArgument("azure-sdk-for-js-repo-root", { defaultValue: __dirname })!;
const rawToPack: string | undefined = getArgument("to-pack");
let toPack: PackagesToPack = getPackagesToPackArgument(rawToPack);
const headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
const baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });

function getDropFolderPath(): string {
  let result: string | undefined = getArgument("drop");
  if (!result) {
    result = "drop";
  }
  if (!path.isAbsolute(result)) {
    result = path.join(azureSDKForJSRepoRoot, result);
  }
  return result;
}

const dropFolderPath: string = getDropFolderPath();
if (!fs.existsSync(dropFolderPath)) {
  fs.mkdirSync(dropFolderPath);
}
github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
function getDropFolderPath(): string {
  let result: string | undefined = getArgument("drop");
  if (!result) {
    result = "drop";
  }
  if (!path.isAbsolute(result)) {
    result = path.join(azureSDKForJSRepoRoot, result);
  }
  return result;
}
github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
if (toPackArgument) {
    const toPackArgumentLower: string = toPackArgument.toLowerCase();
    for (const option in PackagesToPack) {
      if (option.toLowerCase() === toPackArgumentLower) {
        result = PackagesToPack[option] as any;
        break;
      }
    }
  }
  return result;
}

const args: CommandLineOptions = getCommandLineOptions();
const _logger: Logger = Logger.get();

const azureSDKForJSRepoRoot: string = getArgument("azure-sdk-for-js-repo-root", { defaultValue: __dirname })!;
const rawToPack: string | undefined = getArgument("to-pack");
let toPack: PackagesToPack = getPackagesToPackArgument(rawToPack);
const headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
const baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });

function getDropFolderPath(): string {
  let result: string | undefined = getArgument("drop");
  if (!result) {
    result = "drop";
  }
  if (!path.isAbsolute(result)) {
    result = path.join(azureSDKForJSRepoRoot, result);
  }
  return result;
}
github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
if (option.toLowerCase() === toPackArgumentLower) {
        result = PackagesToPack[option] as any;
        break;
      }
    }
  }
  return result;
}

const args: CommandLineOptions = getCommandLineOptions();
const _logger: Logger = Logger.get();

const azureSDKForJSRepoRoot: string = getArgument("azure-sdk-for-js-repo-root", { defaultValue: __dirname })!;
const rawToPack: string | undefined = getArgument("to-pack");
let toPack: PackagesToPack = getPackagesToPackArgument(rawToPack);
const headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
const baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });

function getDropFolderPath(): string {
  let result: string | undefined = getArgument("drop");
  if (!result) {
    result = "drop";
  }
  if (!path.isAbsolute(result)) {
    result = path.join(azureSDKForJSRepoRoot, result);
  }
  return result;
}

const dropFolderPath: string = getDropFolderPath();
if (!fs.existsSync(dropFolderPath)) {
  fs.mkdirSync(dropFolderPath);
github Azure / azure-sdk-for-js / .scripts / checkEverything.ts View on Github external
const logger: Logger = getDefaultLogger();
const changedFiles: string[] = [];

let headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
if (!headReference) {
  const statusResult: GitStatusResult = gitStatus();
  headReference = statusResult.localBranch!;
  logger.logInfo(`No head-reference argument specified on command line or in environment variables. Defaulting to "${headReference}".`);

  const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
  if (modifiedFiles) {
    changedFiles.push(...modifiedFiles);
  }
}

let baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });
if (!baseReference) {
  baseReference = "master";
  logger.logInfo(`No base-reference argument specified on command line or in environment variables. Defaulting to "${baseReference}".`);
}

if (baseReference !== headReference) {
  const diffResult: GitDiffResult = gitDiff(baseReference, headReference);
  changedFiles.push(...diffResult.filesChanged);
  if (!changedFiles || changedFiles.length === 0) {
    logger.logInfo(`Found no changes between "${baseReference}" and "${headReference}".`);
  } else {
    logger.logVerbose(`Found the following changed files`)
    for (const changedFilePath of changedFiles) {
      logger.logVerbose(changedFilePath);
    }
  }
github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
const toPackArgumentLower: string = toPackArgument.toLowerCase();
    for (const option in PackagesToPack) {
      if (option.toLowerCase() === toPackArgumentLower) {
        result = PackagesToPack[option] as any;
        break;
      }
    }
  }
  return result;
}

const args: CommandLineOptions = getCommandLineOptions();
const _logger: Logger = Logger.get();

const azureSDKForJSRepoRoot: string = getArgument("azure-sdk-for-js-repo-root", { defaultValue: __dirname })!;
const rawToPack: string | undefined = getArgument("to-pack");
let toPack: PackagesToPack = getPackagesToPackArgument(rawToPack);
const headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
const baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });

function getDropFolderPath(): string {
  let result: string | undefined = getArgument("drop");
  if (!result) {
    result = "drop";
  }
  if (!path.isAbsolute(result)) {
    result = path.join(azureSDKForJSRepoRoot, result);
  }
  return result;
}

const dropFolderPath: string = getDropFolderPath();
github Azure / azure-sdk-for-js / .scripts / checkEverything.ts View on Github external
import { checkEverything, contains, getArgument, getDefaultLogger, gitDiff, GitDiffResult, gitStatus, GitStatusResult, joinPath, Logger, normalize, resolvePath } from "@ts-common/azure-js-dev-tools";
import * as path from "path";
import { getPackageFolderPaths } from "./common";

const logger: Logger = getDefaultLogger();
const changedFiles: string[] = [];

let headReference: string | undefined = getArgument("head-reference", { environmentVariableName: "headReference" });
if (!headReference) {
  const statusResult: GitStatusResult = gitStatus();
  headReference = statusResult.localBranch!;
  logger.logInfo(`No head-reference argument specified on command line or in environment variables. Defaulting to "${headReference}".`);

  const modifiedFiles: string[] | undefined = statusResult.modifiedFiles;
  if (modifiedFiles) {
    changedFiles.push(...modifiedFiles);
  }
}

let baseReference: string | undefined = getArgument("base-reference", { environmentVariableName: "baseReference" });
if (!baseReference) {
  baseReference = "master";
  logger.logInfo(`No base-reference argument specified on command line or in environment variables. Defaulting to "${baseReference}".`);
}