fix: handle object format for author field in package.json#1344
Open
kaigritun wants to merge 1 commit into
Open
fix: handle object format for author field in package.json#1344kaigritun wants to merge 1 commit into
kaigritun wants to merge 1 commit into
Conversation
Chrome extension manifest requires author to be a string, but npm allows author to be either a string or an object with name/email/url fields. This commit adds a normalizeAuthor function that converts the object format to the standard npm string format: "Name <email> (url)" Fixes PlasmoHQ#1334
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1334
Chrome extension manifest requires the
authorfield to be a string, but npm'spackage.jsonallowsauthorto be either:"John Doe"{ "name": "John Doe", "email": "john@example.com", "url": "https://example.com" }When the
authorfield is an object, Plasmo was passing it directly to the manifest, causing the validation error:Changes
Added
normalizeAuthorhelper function inbase.ts:undefinedif no author is provided"Name <email> (url)"Updated
PackageJSONtype inpackage-file.ts:PackageAuthortype that accepts both string and object formatsPackageJSONto use the new type for theauthorfieldExample
package.json with object author:
{ "author": { "name": "Gil B. Chan", "email": "bnbcmindnpass@gmail.com", "url": "https://github.com/jjangga0214" } }Generated manifest author:
{ "author": "Gil B. Chan <bnbcmindnpass@gmail.com> (https://github.com/jjangga0214)" }References