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

Make apollo-env a standard TS package #1611

Merged
merged 12 commits into from
Oct 22, 2019
Merged

Make apollo-env a standard TS package #1611

merged 12 commits into from
Oct 22, 2019

Conversation

trevor-scheer
Copy link
Member

@trevor-scheer trevor-scheer commented Oct 22, 2019

The purpose of this PR is to simplify the build step of the tooling monorepo by implementing apollo-env as another project reference just as the others are.

apollo-env has been a notoriously bad citizen of this monorepo, especially for developers who aren't familiar with the quirks of this particular setup. It's removed hours of productivity even for those who are well acquainted with said quirks. For example, the need for frequent npm run clean && npm ci is really a requirement for development, but is an unexpected quirk and serious time sink - and this really just marks the simplest case.

This cleans up all things apollo-env to the best of my ability:

  • Special cases of inclusion or exclusion in configs (Jest, TS)
  • Removal of apollo-env as a project dependency when it is unused
  • Special build scripts which previously compiled apollo-env before everything else
  • Removal of handwritten fetch types

The last bullet is a major question mark to me - as my understanding of this whole workaround is for the sake of these handwritten types. I don't see the value that they add, but I'll defer to those with more knowledge of the history here @martijnwalraven and possibly @abernix.

TODO:

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

*Make sure changelog entries note which project(s) has been affected. See older entries for examples on what this looks like.

This commit removes all of the extraneous work being done for
compiling apollo-env's global `fetch` types. To accomplish this,
`apollo-env` was converted to a standard TS project using
references, just as the other packages are implemented within this
repo.
Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

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

This looks excellent! Thanks for working on this! No need to make any changes, but I've just left some notes just the same.

// ): Promise<Response>;
// }

export type RequestAgent = HttpAgent | HttpsAgent;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we use this anywhere, but I think it's okay to leave it for now.


// export type RequestRedirect = "follow" | "error" | "manual";

export type ReferrerPolicy =
Copy link
Member

Choose a reason for hiding this comment

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

I also don't think we use this anywhere, but let's leave it for now.


// export type BodyInit = ArrayBuffer | ArrayBufferView | string;

export {
Copy link
Member

Choose a reason for hiding this comment

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

We could alternatively just import these directly from node-fetch, but this is a great improvement right now.

Copy link
Contributor

@JakeDawkins JakeDawkins left a comment

Choose a reason for hiding this comment

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

🎉🎉

@JakeDawkins
Copy link
Contributor

I'm not sure what is going on with the azure pipelines fail here... all the jobs pass. Feel free to ignore that

@JakeDawkins JakeDawkins merged commit 5fb7331 into master Oct 22, 2019
caydie-tran pushed a commit that referenced this pull request Nov 8, 2019
* Make apollo-env a standard TS project

This commit removes all of the extraneous work being done for
compiling apollo-env's global `fetch` types. To accomplish this,
`apollo-env` was converted to a standard TS project using
references, just as the other packages are implemented within this
repo.

* Cleanup extraneous env-ci at the top-level
* Add polyfill setup step for jest
* Remove unused script

I think earlier node versions may need the apollo-env polyfill.
It works on my machine with node v8 but this is a CI test.

* Add apollo-env as a setup file for packages that use the polyfill
* Remove apollo-env from swift codegen dependencies
@trevor-scheer trevor-scheer deleted the trevor/apollo-env branch December 30, 2019 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants