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

Publish all types from packages/* #18211

Merged
merged 6 commits into from Apr 17, 2023

Conversation

hanneskuettner
Copy link
Contributor

@hanneskuettner hanneskuettner commented Apr 17, 2023

Fixes #18209
This is basically a continuation of #18180

Additionally this PR removes the main entrypoint and replaces them with a proper exports field as this project is now ESM only anyways and the exports field takes precedence over the main field as per https://nodejs.org/api/packages.html#package-entry-points

For new packages targeting the currently supported versions of Node.js, the "exports" field is recommended. For packages supporting Node.js 10 and below, the "main" field is required. If both "exports" and "main" are defined, the "exports" field takes precedence over "main" in supported versions of Node.js.

Edit: Turns out TypeScript needs to have "moduleResolution": "nodenext" enabled for the exports to work (which is available since TS 4.7). So this would mean a breaking change in extensions. I've left the main entrypoint intact and added an additional types entrypoint in addition to the future proof exports.

I also removed the 2 spaces rule for package.json from the .editorconfig since my editor seemed to be the only one respecting it and all of the package.json files used tabs so far.

Open Questions:

  • Was there any reason to not publish the types before?
  • Should the storage-driver-* types also be exported?

@hanneskuettner hanneskuettner force-pushed the feat/publish-all-the-types branch 3 times, most recently from eefab53 to 423af62 Compare April 17, 2023 08:47
@hanneskuettner hanneskuettner force-pushed the feat/publish-all-the-types branch 2 times, most recently from a7e9b6c to ed2a854 Compare April 17, 2023 09:10
- Remove 'useTabs' so prettier will not override settings from editorconfig
- Remove settings in editorconfig which match the defaults anyway
.editorconfig Show resolved Hide resolved
.editorconfig Outdated Show resolved Hide resolved
packages/composables/package.json Outdated Show resolved Hide resolved
packages/composables/package.json Outdated Show resolved Hide resolved
@paescuj
Copy link
Member

paescuj commented Apr 17, 2023

  • Was there any reason to not publish the types before?

As far as I can tell, it was simply forgotten to do so.

  • Should the storage-driver-* types also be exported?

No, I don't think so. I'd only expose the types for packages that are actually intended for use and I don't see why this would be the case for these packages.

@paescuj paescuj requested review from a team, nickrum, connorwinston and azrikahar and removed request for a team April 17, 2023 13:06
@paescuj paescuj self-requested a review April 17, 2023 13:08
Copy link
Member

@paescuj paescuj left a comment

Choose a reason for hiding this comment

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

Thanks @hanneskuettner!

@azrikahar azrikahar merged commit 9b4fb99 into directus:main Apr 17, 2023
6 checks passed
hanneskuettner added a commit to hanneskuettner/directus that referenced this pull request Apr 18, 2023
* Publish all types in packages/*

* Re-add main entrypoints and add types

* Clean-up prettier config / editorconfig

- Remove 'useTabs' so prettier will not override settings from editorconfig
- Remove settings in editorconfig which match the defaults anyway

* Remove types entrypoint again

* Update packages/schema/package.json

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
@rijkvanzanten rijkvanzanten added this to the Next Release milestone Apr 20, 2023
meditadvisors pushed a commit to ciso360ai/directus-mod that referenced this pull request May 13, 2023
* Publish all types in packages/*

* Re-add main entrypoints and add types

* Clean-up prettier config / editorconfig

- Remove 'useTabs' so prettier will not override settings from editorconfig
- Remove settings in editorconfig which match the defaults anyway

* Remove types entrypoint again

* Update packages/schema/package.json

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
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.

@directus/types package doesn't work as it just installed the empty js files
4 participants