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 CommonJS typescript Types. #7614

Merged
merged 13 commits into from Jun 26, 2023
Merged

Conversation

Cellule
Copy link
Contributor

@Cellule Cellule commented Jun 20, 2023

Fixes #7222
Incidentally, this also fixes #6899

Stop removing CommonJS Types and fix exports to properly direct to the right types.
I've been successful with this approach in other projects.
I tested real quick on my project using "CommonJS" "module": "Node16" and "moduleResolution": "node16"

@netlify
Copy link

netlify bot commented Jun 20, 2023

👷 Deploy request for apollo-server-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ac07ed2

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 20, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ac07ed2:

Sandbox Source
Apollo Server Typescript Configuration
Apollo Server Configuration

@Cellule
Copy link
Contributor Author

Cellule commented Jun 20, 2023

I forked the Apollo Server Typescript code sandbox to use commonjs instead to show that typings now work with this change
https://codesandbox.io/s/apollo-server-typescript-forked-rdkwpy

@Cellule
Copy link
Contributor Author

Cellule commented Jun 20, 2023

In comparison with latest version of @apollo/server with the same code changes
https://codesandbox.io/s/apollo-server-typescript-forked-xtqc98

image

@Cellule
Copy link
Contributor Author

Cellule commented Jun 21, 2023

I wanted to add a smoke-test and then realized I missed a few spots 😅
I hope this is it 🤞🤞

@trevor-scheer
Copy link
Member

Excellent, thanks for doing this! If you didn't add one I would've asked you to - and voila...glad it turned up some issues. I'll take a look at this today and try it out. Based on the reactions already it looks like you'll make some people happy.

Copy link
Member

@trevor-scheer trevor-scheer left a comment

Choose a reason for hiding this comment

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

Looking pretty good! I haven't actually tried installing the sandbox builds yet, will do after changes are addressed.

packages/gateway-interface/package.json Outdated Show resolved Hide resolved
packages/server/tsconfig.cjs.json Show resolved Hide resolved
scripts/postcompile.mjs Show resolved Hide resolved
smoke-test/smoke-test.sh Show resolved Hide resolved
Removed remaining comments about deleting cjs typings
Reverted "main" in gateway-interface/package.json
Co-authored-by: David Glasser <glasser@apollographql.com>
@trevor-scheer
Copy link
Member

Tested builds locally with the problematic configurations using existing packages vs. the codesandbox builds from this PR and this does resolve the issues it claims to.

Additionally, I found that it resolves the deep import autocomplete issue mentioned here. I'll add it to the PR description.
#6899

Thanks for your work on this, this is a great improvement!

@trevor-scheer trevor-scheer merged commit 4fadf3d into apollographql:main Jun 26, 2023
15 checks passed
@github-actions github-actions bot mentioned this pull request Jun 26, 2023
trevor-scheer pushed a commit that referenced this pull request Jun 26, 2023
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/cache-control-types@1.0.3

### Patch Changes

- [#7614](#7614)
[`4fadf3ddc`](4fadf3d)
Thanks [@Cellule](https://github.com/Cellule)! - Publish TypeScript
typings for CommonJS modules output.

    This allows TypeScript projects that use CommonJS modules with
    `moduleResolution: "node16"` or
    `moduleResolution: "nodeNext"`
to correctly resolves the typings of apollo's packages as CommonJS
instead of ESM.

## @apollo/server-gateway-interface@1.1.1

### Patch Changes

- [#7614](#7614)
[`4fadf3ddc`](4fadf3d)
Thanks [@Cellule](https://github.com/Cellule)! - Publish TypeScript
typings for CommonJS modules output.

    This allows TypeScript projects that use CommonJS modules with
    `moduleResolution: "node16"` or
    `moduleResolution: "nodeNext"`
to correctly resolves the typings of apollo's packages as CommonJS
instead of ESM.

- Updated dependencies
\[[`4fadf3ddc`](4fadf3d)]:
    -   @apollo/usage-reporting-protobuf@4.1.1

## @apollo/server-integration-testsuite@4.7.5

### Patch Changes

- Updated dependencies
\[[`4fadf3ddc`](4fadf3d)]:
    -   @apollo/cache-control-types@1.0.3
    -   @apollo/server@4.7.5
    -   @apollo/usage-reporting-protobuf@4.1.1

## @apollo/server-plugin-response-cache@4.1.3

### Patch Changes

- [#7614](#7614)
[`4fadf3ddc`](4fadf3d)
Thanks [@Cellule](https://github.com/Cellule)! - Publish TypeScript
typings for CommonJS modules output.

    This allows TypeScript projects that use CommonJS modules with
    `moduleResolution: "node16"` or
    `moduleResolution: "nodeNext"`
to correctly resolves the typings of apollo's packages as CommonJS
instead of ESM.

## @apollo/server@4.7.5

### Patch Changes

- [#7614](#7614)
[`4fadf3ddc`](4fadf3d)
Thanks [@Cellule](https://github.com/Cellule)! - Publish TypeScript
typings for CommonJS modules output.

    This allows TypeScript projects that use CommonJS modules with
    `moduleResolution: "node16"` or
    `moduleResolution: "nodeNext"`
to correctly resolves the typings of apollo's packages as CommonJS
instead of ESM.

- Updated dependencies
\[[`4fadf3ddc`](4fadf3d)]:
    -   @apollo/cache-control-types@1.0.3
    -   @apollo/server-gateway-interface@1.1.1
    -   @apollo/usage-reporting-protobuf@4.1.1

## @apollo/usage-reporting-protobuf@4.1.1

### Patch Changes

- [#7614](#7614)
[`4fadf3ddc`](4fadf3d)
Thanks [@Cellule](https://github.com/Cellule)! - Publish TypeScript
typings for CommonJS modules output.

    This allows TypeScript projects that use CommonJS modules with
    `moduleResolution: "node16"` or
    `moduleResolution: "nodeNext"`
to correctly resolves the typings of apollo's packages as CommonJS
instead of ESM.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@trevor-scheer
Copy link
Member

This is released in the latest versions of Apollo Server packages. Thanks again!

@Cellule Cellule deleted the cjs-types branch June 26, 2023 17:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants