Skip to content

Commit 37435a7

Browse files
authored
chore: improve json5 merge 🌴 (#7884)
1 parent ae9a610 commit 37435a7

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-qwik': patch
3+
---
4+
5+
CHORE: use the new version of @croct/json5-parser to merge JSON5 and preserve comments

β€Žpackages/qwik/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"devDependencies": {
3232
"@builder.io/qwik": "workspace:^",
33-
"@croct/json5-parser": "0.1.1",
33+
"@croct/json5-parser": "0.2.0",
3434
"domino": "2.1.6",
3535
"ignore": "5.3.1",
3636
"image-size": "1.2.1",

β€Žpackages/qwik/src/cli/add/update-files.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async function mergeVSCodeSettings(fileUpdates: FsUpdates, srcPath: string, dest
119119
await fs.promises.readFile(destPath, 'utf-8'),
120120
JsonObjectNode
121121
);
122-
destPkgJson.update({ ...destPkgJson.toJSON(), ...srcPkgJson.toJSON() });
122+
destPkgJson.merge(srcPkgJson);
123123

124124
fileUpdates.files.push({
125125
path: destPath,

β€Žpackages/qwik/src/cli/add/update-files.unit.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('mergeIntegrationDir', () => {
120120
'destDir/subDestDir/package.json': '{"name": "fake"}',
121121
'destDir/subDestDir/should-stay/should-also-stay.ts': 'fake file',
122122
'destDir/subDestDir/apps/subpackage/.vscode/settings.json':
123-
'{ \n // Comment Foo\n "css.lint.unknownAtRules": "ignore",\n "name": "John Doe",\n "age": 42\n }\n',
123+
'{ \n // Comment Foo\n "css.lint.unknownAtRules": "ignore",\n // Comment\n "name": "John Doe",\n "age": 42,\n }\n',
124124
'destDir/subDestDir/apps/subpackage/src/global.css': 'p{color: red}\n\n/* CSS */\n',
125125
};
126126
for (const [fileName, content] of Object.entries(tests)) {

β€Žpnpm-lock.yamlβ€Ž

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)