-
Notifications
You must be signed in to change notification settings - Fork 40
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
fix: missing scripts
section
#414
Conversation
Without it, npm complains about it: ``` npm WARN publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors. npm WARN publish errors corrected: npm WARN publish Removed invalid "scripts" ``` via npm/cli#6918 it looks like this is not going to be fixed, thus the change, which removes the warnings
This commit removes the following warning logs from the `npm publish` output: ``` npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors. npm warn publish errors corrected: npm warn publish Removed invalid "scripts" npm warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414. For the "repository.url" section it turns out that the URL must point to a Git URL that doesn't resolve to an HTML page in the browser; refer to https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository.
This commit removes the following warnings from the `npm publish` output: ``` npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors. npm warn publish errors corrected: npm warn publish Removed invalid "scripts" npm warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414.
This commit removes the following warnings from the `npm publish` output: ``` npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors. npm warn publish errors corrected: npm warn publish Removed invalid "scripts" npm warn publish "repository.url" was normalized to "git+https://github.com/mozilla/pdfjs-dist.git" ``` For the "scripts" section it turns out that if the package doesn't have any scripts it's expected to explicitly set it to an empty object; refer to npm/cli#6918 and denoland/dnt#414.
scripts
sectionscripts
section
@@ -94,7 +94,7 @@ export function getPackageJson({ | |||
// override with specified scripts | |||
...(packageJsonObj.scripts ?? {}), | |||
}) | |||
: packageJsonObj.scripts; | |||
: packageJsonObj.scripts ?? {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theoretically we could remove this one here, as it gets removed further down by deleteEmptyKeys
, however the other branch of the condition has the fallback and we want this to also be there if the code below changes at a later point in time.
@@ -112,6 +112,7 @@ export function getPackageJson({ | |||
...mainExport, | |||
...binaryExport, | |||
...packageJsonObj, | |||
scripts: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is needed in addition, as the splat from deleteEmptyKeys
won't have the scripts
key if it is an empty object.
friendly ping @dsherret :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, got too preoccupied with the Deno 2 release. Hoping to get back on this and upgrade dnt to some of the latest features soon.
Without it, npm complains about it:
via npm/cli#6918 it looks like this is not going to be fixed, thus the change, which removes the warnings