Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
);
}