Skip to content

Commit

Permalink
Add check for the same number of scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
beerose committed Jan 16, 2025
1 parent 38add42 commit 57cd54a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/codemod/__tests__/package-json-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ describe('Package JSON Update Script', () => {
'@edgedb/auth': '^1.0.0'
},
scripts: {
generate: 'npx @edgedb/generate edgeql'
generate: 'npx @edgedb/generate edgeql',
other: 'npx do-something'
}
};

Expand Down Expand Up @@ -53,7 +54,8 @@ describe('Package JSON Update Script', () => {
'@gel/auth': '^1.0.0'
},
scripts: {
generate: 'npx @gel/generate edgeql'
generate: 'npx @gel/generate edgeql',
other: 'npx do-something'
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/scripts/package-json-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function updatePackageJson(filePath: string): Promise<string[]> {
}
}

if (Object.keys(updatedScripts).length > 0) {
if (Object.keys(updatedScripts).length > 0 && Object.keys(updatedScripts).length === Object.keys(pkg.scripts).length) {
pkg.scripts = updatedScripts;
}
}
Expand Down

0 comments on commit 57cd54a

Please sign in to comment.