22// See LICENSE in the project root for license information.
33
44import * as path from 'path' ;
5+ import { FileSystem } from '@microsoft/node-core-library' ;
56
67import { RushConfiguration } from '../api/RushConfiguration' ;
78import { Utilities } from '../utilities/Utilities' ;
8- import { FileSystem } from '@microsoft/node-core-library ' ;
9+ import { PnpmProjectDependencyManifest } from './pnpm/PnpmProjectDependencyManifest ' ;
910
1011/**
1112 * This class implements the logic for "rush unlink"
@@ -18,31 +19,45 @@ export class UnlinkManager {
1819 }
1920
2021 /**
21- * Delete flag file and all the existing node_modules
22- * symlinks
22+ * Delete flag file and all the existing node_modules symlinks and all
23+ * project/.rush/temp/project-dependencies.json files
24+ *
25+ * Returns true if anything was deleted.
2326 */
2427 public unlink ( ) : boolean {
2528 this . _deleteFlagFile ( ) ;
26- return this . _deleteSymlinks ( ) ;
29+ return this . _deleteProjectFiles ( ) ;
2730 }
2831
2932 /**
30- * Delete all the node_modules symlinks of configured Rush
31- * projects
33+ * Delete:
34+ * - all the node_modules symlinks of configured Rush projects
35+ * - all of the project/.rush/temp/project-dependencies.json files of configured Rush projects
36+ *
37+ * Returns true if anything was deleted
3238 * */
33- private _deleteSymlinks ( ) : boolean {
34- let didDeleteSymlinks : boolean = false ;
39+ private _deleteProjectFiles ( ) : boolean {
40+ let didDeleteAnything : boolean = false ;
3541
3642 for ( const rushProject of this . _rushConfiguration . projects ) {
3743 const localModuleFolder : string = path . join ( rushProject . projectFolder , 'node_modules' ) ;
3844 if ( FileSystem . exists ( localModuleFolder ) ) {
39- console . log ( ' Purging ' + localModuleFolder ) ;
45+ console . log ( ` Purging ${ localModuleFolder } ` ) ;
4046 Utilities . dangerouslyDeletePath ( localModuleFolder ) ;
41- didDeleteSymlinks = true ;
47+ didDeleteAnything = true ;
48+ }
49+
50+ const projectDependencyManifestFilePath : string = PnpmProjectDependencyManifest . getFilePathForProject (
51+ rushProject
52+ ) ;
53+ if ( FileSystem . exists ( projectDependencyManifestFilePath ) ) {
54+ console . log ( `Deleting ${ projectDependencyManifestFilePath } ` ) ;
55+ FileSystem . deleteFile ( projectDependencyManifestFilePath ) ;
56+ didDeleteAnything = true ;
4257 }
4358 }
4459
45- return didDeleteSymlinks ;
60+ return didDeleteAnything ;
4661 }
4762
4863 /**
0 commit comments