Skip to content

Commit

Permalink
fix: handle missing fields in migrate script (#10221)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtm-nayan authored Jun 22, 2023
1 parent c52bd3d commit 91265ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/tame-boats-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte-migrate': patch
---

fix: handle missing fields in migrate script
8 changes: 4 additions & 4 deletions packages/migrate/migrations/svelte-4/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export function update_pkg_json_content(content) {
* @param {string} [additional]
*/
function update_pkg(name, version, additional = '') {
if (pkg.dependencies[name]) {
log_migration(`Updated ${name} to ${version}${additional}`);
if (pkg.dependencies?.[name]) {
log_migration(`Updated ${name} to ${version} ${additional}`);
pkg.dependencies[name] = version;
}
if (pkg.devDependencies[name]) {
log_migration(`Updated ${name} to ${version}${additional}`);
if (pkg.devDependencies?.[name]) {
log_migration(`Updated ${name} to ${version} ${additional}`);
pkg.devDependencies[name] = version;
}
}
Expand Down

0 comments on commit 91265ae

Please sign in to comment.