Skip to content

Conversation

@anonrig
Copy link
Member

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-botnodejs-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
@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@github-actionsgithub-actionsbot 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

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.

@anonriganonrigforce-pushed the fix-package-json-main branch from d2ea291 to 61523dbCompareNovember 29, 2023 14:00
@anonrig
Copy link
MemberAuthor

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

@anonriganonrigforce-pushed the fix-package-json-main branch from 61523db to 7e3b1b6CompareNovember 29, 2023 14:00
@anonriganonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2023
@github-actionsgithub-actionsbot 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

@RafaelGSSRafaelGSS 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
MemberAuthor

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

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

@anonriganonrig changed the title src: omit bool values of package.json main fieldsrc: omit non-string values of package.json main fieldNov 29, 2023
@anonriganonrig 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

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
MemberAuthor

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

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

@targos
Copy link
Member

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

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

Landed in 0229502

@targostargos 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

Depends on #50322

@anonrig
Copy link
MemberAuthor

@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

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.

@anonriganonrig removed dont-land-on-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. 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]>
@RafaelGSSRafaelGSS mentioned this pull request Dec 15, 2023
@marco-ippolitomarco-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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.backport-blocked-v20.xPRs 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-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@anonrig@nodejs-github-bot@targos@GeoffreyBooth@ljharb@aduh95@marco-ippolito@benjamingr@RafaelGSS