-
-
Notifications
You must be signed in to change notification settings - Fork 158
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Clear and concise description of the problem
I use (and love) the exports feature of tsdown. However tsdown always writes LF line endings which causes the package.json files to to show up as changed until I stage them and git converts the line endings back to CRLF.
Would be cool if this could be changed in the options.
Suggested solution
In the options of tsdown there should be an option to set the line endings like
const options {
endOfLine: '\n' | '\r\n' | 'auto'
}where auto would use \n on unix and \r\n on windows
Alternative
No response
Additional context
To circumvent this I currently use a build:done hook which ensures the line endings are correct for the current OS
export async function fixLineEndingsHook() {
const packageJsonBuff = await readFile("./package.json", null);
const packageJsonContents = packageJsonBuff.toString();
const lineEndingFrom = platform() === "win32" ? /(?<!\r)\n/g : /\r\n/g;
const lineEndingTo = platform() === "win32" ? "\r\n" : "\n";
const packageJsonFixed = packageJsonContents.replaceAll(lineEndingFrom, lineEndingTo);
await writeFile("./package.json", packageJsonFixed);
}Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Fields
Give feedbackPriority
None yet
Start date
None yet
Target date
None yet
Effort
None yet