Skip to content

Commit b870ea6

Browse files
authored
[rush-lib] Normalize plugin autoinstaller file line endings (#5678)
Made-with: Cursor
1 parent f8a668d commit b870ea6

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Fix autoinstaller plugin loader behavior.",
5+
"type": "none",
6+
"packageName": "@microsoft/rush"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "61671317+kevin-y-ang@users.noreply.github.com"
11+
}

libraries/rush-lib/src/pluginFramework/PluginLoader/AutoinstallerPluginLoader.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as path from 'node:path';
66
import {
77
FileSystem,
88
JsonFile,
9+
NewlineKind,
910
PosixModeBits,
1011
type JsonObject,
1112
type JsonSchema
@@ -68,9 +69,11 @@ export class AutoinstallerPluginLoader extends PluginLoaderBase<IRushPluginConfi
6869
);
6970

7071
const destinationManifestPath: string = this._getManifestPath();
71-
FileSystem.copyFile({
72-
sourcePath: manifestPath,
73-
destinationPath: destinationManifestPath
72+
73+
// Use read+write instead of copy to ensure line endings are normalized
74+
const manifestContent: string = FileSystem.readFile(manifestPath);
75+
FileSystem.writeFile(destinationManifestPath, manifestContent, {
76+
convertLineEndings: NewlineKind.Lf
7477
});
7578
// Make permission consistent since it will be committed to Git
7679
FileSystem.changePosixModeBits(
@@ -98,9 +101,11 @@ export class AutoinstallerPluginLoader extends PluginLoaderBase<IRushPluginConfi
98101
);
99102
}
100103
const destinationCommandLineJsonFilePath: string = this._getCommandLineJsonFilePath();
101-
FileSystem.copyFile({
102-
sourcePath: commandLineJsonFullFilePath,
103-
destinationPath: destinationCommandLineJsonFilePath
104+
105+
// Use read+write instead of copy to ensure line endings are normalized
106+
const commandLineContent: string = FileSystem.readFile(commandLineJsonFullFilePath);
107+
FileSystem.writeFile(destinationCommandLineJsonFilePath, commandLineContent, {
108+
convertLineEndings: NewlineKind.Lf
104109
});
105110
// Make permission consistent since it will be committed to Git
106111
FileSystem.changePosixModeBits(

0 commit comments

Comments
 (0)