@@ -8,23 +8,19 @@ import * as path from 'path';
88
99import {
1010 default as RushConfiguration
11- } from '../../data/RushConfiguration' ;
12- import Utilities from '../../utilities/Utilities' ;
13- import { Stopwatch } from '../../utilities/Stopwatch' ;
14- import Package from './Package ' ;
11+ } from '../../../ data/RushConfiguration' ;
12+ import Utilities from '../../../ utilities/Utilities' ;
13+ import { Stopwatch } from '../../../ utilities/Stopwatch' ;
14+ import { BasePackage } from './BasePackage ' ;
1515
1616export enum SymlinkKind {
1717 File ,
1818 Directory
1919}
2020
21- export default abstract class LinkManager {
21+ export abstract class BaseLinkManager {
2222 protected _rushConfiguration : RushConfiguration ;
2323
24- public static getLinkManager ( rushConfiguration : RushConfiguration ) : LinkManager {
25- return new ( require ( './npm/NpmLinkManager' ) . default ) ( rushConfiguration ) ;
26- }
27-
2824 protected static _createSymlink ( linkTarget : string , linkSource : string , symlinkKind : SymlinkKind ) : void {
2925 fsx . mkdirsSync ( path . dirname ( linkSource ) ) ;
3026
@@ -49,7 +45,7 @@ export default abstract class LinkManager {
4945 * (i.e. with source code that we will be building), this clears out its
5046 * node_modules folder and then recursively creates all the symlinked folders.
5147 */
52- protected static _createSymlinksForTopLevelProject ( localPackage : Package ) : void {
48+ protected static _createSymlinksForTopLevelProject ( localPackage : BasePackage ) : void {
5349 const localModuleFolder : string = path . join ( localPackage . folderPath , 'node_modules' ) ;
5450
5551 // Sanity check
@@ -66,7 +62,7 @@ export default abstract class LinkManager {
6662 Utilities . createFolderWithRetry ( localModuleFolder ) ;
6763
6864 for ( const child of localPackage . children ) {
69- LinkManager . _createSymlinksForDependencies ( child ) ;
65+ BaseLinkManager . _createSymlinksForDependencies ( child ) ;
7066 }
7167 }
7268 }
@@ -76,7 +72,7 @@ export default abstract class LinkManager {
7672 * It will recursively creates symlinked folders corresponding to each of the
7773 * Package objects in the provided tree.
7874 */
79- private static _createSymlinksForDependencies ( localPackage : Package ) : void {
75+ private static _createSymlinksForDependencies ( localPackage : BasePackage ) : void {
8076 const localModuleFolder : string = path . join ( localPackage . folderPath , 'node_modules' ) ;
8177
8278 if ( ! localPackage . symlinkTargetFolderPath ) {
@@ -95,7 +91,10 @@ export default abstract class LinkManager {
9591
9692 if ( localPackage . children . length === 0 ) {
9793 // If there are no children, then we can symlink the entire folder
98- LinkManager . _createSymlink ( localPackage . symlinkTargetFolderPath , localPackage . folderPath , SymlinkKind . Directory ) ;
94+ BaseLinkManager . _createSymlink (
95+ localPackage . symlinkTargetFolderPath ,
96+ localPackage . folderPath ,
97+ SymlinkKind . Directory ) ;
9998 } else {
10099 // If there are children, then we need to symlink each item in the folder individually
101100 Utilities . createFolderWithRetry ( localPackage . folderPath ) ;
@@ -126,7 +125,7 @@ export default abstract class LinkManager {
126125 symlinkKind = SymlinkKind . Directory ;
127126 }
128127
129- LinkManager . _createSymlink ( linkTarget , linkSource , symlinkKind ) ;
128+ BaseLinkManager . _createSymlink ( linkTarget , linkSource , symlinkKind ) ;
130129 }
131130 }
132131 }
@@ -135,7 +134,7 @@ export default abstract class LinkManager {
135134 Utilities . createFolderWithRetry ( localModuleFolder ) ;
136135
137136 for ( const child of localPackage . children ) {
138- LinkManager . _createSymlinksForDependencies ( child ) ;
137+ BaseLinkManager . _createSymlinksForDependencies ( child ) ;
139138 }
140139 }
141140 }
0 commit comments