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

fix: missing scripts section #414

Merged
merged 8 commits into from
Nov 22, 2024
Merged

fix: missing scripts section #414

merged 8 commits into from
Nov 22, 2024

Conversation

joscha
Copy link
Contributor

@joscha joscha commented Jun 5, 2024

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

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
@CLAassistant
Copy link

CLAassistant commented Jun 5, 2024

CLA assistant check
All committers have signed the CLA.

README.md Outdated Show resolved Hide resolved
timvandermeij added a commit to timvandermeij/pdf.js that referenced this pull request Jun 30, 2024
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.
timvandermeij added a commit to timvandermeij/pdf.js that referenced this pull request Jun 30, 2024
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.
timvandermeij added a commit to timvandermeij/pdf.js that referenced this pull request Jun 30, 2024
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.
README.md Outdated Show resolved Hide resolved
@joscha joscha changed the title docs: fix missing scripts section fix: missing scripts section Aug 14, 2024
@joscha joscha requested a review from dsherret August 14, 2024 09:35
@@ -94,7 +94,7 @@ export function getPackageJson({
// override with specified scripts
...(packageJsonObj.scripts ?? {}),
})
: packageJsonObj.scripts;
: packageJsonObj.scripts ?? {};
Copy link
Contributor Author

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: {},
Copy link
Contributor Author

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.

@joscha
Copy link
Contributor Author

joscha commented Aug 29, 2024

friendly ping @dsherret :)

Copy link
Member

@dsherret dsherret left a 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.

@dsherret dsherret merged commit 3cbe7da into denoland:main Nov 22, 2024
2 checks passed
@joscha joscha deleted the patch-1 branch November 22, 2024 23:36
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.

3 participants