Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[install] improve package.json validation #2074

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

alexlamsl
Copy link
Contributor

  • report error and exit gracefully instead of crashing

@@ -2677,6 +2677,7 @@ pub const Package = extern struct {
total_dependencies_count += @truncate(u32, arr.items.len);
},
.e_object => |obj| {
if (group.behavior.isWorkspace()) return error.InvalidPackageJSON;
Copy link
Collaborator

@Jarred-Sumner Jarred-Sumner Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should have a more specific error

workspaces must be an array of package name strings, like
"workspaces": [ "./folder/package-name", "./folder/package2" ]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6164cd6

@@ -2691,7 +2692,7 @@ pub const Package = extern struct {
}
total_dependencies_count += @truncate(u32, obj.properties.len);
},
else => {},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do peerDependencies: false or whatever we can just ignore it IMO

- report error and exit gracefully instead of crashing
@Jarred-Sumner Jarred-Sumner merged commit 7597e4a into oven-sh:main Feb 15, 2023
@Jarred-Sumner
Copy link
Collaborator

Thanks

@alexlamsl alexlamsl deleted the invalid-package-json branch February 15, 2023 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants