Skip to content

Commit 567bed9

Browse files
committed
chore: don't update peer deps with upgrade script
1 parent d783483 commit 567bed9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/upgrade-template-deps.mts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,21 @@ function updateDeps(filePath: string, changes: Record<string, Change>) {
7373
});
7474

7575
const content = fs.readFileSync(filePath, 'utf8');
76+
let inDepSection = false;
7677

7778
const updated = content
7879
.split('\n')
7980
.map((line) => {
80-
// Skip lines with EJS expressions (dynamically resolved versions)
81-
if (line.includes('<%')) {
81+
if (
82+
line.includes('"dependencies"') ||
83+
line.includes('"devDependencies"')
84+
) {
85+
inDepSection = true;
86+
} else if (inDepSection && /^\s*[}\]]/.test(line)) {
87+
inDepSection = false;
88+
}
89+
90+
if (!inDepSection || line.includes('<%')) {
8291
return line;
8392
}
8493

0 commit comments

Comments
 (0)