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

Remove dependencies for events logging #189

Merged
merged 4 commits into from
Mar 14, 2019
Merged

Conversation

scottsfarley93
Copy link

In response to #188, this PR investigates the increase in bundle size introduced in #183 and attempts to reduce the increase by changing the dependencies used in logging interaction events.

@andrewharvey
Copy link
Collaborator

For comparison

v3.1.1: 37K
v3.1.2: 1.1M
this PR:131K

Not sure what the split of https vs sha.js is but for reference it looks like mapbox-sdk-js and mapbox-gl-js both use XMLHttpRequest without any overhead.

https://github.com/mapbox/mapbox-sdk-js/blob/master/lib/browser/browser-layer.js
https://github.com/mapbox/mapbox-gl-js/blob/master/src/util/ajax.js

Wondering if it's worth doing the same here.

@scottsfarley93
Copy link
Author

Using XMLHttpRequest, the min.js file size is now 75132 bytes.

@scottsfarley93 scottsfarley93 changed the title [WIP] Reduce bundle size Reduce bundle size Mar 8, 2019
@scottsfarley93 scottsfarley93 changed the title Reduce bundle size Remove dependencies for events logging Mar 8, 2019
* @private
*/
shouldEnableLogging: function (options) {
if (this.origin.indexOf('api.mapbox.com') == -1) return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@andrewharvey
Copy link
Collaborator

@scottsfarley93 Thanks for fixing these things up.

I wanted to make some comments about the project/development in general. It's not for me to dictate how things are done, but I've been finding it hard to keep tabs on development and maintenance of this project. I'd prefer if we could:

1.Try to keep each PR contained to one issue, it's easier to review and keep track of where changes are being made.

  1. Follow (or update) the deploy instructions https://github.com/mapbox/mapbox-gl-geocoder/blob/master/CONTRIBUTING.md#deploying and have a commit for each release (instead of bundling releases as part of other code changes). At the moment it's hard to see where releases are happening because they are mixed in with other commits.

  2. Make a PR for each release, this gives an opportunity for a review of the release before it's pushed out, to hopefully catch any potential issues beforehand.

  3. If significant changes and new features are being released, use a minor version bump instead of a patch release, following semver (for example, in my opinion the events logging was too large a change for a patch release).

Copy link
Collaborator

@andrewharvey andrewharvey 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 good to me, thanks for improving this. I haven't done any testing though.

@scottsfarley93
Copy link
Author

scottsfarley93 commented Mar 13, 2019

@andrewharvey thanks for the review and the contribution feedback. Quick question there -- I'm not sure I follow the order of operations on the deployment instructions.

Based on your suggestion, I think the following order makes the most sense, but wanted to double check:

  1. Make feature changes/bug fixes in PR
  2. Merge PR to master
  3. Update changelog and version in new PR
  4. Merge changelog/version PR into master
  5. Tag release and npm publish

Let me know what you're thinking there. I can update the docs accordingly once we've nailed down the steps.

@andrewharvey
Copy link
Collaborator

@scottsfarley93 That's right, I find that approach, forcing releases to have their own commits rather than doing a release together with other commits, a lot clearer and better practice and what has historically been happening. #198 clarifies that.

@scottsfarley93 scottsfarley93 merged commit 99ef6e9 into master Mar 14, 2019
@scottsfarley93 scottsfarley93 deleted the reduce-bundle-size branch March 14, 2019 17:00
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.

2 participants