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

Update usage-reporting-protobuf to have main field #7095

Merged
merged 2 commits into from
Oct 28, 2022

Conversation

alex-statsig
Copy link
Contributor

@apollo/usage-reporting-protobuf should define a main/module field in package.json, same as @apollo/server does. The "exports" field doesn't work everywhere yet still (ex. jest, or at least old versions of jest, don't respect it).

@apollo-cla
Copy link

@alex-statsig: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@netlify
Copy link

netlify bot commented Oct 28, 2022

Deploy Preview for apollo-server-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 6d0d811
🔍 Latest deploy log https://app.netlify.com/sites/apollo-server-docs/deploys/635c1e381517d20008bfe4b6
😎 Deploy Preview https://deploy-preview-7095--apollo-server-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 28, 2022

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 6d0d811:

Sandbox Source
Apollo Server Typescript Configuration
Apollo Server Configuration

@glasser
Copy link
Member

glasser commented Oct 28, 2022

Hi @alex-statsig — I'm sure you're right about this and I'm sure I'll merge this today. That said, this stuff is pretty complex — we have to put the same information in multiple places so that a bunch of different systems works. Can you let me know exactly what context the current setup failed for you? I'd like to extend the section at the end of DEVELOPMENT.md (as well as the tests in smoke-test) to catch your issue but I can't remember which particular build context uses these particular fields.

(Note: the CI errors in "Smoke test built package" and the 17 canary right now are not your fault — combination of that test not quite pinning its dependencies well enough plus a bug in another package that I just made a PR for.)

@alex-statsig
Copy link
Contributor Author

Hi @alex-statsig — I'm sure you're right about this and I'm sure I'll merge this today. That said, this stuff is pretty complex — we have to put the same information in multiple places so that a bunch of different systems works. Can you let me know exactly what context the current setup failed for you? I'd like to extend the section at the end of DEVELOPMENT.md (as well as the tests in smoke-test) to catch your issue but I can't remember which particular build context uses these particular fields.

(Note: the CI errors in "Smoke test built package" and the 17 canary right now are not your fault — combination of that test not quite pinning its dependencies well enough plus a bug in another package that I just made a PR for.)

I'm using jest v26.6.3 (w/ [email protected] and babel-jest as 26.6.3), and just trying to run a jest test which starts the server. I have no build issues outside of jest, but I believe jest uses a version of resolver which doesn't support exports (see jestjs/jest#9771). The exact issue I get is that the module "@apollo/usage-reporting-protobuf" is not found.

I've locally patched it by overriding the jest resolver logic to look at the "exports" field as well, but seems like no harm in just setting this field for simplicity / better support.

Let me know if you need any more info about the repro

@glasser
Copy link
Member

glasser commented Oct 28, 2022

OK, even though we use ts-jest ourselves it's one of the pieces of our infrastructure that I think we understand least. Probably not going to be able to reproduce this easily then... but I'll merge this!

@glasser
Copy link
Member

glasser commented Oct 28, 2022

Overriding CI (test failures are due to ardatan/graphql-tools#4795 + our lack of package-lock.json in the smoke-test)

@glasser glasser merged commit 72111f9 into apollographql:main Oct 28, 2022
@github-actions github-actions bot mentioned this pull request Oct 28, 2022
glasser pushed a commit that referenced this pull request Oct 28, 2022
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/[email protected]

### Patch Changes

- [#7095](#7095)
[`72111f970`](72111f9)
Thanks [@alex-statsig](https://github.com/alex-statsig)! - Include
`main` and `module` fields in package.json for build tools that look for
them instead of `exports`.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants