How to use the @microsoft/rush-lib.Utilities.dangerouslyDeletePath 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 / rush / rush / src / utilities / TempModuleGenerator.ts View on Github external
public regenerateAndValidateShrinkwrap(shrinkwrapFile: ShrinkwrapFile|undefined): boolean {
    console.log('Creating temp projects...');
    if (fsx.existsSync(this._rushConfiguration.tempModulesFolder)) {
      Utilities.dangerouslyDeletePath(this._rushConfiguration.tempModulesFolder);
    }

    Utilities.createFolderWithRetry(this._rushConfiguration.tempModulesFolder);

    let shrinkwrapIsValid: boolean = true;

    if (shrinkwrapFile) {
      // Check any pinned dependencies first
      this._rushConfiguration.pinnedVersions.forEach((version: string, dependency: string) => {
        if (!shrinkwrapFile.hasCompatibleDependency(dependency, version)) {
          console.log(colors.yellow(
            `${os.EOL}The NPM shrinkwrap file does satisfy pinned version ${dependency}`
            + ` ("${version}").`));
          shrinkwrapIsValid = false;
        }
      });
github microsoft / rushstack / rush / rush / src / actions / LinkAction.ts View on Github external
function createSymlinksForTopLevelProject(localPackage: Package): void {
  const localModuleFolder: string = path.join(localPackage.folderPath, 'node_modules');

  // Sanity check
  if (localPackage.parent) {
    throw new Error('The provided package is not a top-level project');
  }

  // The root-level folder is the project itself, so we simply delete its node_modules
  // to start clean
  console.log('Purging ' + localModuleFolder);
  Utilities.dangerouslyDeletePath(localModuleFolder);

  if (localPackage.children.length > 0) {
    Utilities.createFolderWithRetry(localModuleFolder);

    for (const child of localPackage.children) {
      createSymlinksForDependencies(child);
    }
  }
}