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

src: omit non-string values of package.json main field #50965

Merged
merged 1 commit into from
Dec 3, 2023

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Nov 29, 2023

Omit "main": false in package.json and do not throw an error for it.

FYI: This PR has missing tests.

cc @RafaelGSS @targos @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Nov 29, 2023
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@nodejs-github-bot
Copy link
Collaborator

@targos
Copy link
Member

targos commented Nov 29, 2023

It's not just boolean values that were ignored. I don't know exactly what is the current behavior but at least numbers and null are also ignored.
I think the safest fix is to ignore anything that's not a string.

@anonrig anonrig force-pushed the fix-package-json-main branch from d2ea291 to 61523db Compare November 29, 2023 14:00
@anonrig
Copy link
Member Author

anonrig commented Nov 29, 2023

It's not just boolean values that were ignored. I don't know exactly what is the current behavior but at least numbers and null are also ignored. I think the safest fix is to ignore anything that's not a string.

I see. I updated the PR. Thank you @targos

@anonrig anonrig force-pushed the fix-package-json-main branch from 61523db to 7e3b1b6 Compare November 29, 2023 14:00
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

Shoudn't it be wip until tests are added?

@anonrig
Copy link
Member Author

anonrig commented Nov 29, 2023

Shoudn't it be wip until tests are added?

If this is excluded in v20 release, I'll spend more time to add tests in this PR. If not, we can merge it as it is to unblock the release.

@GeoffreyBooth
Copy link
Member

Shoudn’t it be wip until tests are added?

I’m not really sure it needs tests, to be honest, because Node itself doesn’t take a position on non-string values of package.json values AFAIK. This is to fix CITGM tests that break, and it’s also debatable whether those tests are correct. We may very well want to support values like "main": false in the future, so adding a test now to prohibit that in the future would box us in.

@ljharb
Copy link
Member

ljharb commented Nov 29, 2023

Can the PR title be updated to match the current PR’s behavior?

@anonrig anonrig changed the title src: omit bool values of package.json main field src: omit non-string values of package.json main field Nov 29, 2023
@anonrig anonrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 29, 2023
@aduh95
Copy link
Contributor

aduh95 commented Nov 29, 2023

adding a test now to prohibit that in the future would box us in.

It would not, it's definitely OK to change tests in semver-major PRs. Not having a test only gives a chance that such breaking change slips through in a semver-minor or semver-patch PR.

@anonrig
Copy link
Member Author

anonrig commented Nov 29, 2023

adding a test now to prohibit that in the future would box us in.

It would not, it's definitely OK to change tests in semver-major PRs. Not having a test only gives a chance that such breaking change slips through in a semver-minor or semver-patch PR.

If we add tests, any change we make in the future will be semver-major but we don't claim that we support non-string use cases since they are invalid. I think this is the correct approach.

@ljharb
Copy link
Member

ljharb commented Nov 30, 2023

The tests don't map to claimed support though, do they?

@targos
Copy link
Member

targos commented Nov 30, 2023

It's better to catch regression in tests instead of citgm

@anonrig anonrig added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 3, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 3, 2023
@nodejs-github-bot nodejs-github-bot merged commit 0229502 into nodejs:main Dec 3, 2023
56 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 0229502

@targos targos added the dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. label Dec 4, 2023
@targos targos added dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v21.x labels Dec 4, 2023
@targos
Copy link
Member

targos commented Dec 4, 2023

Depends on #50322

@anonrig
Copy link
Member Author

anonrig commented Dec 4, 2023

@targos Why did we add don't-land-on-v21? The dependent PR issue is fixed in this PR and therefore, we can remove the do not land issues on this PR and parent PR.

@targos
Copy link
Member

targos commented Dec 4, 2023

Feel free to change labels on both PRs if that's the correct thing to do. I just acted based on the parent PR labels.

@anonrig anonrig removed dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v21.x labels Dec 4, 2023
RafaelGSS pushed a commit that referenced this pull request Dec 15, 2023
PR-URL: #50965
Reviewed-By: Geoffrey Booth <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Dec 15, 2023
@marco-ippolito marco-ippolito added the backport-blocked-v20.x PRs that should land on the v20.x-staging branch but are blocked by another PR's pending backport. label May 2, 2024
@marco-ippolito
Copy link
Member

to land on v20 dependes on #50965

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-blocked-v20.x PRs that should land on the v20.x-staging branch but are blocked by another PR's pending backport. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants