Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "Fix autoinstaller plugin loader behavior.",
"type": "none",
"packageName": "@microsoft/rush"
}
],
"packageName": "@microsoft/rush",
"email": "61671317+kevin-y-ang@users.noreply.github.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as path from 'node:path';
import {
FileSystem,
JsonFile,
NewlineKind,
PosixModeBits,
type JsonObject,
type JsonSchema
Expand Down Expand Up @@ -68,9 +69,11 @@ export class AutoinstallerPluginLoader extends PluginLoaderBase<IRushPluginConfi
);

const destinationManifestPath: string = this._getManifestPath();
FileSystem.copyFile({
sourcePath: manifestPath,
destinationPath: destinationManifestPath

// Use read+write instead of copy to ensure line endings are normalized
const manifestContent: string = FileSystem.readFile(manifestPath);
FileSystem.writeFile(destinationManifestPath, manifestContent, {
convertLineEndings: NewlineKind.Lf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this create the opposite problem on Windows?

I wonder if NewlineKind.OsDefault: is better or worse than NewlineKind.Lf. 🤔

@dmichon-msft @iclanton

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image It seems like NewlineKind.Lf is the default option across the codebase, appearing 11 times. image On the other hand, NewlineKind.OsDefault appears 2 times.

});
// Make permission consistent since it will be committed to Git
FileSystem.changePosixModeBits(
Expand Down Expand Up @@ -98,9 +101,11 @@ export class AutoinstallerPluginLoader extends PluginLoaderBase<IRushPluginConfi
);
}
const destinationCommandLineJsonFilePath: string = this._getCommandLineJsonFilePath();
FileSystem.copyFile({
sourcePath: commandLineJsonFullFilePath,
destinationPath: destinationCommandLineJsonFilePath

// Use read+write instead of copy to ensure line endings are normalized
const commandLineContent: string = FileSystem.readFile(commandLineJsonFullFilePath);
FileSystem.writeFile(destinationCommandLineJsonFilePath, commandLineContent, {
convertLineEndings: NewlineKind.Lf
});
// Make permission consistent since it will be committed to Git
FileSystem.changePosixModeBits(
Expand Down