How to use the @microsoft/rush-lib.RushConfiguration.loadFromDefaultLocation function in @microsoft/rush-lib

To help you get started, we’ve selected a few @microsoft/rush-lib 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 github / vscode-codeql / tools / build-tasks / src / typescript.ts View on Github external
export function compileTypeScript() {
  // Find this project's relative directory. Rush already knows this, so just ask.
  const packageDir = path.resolve('.');
  const rushConfig = RushConfiguration.loadFromDefaultLocation({
    startingFolder: packageDir
  });
  const project = rushConfig.tryGetProjectForPath(packageDir);
  if (!project) {
    console.error(`Unable to find project for '${packageDir}' in 'rush.json'.`);
    throw Error();
  }

  //REVIEW: Better way to detect deployable projects?
  // Since extension .js files are deployed to 'dist//out', and libraries are deployed to
  // 'dist//node_modules//out'.
  const pathToRoot = (path.dirname(project.projectRelativeFolder) === 'extensions') ?
    '../../..' : '../../../../..';

  return tsProject.src()
    .pipe(sourcemaps.init())
github microsoft / rushstack / repo-scripts / repo-toolbox / src / ReadmeAction.ts View on Github external
protected onExecute(): Promise { // abstract

    const rushConfiguration: RushConfiguration = RushConfiguration.loadFromDefaultLocation();

    const builder: StringBuilder = new StringBuilder();
    const orderedProjects: RushConfigurationProject[] = [...rushConfiguration.projects];
    Sort.sortBy(orderedProjects, x => x.projectRelativeFolder);

    builder.append('## Published Packages\n\n');
    builder.append('\n\n');
    builder.append('| Folder | Version | Changelog | Package |\n');
    builder.append('| ------ | ------- | --------- | ------- |\n');
    for (const project of orderedProjects.filter(x => ReadmeAction._isPublished(x))) {

      // Example:
      //
      // | [/apps/api-extractor](./apps/api-extractor/)
      // | [![npm version](https://badge.fury.io/js/%40microsoft%2Fapi-extractor.svg
      //     )](https://badge.fury.io/js/%40microsoft%2Fapi-extractor)
github microsoft / rushstack / rush / rush / src / actions / LinkAction.ts View on Github external
protected onExecute(): void {
    this._rushConfiguration = this._rushConfiguration = RushConfiguration.loadFromDefaultLocation();

    console.log('Starting "rush link"');
    const stopwatch: Stopwatch = Stopwatch.start();

    readPackageTree(this._rushConfiguration.commonFolder, (error: Error, npmPackage: PackageNode) => {
      this._parser.trapErrors(() => {
        if (error) {
          throw error;
        } else {
          const commonRootPackage: Package = Package.createFromNpm(npmPackage);

          const commonPackageLookup: PackageLookup = new PackageLookup();
          commonPackageLookup.loadTree(commonRootPackage);

          const rushLinkJson: IRushLinkJson = { localLinks: {} };
github microsoft / rushstack / apps / rush-buildxl / src / cli / actions / CleanAction.ts View on Github external
protected async onExecute(): Promise {
    const rushConfig: RushConfiguration = RushConfiguration.loadFromDefaultLocation();

    FileSystem.deleteFolder(path.resolve(rushConfig.commonTempFolder, 'bxl', 'modules'));

    this._terminal.writeLine(`Successfully cleaned BuildXL configuration.`);
  }
}
github microsoft / rushstack / apps / rush-buildxl / src / cli / actions / GenerateAction.ts View on Github external
protected async onExecute(): Promise {
    if (process.env.BUILDXL_BIN === undefined) {
      throw new Error('Environment variable BUILDXL_BIN not defined');
    }

    const generator: BxlModulesGenerator =
        new BxlModulesGenerator(
          RushConfiguration.loadFromDefaultLocation(),
          process.env.BUILDXL_BIN);

    await generator.run();
    this._terminal.writeLine(`Successfully generated BuildXL configuration.`);
  }
}