Skip to content

Commit f484ef8

Browse files
committed
Normalize ordering of linkTargetPath and linkPath to match NodeJS
1 parent 2dccd4d commit f484ef8

2 files changed

Lines changed: 19 additions & 21 deletions

File tree

‎apps/rush-lib/src/logic/base/BaseLinkManager.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ export abstract class BaseLinkManager {
3131
if (options.symlinkKind === SymlinkKind.Directory) {
3232
// For directories, we use a Windows "junction". On Unix, this produces a regular symlink.
3333
FileSystem.createSymbolicLinkJunction({
34-
linkPath: options.linkPath,
35-
linkTargetPath: options.linkTargetPath
36-
});
34+
linkTargetPath: options.linkTargetPath,
35+
linkPath: options.linkPath
36+
});
3737
} else {
3838
if (process.platform === 'win32') {
3939
// For files, we use a Windows "hard link", because creating a symbolic link requires
4040
// administrator permission.
4141
FileSystem.createHardLink({
42-
linkPath: options.linkPath,
43-
linkTargetPath: options.linkTargetPath
44-
});
42+
linkTargetPath: options.linkTargetPath,
43+
linkPath: options.linkPath
44+
});
4545
} else {
4646
// However hard links seem to cause build failures on Mac, so for all other operating systems
4747
// we use symbolic links for this case.
4848
FileSystem.createSymbolicLinkFile({
49-
linkPath: options.linkPath,
50-
linkTargetPath: options.linkTargetPath
51-
});
49+
linkTargetPath: options.linkTargetPath,
50+
linkPath: options.linkPath
51+
});
5252
}
5353
}
5454
}
@@ -105,8 +105,8 @@ export abstract class BaseLinkManager {
105105
if (localPackage.children.length === 0) {
106106
// If there are no children, then we can symlink the entire folder
107107
BaseLinkManager._createSymlink({
108-
linkPath: localPackage.symlinkTargetFolderPath,
109-
linkTargetPath: localPackage.folderPath,
108+
linkTargetPath: localPackage.symlinkTargetFolderPath,
109+
linkPath: localPackage.folderPath,
110110
symlinkKind: SymlinkKind.Directory
111111
});
112112
} else {
@@ -141,8 +141,8 @@ export abstract class BaseLinkManager {
141141
}
142142

143143
BaseLinkManager._createSymlink({
144-
linkPath: linkSource,
145144
linkTargetPath: linkTarget,
145+
linkPath: linkSource,
146146
symlinkKind
147147
});
148148
}

‎libraries/node-core-library/src/FileSystem.ts‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export interface IFileSystemReadFileOptions {
7171
*/
7272
export interface IFileSystemMoveOptions {
7373
/**
74-
* The path of the object to be moved.
74+
* The path of the existing object to be moved.
7575
* The path may be absolute or relative.
7676
*/
7777
sourcePath: string;
@@ -100,7 +100,7 @@ export interface IFileSystemMoveOptions {
100100
*/
101101
export interface IFileSystemCopyFileOptions {
102102
/**
103-
* The path of the object that will be copied.
103+
* The path of the existing object to be copied.
104104
* The path may be absolute or relative.
105105
*/
106106
sourcePath: string;
@@ -149,14 +149,14 @@ export interface IFileSystemUpdateTimeParameters {
149149
*/
150150
export interface IFileSystemCreateLinkOptions {
151151
/**
152-
* The path where the new symlink link will be created.
152+
* The existing path that the symbolic link will point to.
153153
*/
154-
linkPath: string;
154+
linkTargetPath: string;
155155

156156
/**
157-
* The newly created symbolic link will point to this target.
157+
* The new path for the new symlink link to be created.
158158
*/
159-
linkTargetPath: string;
159+
linkPath: string;
160160
}
161161

162162
/**
@@ -171,7 +171,7 @@ export interface IFileSystemCreateLinkOptions {
171171
* performance, versus improving it.
172172
*
173173
* Note that in the documentation, we refer to "filesystem objects", this can be a
174-
* file, folder, synbolic link, hard link, directory junction, etc.
174+
* file, folder, symbolic link, hard link, directory junction, etc.
175175
*
176176
* @public
177177
*/
@@ -448,8 +448,6 @@ export class FileSystem {
448448
/**
449449
* Creates a Windows "directory junction". Behaves like `createSymbolicLinkToFile()` on other platforms.
450450
* Behind the scenes it uses `fs.symlinkSync()`.
451-
* @param linkSource - The absolute or relative path to the destination where the link should be created.
452-
* @param linkTarget - The absolute or relative path to the target of the link.
453451
*/
454452
public static createSymbolicLinkJunction(options: IFileSystemCreateLinkOptions): void {
455453
// For directories, we use a Windows "junction". On POSIX operating systems, this produces a regular symlink.

0 commit comments

Comments
 (0)