How to use the @microsoft/rush-lib._LastInstallFlag 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 / RushVersionSelector.ts View on Github external
public ensureRushVersionInstalled(
    version: string,
    configuration: MinimalRushConfiguration | undefined
  ): Promise {
    const isLegacyRushVersion: boolean = semver.lt(version, '4.0.0');
    const expectedRushPath: string = path.join(this._rushGlobalFolder.nodeSpecificPath, `rush-${version}`);

    const installMarker: _LastInstallFlag = new _LastInstallFlag(expectedRushPath, {
      node: process.versions.node
    });

    let installPromise: Promise = Promise.resolve();

    if (!installMarker.isValid()) {
      installPromise = installPromise.then(() => {
        // Need to install Rush
        console.log(`Rush version ${version} is not currently installed. Installing...`);

        const resourceName: string = `rush-${version}`;

        console.log(`Trying to acquire lock for ${resourceName}`);

        return LockFile.acquire(expectedRushPath, resourceName).then((lock: LockFile) => {
          if (installMarker.isValid()) {