Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/heavy-windows-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-qwik': patch
---

FIX: fix up vscode settings merge. Use JSON5 to parse settings.json to prevent parsing errors.
1 change: 1 addition & 0 deletions packages/qwik/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"domino": "2.1.6",
"ignore": "5.3.1",
"image-size": "1.1.1",
"json5": "2.2.3",
"kleur": "4.1.5",
"ts-morph": "23.0.0"
},
Expand Down
9 changes: 5 additions & 4 deletions packages/qwik/src/cli/add/update-files.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json5 from 'json5';
import fs from 'node:fs';
import { extname, join } from 'node:path';
import type { FsUpdates, UpdateAppOptions } from '../types';
Expand Down Expand Up @@ -29,7 +30,7 @@ export async function mergeIntegrationDir(
if (destName === 'package.json') {
await mergePackageJsons(fileUpdates, srcChildPath, destRootPath);
} else if (destName === 'settings.json') {
await mergeJsons(fileUpdates, srcChildPath, finalDestPath);
await mergeSettings(fileUpdates, srcChildPath, finalDestPath);
} else if (destName === 'README.md') {
await mergeReadmes(fileUpdates, srcChildPath, finalDestPath);
} else if (
Expand Down Expand Up @@ -110,11 +111,11 @@ async function mergePackageJsons(fileUpdates: FsUpdates, srcPath: string, destPa
}
}

async function mergeJsons(fileUpdates: FsUpdates, srcPath: string, destPath: string) {
async function mergeSettings(fileUpdates: FsUpdates, srcPath: string, destPath: string) {
const srcContent = await fs.promises.readFile(srcPath, 'utf-8');
try {
const srcPkgJson = JSON.parse(srcContent);
const destPkgJson = JSON.parse(await fs.promises.readFile(destPath, 'utf-8'));
const srcPkgJson = json5.parse(srcContent);
const destPkgJson = json5.parse(await fs.promises.readFile(destPath, 'utf-8'));
Object.assign(srcPkgJson, destPkgJson);

fileUpdates.files.push({
Expand Down
10 changes: 10 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading