Skip to content

Commit a4d4e1d

Browse files
committed
fix(exports): preserve CRLF line endings in package.json
closes #832
1 parent 6151433 commit a4d4e1d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/features/pkg/exports.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ export async function writeExports(
124124

125125
const original = readFileSync(pkg.packageJsonPath, 'utf8')
126126
let contents = JSON.stringify(updatedPkg, null, detectIndentation(original))
127+
if (original.includes('\r\n')) {
128+
contents = contents.replaceAll('\n', '\r\n')
129+
}
127130
if (original.endsWith('\n')) contents += '\n'
128131
if (contents !== original) {
129132
writeFileSync(pkg.packageJsonPath, contents, 'utf8')

0 commit comments

Comments
 (0)