|
| 1 | +import json5 from 'json5'; |
1 | 2 | import fs from 'node:fs'; |
2 | 3 | import { extname, join } from 'node:path'; |
3 | 4 | import type { FsUpdates, UpdateAppOptions } from '../types'; |
@@ -29,7 +30,7 @@ export async function mergeIntegrationDir( |
29 | 30 | if (destName === 'package.json') { |
30 | 31 | await mergePackageJsons(fileUpdates, srcChildPath, destRootPath); |
31 | 32 | } else if (destName === 'settings.json') { |
32 | | - await mergeJsons(fileUpdates, srcChildPath, finalDestPath); |
| 33 | + await mergeSettings(fileUpdates, srcChildPath, finalDestPath); |
33 | 34 | } else if (destName === 'README.md') { |
34 | 35 | await mergeReadmes(fileUpdates, srcChildPath, finalDestPath); |
35 | 36 | } else if ( |
@@ -110,11 +111,11 @@ async function mergePackageJsons(fileUpdates: FsUpdates, srcPath: string, destPa |
110 | 111 | } |
111 | 112 | } |
112 | 113 |
|
113 | | -async function mergeJsons(fileUpdates: FsUpdates, srcPath: string, destPath: string) { |
| 114 | +async function mergeSettings(fileUpdates: FsUpdates, srcPath: string, destPath: string) { |
114 | 115 | const srcContent = await fs.promises.readFile(srcPath, 'utf-8'); |
115 | 116 | try { |
116 | 117 | const srcPkgJson = JSON.parse(srcContent); |
117 | | - const destPkgJson = JSON.parse(await fs.promises.readFile(destPath, 'utf-8')); |
| 118 | + const destPkgJson = json5.parse(await fs.promises.readFile(destPath, 'utf-8')); |
118 | 119 | Object.assign(srcPkgJson, destPkgJson); |
119 | 120 |
|
120 | 121 | fileUpdates.files.push({ |
|
0 commit comments