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

chore: add exports field to all package.jsons #9921

Merged
merged 2 commits into from Nov 4, 2020

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Apr 29, 2020

Summary

See https://nodejs.org/api/packages.html#packages_package_entry_points

This is breaking as node will throw on subpath access.

Test plan

Green CI

@SimenB
Copy link
Member Author

SimenB commented Apr 29, 2020

hah, my search and replace failed me 😅 I'll roll all package.jsons that aren't packages back

@SimenB
Copy link
Member Author

SimenB commented Apr 29, 2020

Since this changes every single package.json it'll trigger a release of all packages. Might be cleaner to just wait for Jest 26 when we wanna release all anyways?

@thymikee
Copy link
Collaborator

I'm fine with both. Waiting will produce less unnecessary clutter in npm, but does it really matter at its scale? :D

@codecov-io
Copy link

Codecov Report

Merging #9921 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9921   +/-   ##
=======================================
  Coverage   64.23%   64.23%           
=======================================
  Files         292      292           
  Lines       12466    12466           
  Branches     3075     3077    +2     
=======================================
  Hits         8007     8007           
  Misses       3810     3810           
  Partials      649      649           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5f2fd7...8162249. Read the comment docs.

@MylesBorins
Copy link

@SimenB there are ways to introduce the package.exports field that would be Semver-Minor. Either enumerating existing fields, or as a last case exporting "./"

LMK if you want any help or review

@SimenB
Copy link
Member Author

SimenB commented Apr 29, 2020

@MylesBorins thanks for chiming in! I explicitly want to disallow importing from build/ etc, so I'm fine with making a breaking change. Could do "./": "./" as a minor now I guess, and then only make it stricter for a major release? Not sure it gives us much, though. Or do you want us to do it? Happy to if you think it's worthwhile 🙂

@MylesBorins
Copy link

MylesBorins commented Apr 29, 2020 via email

@SimenB
Copy link
Member Author

SimenB commented Apr 29, 2020

Haha yeah, I noticed 😀

My unpushed branch exposes the file in main, package.json and, if the package has a binary, the binary file. I don't really want anything else, we've been bitten quite a few times by people breaking since we renamed a file or some such

@MylesBorins
Copy link

MylesBorins commented Apr 29, 2020 via email

@SimenB SimenB added this to the Jest 26 milestone May 2, 2020
@SimenB SimenB changed the title chore: normalize package.jsons chore: add exports field to all package.jsons May 2, 2020
@cpojer cpojer modified the milestones: Jest 26, High priority future May 2, 2020
@SimenB
Copy link
Member Author

SimenB commented May 2, 2020

I'll land the non-breaking parts now.

EDIT: "now" - sometime in the coming few days 😀

@SimenB SimenB merged commit 6392dbd into jestjs:master Nov 4, 2020
@SimenB SimenB deleted the normalize-pkg branch November 4, 2020 17:30
jeysal added a commit to mmkal/jest that referenced this pull request Nov 8, 2020
* master: (398 commits)
  chore(breaking): remove undocumented `enabledTestsMap` config (jestjs#10787)
  Change expect.not.objectContaining() to match documentation (jestjs#10708)
  chore: add name to root project (jestjs#10782)
  Added explanation on how to use custom @jest-environment to docs (jestjs#10783)
  fix: remove deprecated functions from the jest object (jestjs#9853)
  chore: convert jest-runtime to ESM (jestjs#10325)
  fix(resolve): use escalade to find package.json (jestjs#10781)
  feat(jest-runner): set exit code to 1 if test logs after teardown (jestjs#10728)
  chore: add `exports` field to all `package.json`s (jestjs#9921)
  fix: do not inject `global` variable into module wrapper (jestjs#10644)
  chore: migrate jest-resolve to ESM (jestjs#10688)
  chore(transform): refactor API to pass an options bag around rather than multiple boolean options (jestjs#10753)
  chore: default to node test env rather than browser (jestjs#9874)
  fix: drop support for node 13 (jestjs#10685)
  chore: show enhanced syntax error for all syntax errors (jestjs#10749)
  chore: update lockfile after publish
  v26.6.3
  chore: update changelog for release
  Don't throw an error if mock dependency can't be found (jestjs#10779)
  chore: bump babel core types (jestjs#10772)
  ...
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants