Skip to content

Commit 8e8bfe2

Browse files
committed
fix(starter): fix up vscode settings merge 🚀
1 parent 05d9c85 commit 8e8bfe2

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

‎.changeset/heavy-windows-mate.md

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+
FIX: fix up vscode settings merge. Use JSON5 to parse that file to prevent parsing errors.

‎packages/qwik/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"domino": "2.1.6",
3434
"ignore": "5.3.1",
3535
"image-size": "1.1.1",
36+
"json5": "^2.2.3",
3637
"kleur": "4.1.5",
3738
"ts-morph": "23.0.0"
3839
},

‎packages/qwik/src/cli/add/update-files.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json5 from 'json5';
12
import fs from 'node:fs';
23
import { extname, join } from 'node:path';
34
import type { FsUpdates, UpdateAppOptions } from '../types';
@@ -29,7 +30,7 @@ export async function mergeIntegrationDir(
2930
if (destName === 'package.json') {
3031
await mergePackageJsons(fileUpdates, srcChildPath, destRootPath);
3132
} else if (destName === 'settings.json') {
32-
await mergeJsons(fileUpdates, srcChildPath, finalDestPath);
33+
await mergeSettings(fileUpdates, srcChildPath, finalDestPath);
3334
} else if (destName === 'README.md') {
3435
await mergeReadmes(fileUpdates, srcChildPath, finalDestPath);
3536
} else if (
@@ -110,11 +111,11 @@ async function mergePackageJsons(fileUpdates: FsUpdates, srcPath: string, destPa
110111
}
111112
}
112113

113-
async function mergeJsons(fileUpdates: FsUpdates, srcPath: string, destPath: string) {
114+
async function mergeSettings(fileUpdates: FsUpdates, srcPath: string, destPath: string) {
114115
const srcContent = await fs.promises.readFile(srcPath, 'utf-8');
115116
try {
116117
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'));
118119
Object.assign(srcPkgJson, destPkgJson);
119120

120121
fileUpdates.files.push({

‎pnpm-lock.yaml

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

0 commit comments

Comments
 (0)