How to use the @microsoft/rush-lib.Rush.launch 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 microsoft / rushstack / apps / rush / src / start.ts View on Github external
const configuration: MinimalRushConfiguration | undefined = MinimalRushConfiguration.loadFromDefaultLocation();
const currentPackageJson: IPackageJson = JsonFile.load(path.join(__dirname, '..', 'package.json'));

// If we're inside a repo folder, and it's requesting a different version, then use the RushVersionManager to
//  install it
if (configuration && configuration.rushVersion !== currentPackageJson.version) {
  const versionSelector: RushVersionSelector = new RushVersionSelector(
    configuration.homeFolder,
    currentPackageJson.version
  );
  const rushWrapper: () => void = versionSelector.ensureRushVersionInstalled(configuration.rushVersion);
  rushWrapper();
} else {
  // Otherwise invoke the rush-lib that came with this rush package
  const isManaged: boolean = !!configuration && configuration.rushVersion === currentPackageJson.version;
  Rush.launch(
    currentPackageJson.version,
    isManaged // Rush is "managed" if its version and configuration are dictated by a repo's rush.json
  );
}