Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Remove dependency on apollo-utilities #926

Merged
merged 8 commits into from
Feb 1, 2019

Conversation

hwillson
Copy link
Member

Apollo Link currently has a dependency on apollo-utilities, for the use of a single small utility function (getOperationName). This means all of the links in this project are currently pulling in apollo-utilities, which adds a fair bit of weight to their dependency graph (e.g. apollo-utilities makes up about 45% of apollo-link-http's effective bundle size.

This PR adds a copy of getOperationName into Apollo Link, and removes the apollo-utilities dependency. It's worth noting that the DedupLink tests were using their own copy of getOperationName as well. That version has been removed, and the new function is being used instead.

We updated Apollo Link to avoid calling `lerna boostrap`, to
mirror similar changes made in the Apollo Client repo. The
Apollo Client repo is using Typescript project references
however, which means we don't need to use Lerna's linking
features to add symbolic links between monorep packages. In AC
we can stop using `lerna boostrap`, but since Apollo Link
isn't using Typescript project references yet, we need to
keep Lerna's linking functionality in place. This commit adds
`lerna link` to the `npm run bootstrap` script.
`apollo-utilities` was a dependency of Apollo Link, so that the
`getOperationName` function could be used. This commit adds a local
version of that function, so that the `apollo-utilities` dep can
be dropped. The Deduplication Link tests were using their own
version of the `getOperationName` function; that version has been
removed, and the new version is being used instead.
Slight tweaks to get jest based coverage reporting working
(they were changed #919).
It's not a runnable test suite by itself, but is instead
imported when needed.
@codecov-io
Copy link

codecov-io commented Jan 31, 2019

Codecov Report

Merging #926 into master will decrease coverage by 1.15%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #926      +/-   ##
==========================================
- Coverage   96.37%   95.21%   -1.16%     
==========================================
  Files          20       22       +2     
  Lines         662     1024     +362     
  Branches      147      109      -38     
==========================================
+ Hits          638      975     +337     
- Misses         19       44      +25     
  Partials        5        5
Impacted Files Coverage Δ
packages/apollo-link/src/linkUtils.ts 98.07% <100%> (+0.4%) ⬆️
packages/apollo-link-retry/src/retryLink.ts 91.13% <0%> (-1.89%) ⬇️
packages/apollo-link-http-common/src/index.ts 91.52% <0%> (-1.13%) ⬇️
packages/apollo-link-ws/src/webSocketLink.ts 88.88% <0%> (-1.12%) ⬇️
...ckages/apollo-link-batch-http/src/batchHttpLink.ts 98.03% <0%> (-0.24%) ⬇️
packages/apollo-link-batch/src/batching.ts 98.5% <0%> (-0.22%) ⬇️
packages/apollo-link-error/src/index.ts 100% <0%> (ø) ⬆️
packages/apollo-link-polling/src/pollingLink.ts 100% <0%> (ø) ⬆️
packages/apollo-link-dedup/src/dedupLink.ts 100% <0%> (ø) ⬆️
...ackages/apollo-link/src/test-utils/testingUtils.ts 100% <0%> (ø) ⬆️
... and 11 more

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 5813d30...a27377d. Read the comment docs.

Copy link
Member

@benjamn benjamn left a comment

Choose a reason for hiding this comment

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

Looks great!

@hwillson hwillson merged commit 7947cf8 into master Feb 1, 2019
@hwillson hwillson deleted the hwillson/remove-apollo-utilities branch February 1, 2019 01:16
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