How to use the @ts-common/azure-js-dev-tools.joinPath 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 / sdk / core / core-http / .scripts / checkConstantsVersion.ts View on Github external
function error(text: string): void {
    logger.logError(text);
    exitCode = 1;
  }

  const packageJsonFilePath: string | undefined = findPackageJsonFileSync(__dirname);
  if (!packageJsonFilePath) {
    error("Could not find a package.json file.");
  } else {
    const packageJson: PackageJson = readPackageJsonFileSync(packageJsonFilePath);
    const packageVersion: string | undefined = packageJson.version;
    if (!packageVersion) {
      error(`Could not find a version property in ${packageJsonFilePath}.`);
    } else {
      const repositoryRootFolderPath: string = getParentFolderPath(packageJsonFilePath);
      const constantsTsFilePath: string = joinPath(repositoryRootFolderPath, "lib/util/constants.ts");
      if (!fileExistsSync(constantsTsFilePath)) {
        error(`${constantsTsFilePath} doesn't exist anymore. Where'd it go?`);
      } else {
        const constantsTsFileContents: string = readFileSync(constantsTsFilePath, { encoding: "utf8" });
        const regularExpressionString = `msRestVersion: "(.*)"`;
        const regularExpression = new RegExp(regularExpressionString);
        const match: RegExpMatchArray | null = constantsTsFileContents.match(regularExpression);
        if (!match) {
          error(`${constantsTsFilePath} doesn't contain a match for ${regularExpressionString}.`);
        } else if (match[1] !== packageVersion) {
          error(`Expected ${constantsTsFilePath} to contain an msRestVersion property with the value "${packageVersion}", but it was "${match[1]}" instead.`);
        } else {
          logger.logInfo(`${constantsTsFilePath} contained the correct value for msRestVersion ("${packageVersion}").`);
        }
      }
    }
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
import { ChangeClonedDependenciesToOptions, joinPath, resolvePath, Logger, getDefaultLogger, wrapLogger } from "@ts-common/azure-js-dev-tools";

const repositoryFolderPath: string = resolvePath(__dirname, "..");
const testFolderPath: string = joinPath(repositoryFolderPath, "test");
const multiapiFolderPath: string = joinPath(testFolderPath, "multiapi");
const multiapiPackagesFolderPath: string = joinPath(multiapiFolderPath, "packages");
export const dependenciesOptions: ChangeClonedDependenciesToOptions = {
  packageFolders: [
    {
      path: repositoryFolderPath,
      dependenciesToIgnore: ["autorest"]
    },
    joinPath(testFolderPath, "azuremetadata/generated/Lro"),
    joinPath(testFolderPath, "metadata/generated/BodyComplex"),
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2018-02-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
{
      path: repositoryFolderPath,
      dependenciesToIgnore: ["autorest"]
    },
    joinPath(testFolderPath, "azuremetadata/generated/Lro"),
    joinPath(testFolderPath, "metadata/generated/BodyComplex"),
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2018-02-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test"),
      runNPMInstall: false,
      dependenciesToIgnore: ["@azure/multiapi-test-2018-02-01"]
    },
    multiapiFolderPath
  ],
  extraFilesToUpdate: [
    joinPath(repositoryFolderPath, "src/vanilla/Model/CodeModelTS.cs"),
    joinPath(repositoryFolderPath, "src/azure/Model/CodeModelTSa.cs")
  ]
}
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test"),
      runNPMInstall: false,
      dependenciesToIgnore: ["@azure/multiapi-test-2018-02-01"]
    },
    multiapiFolderPath
  ],
  extraFilesToUpdate: [
    joinPath(repositoryFolderPath, "src/vanilla/Model/CodeModelTS.cs"),
    joinPath(repositoryFolderPath, "src/azure/Model/CodeModelTSa.cs")
  ]
}
github Azure / azure-sdk-for-js / gulpfile.ts View on Github external
}
      }
    }
  }

  const packageFolderRoot: string = path.resolve(__dirname, "sdk");
  _logger.logTrace(`INFO: Searching for package folders in ${packageFolderRoot}`);
  const packageFolderPaths: string[] | undefined = getPackageFolderPaths(packageFolderRoot);
  if (!packageFolderPaths) {
    _logger.logTrace(`INFO: The folder ${packageFolderPaths} doesn't exist.`);
  } else {
    for (const packageFolderPath of packageFolderPaths) {
      _logger.logTrace(`INFO: Processing ${packageFolderPath}`);

      const npm = new NPMScope({ executionFolderPath: packageFolderPath });
      const packageJsonFilePath: string = joinPath(packageFolderPath, "package.json");
      const packageJson: { [propertyName: string]: any } = require(packageJsonFilePath);
      const packageName: string = packageJson.name;

      if (packagesToIgnore.indexOf(packageName) !== -1) {
        _logger.log(`INFO: Skipping package ${packageName}`);
        ++skippedPackages;
      } else if (!args.package || args.package === packageName || endsWith(packageName, `-${args.package}`)) {
        const localPackageVersion: string = packageJson.version;
        if (!localPackageVersion) {
          _logger.log(`ERROR: "${packageJsonFilePath}" doesn't have a version specified.`);
          errorPackages++;
        }
        else {
          let shouldPack: boolean = false;

          if (toPack === PackagesToPack.All) {
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2018-02-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test"),
      runNPMInstall: false,
      dependenciesToIgnore: ["@azure/multiapi-test-2018-02-01"]
    },
    multiapiFolderPath
  ],
  extraFilesToUpdate: [
    joinPath(repositoryFolderPath, "src/vanilla/Model/CodeModelTS.cs"),
    joinPath(repositoryFolderPath, "src/azure/Model/CodeModelTSa.cs")
  ]
}
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
import { ChangeClonedDependenciesToOptions, joinPath, resolvePath, Logger, getDefaultLogger, wrapLogger } from "@ts-common/azure-js-dev-tools";

const repositoryFolderPath: string = resolvePath(__dirname, "..");
const testFolderPath: string = joinPath(repositoryFolderPath, "test");
const multiapiFolderPath: string = joinPath(testFolderPath, "multiapi");
const multiapiPackagesFolderPath: string = joinPath(multiapiFolderPath, "packages");
export const dependenciesOptions: ChangeClonedDependenciesToOptions = {
  packageFolders: [
    {
      path: repositoryFolderPath,
      dependenciesToIgnore: ["autorest"]
    },
    joinPath(testFolderPath, "azuremetadata/generated/Lro"),
    joinPath(testFolderPath, "metadata/generated/BodyComplex"),
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2018-02-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
    },
github Azure / azure-sdk-for-js / .scripts / common.ts View on Github external
function isPackageFolderPath(folderPath: string, packagesToIgnore: string[]): boolean {
  let result = false;
  const packageJsonFilePath: string = joinPath(folderPath, "package.json");
  if (fileExistsSync(packageJsonFilePath)) {
    const packageJson: PackageJson = readPackageJsonFileSync(packageJsonFilePath);
    result = !contains(packagesToIgnore, packageJson.name!);
  }
  return result;
}
github Azure / autorest.typescript / .scripts / dependenciesOptions.ts View on Github external
import { ChangeClonedDependenciesToOptions, joinPath, resolvePath, Logger, getDefaultLogger, wrapLogger } from "@ts-common/azure-js-dev-tools";

const repositoryFolderPath: string = resolvePath(__dirname, "..");
const testFolderPath: string = joinPath(repositoryFolderPath, "test");
const multiapiFolderPath: string = joinPath(testFolderPath, "multiapi");
const multiapiPackagesFolderPath: string = joinPath(multiapiFolderPath, "packages");
export const dependenciesOptions: ChangeClonedDependenciesToOptions = {
  packageFolders: [
    {
      path: repositoryFolderPath,
      dependenciesToIgnore: ["autorest"]
    },
    joinPath(testFolderPath, "azuremetadata/generated/Lro"),
    joinPath(testFolderPath, "metadata/generated/BodyComplex"),
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2018-02-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test-2017-10-01"),
      runNPMInstall: false
    },
    {
      path: joinPath(multiapiPackagesFolderPath, "multiapi-test"),
      runNPMInstall: false,
      dependenciesToIgnore: ["@azure/multiapi-test-2018-02-01"]
    },
    multiapiFolderPath
  ],