-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update handling of ambiguous properties
- Loading branch information
Showing
1 changed file
with
10 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,36 +86,36 @@ export const PackageManifest = PackageJson.extend({ | |
@remarks | ||
In some old packages (like `[email protected]`) the `engines` property is an array of strings | ||
instead of an object and with catch it becomes an empty object. | ||
instead of an object and with catch it becomes `undefined`. | ||
*/ | ||
engines: z.record(z.string()).catch({}).optional(), | ||
engines: z.record(z.string()).optional().catch(undefined), | ||
|
||
/** | ||
SPDX license expression or a custom license. | ||
@remarks | ||
In some old packages (like `[email protected]`) the `license` property is an object | ||
and with catch `license` becomes an empty string. | ||
and with catch `license` becomes `undefined`. | ||
*/ | ||
license: z.string().catch("").optional(), | ||
license: z.string().optional().catch(undefined), | ||
|
||
/** | ||
URL of the package's homepage. | ||
@remarks | ||
In some old packages (like `[email protected]`) the `homepage` property is an array | ||
of strings and with coercion it correctly becomes a string. | ||
of strings and with catch it becomes `undefined`. | ||
*/ | ||
homepage: z.coerce.string().optional(), | ||
homepage: z.string().optional().catch(undefined), | ||
|
||
/** | ||
Deprecation message. | ||
Deprecation status/message. | ||
@remarks | ||
In some old packages (like `[email protected]`) the `deprecated` property is a boolean | ||
and with coercion it becomes either `"true"` or `"false"`. | ||
In some packages (like `[email protected]`) the `deprecated` property is a boolean | ||
instead of a deprecation message. | ||
*/ | ||
deprecated: z.coerce.string().optional(), | ||
deprecated: z.union([z.string(), z.boolean()]).optional(), | ||
}); | ||
|
||
/** | ||
|