-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat: update to mapbox-gl 1.12.0 #253
Conversation
@Wykks @dmytro-gokun We really appreciate the effort that has been put into the project so far and would love to contribute. For us, this means keeping it up to date with Mapbox as it evolves. Is there a plan to review and merge pull requests into this repository? If not, we can fork it and make future improvements there to remain current. I would, however, prefer to stick to this one since it's better for the community. |
@dmytro-gokun Thanks for the effort. Honestly, i saw this PR but it looked so big and a lot of unrelated changes packed into one thing. Kind of hard to review. Would you mind splitting this into unrelated PRs, one-per-feature?I'll try to review those shortly and publish an updated version. |
@dmytro-gokun Thanks for the reply. Although there are several files, it's the same logic applied to each one:
The reason I updated the map, layer, and sources all at once is to be consistent with bumping the Mapbox version to 1.12. I listed every single change in the PR description for convenience, so it honestly looks more intimidating than it is. Nevertheless, I can split these 18 files into separate PRs. It will likely be the same changes, just fewer files at a time. Is this your preference? |
@AnthonyMacKinnon Yes, I'd like this to be split to small, bite-sized PRs which can be reviewed separately. I know, it's tedious, but it's better to keep thing separate. Question. Are all of this changes related to mapbox-gl 1.12.0? E.g., "mgl-layer.dblClick" would not work with 1.11.0 and lower, right? The reason i want to understand this is that i do not want us to require our users to update mapbox-gl if that is not really needed. |
@dmytro-gokun Some of the changes require 1.12 (e.g. Since this project is a wrapper around |
I'm afraid it's a bit more complex than that. We also have Angular version as another dimension. I do not want to require ppl to use the latest mapbox just for sake of it. This is no library's business. So, we need to make sure we are not forcing ppl to update peer dependencies in a minor update (it's okay to do that when we release a major version).
Sure, i'm okay with any forks if that suits your workflow better. Again, if you want to contribute with more manageable PRs - you are welcome. |
Agreed, determining which version of Angular to target is not trivial since it's not always easy or even possible to upgrade large projects to a new version. One option could be to have concurrent versions of
I'd argue that picking the Looking back, I see that the upgrades to Angular 10 (3976db7), Angular 8 (57f6d6e), and Mapbox GL 1.1 (1043b4f) were all done in minor revisions and included breaking changes. Targeting a new version without breaking changes, as I'm proposing here, should be a transparent process for consumers of As I wrote earlier, I'm open to splitting up this PR if it will help. I'm not sure how though. I could make one for |
Hi! Although I'm not really active on ngx-mapbox-gl, I agree with the logic "if there's no breaking change, update to mapbox-gl are fine". And I even encourage them. But there's one annoying issue : peerDependencies. And that's even more relevant with newers version of npm. Because npm will raise an error if peerDependencies are not compatible (this is really a bad change tbh...). I believe the most important thing for ngx-mapbox-gl is to be up to date with mapbox-gl (although I'm not really in a good position to say that, but that's what I was doing when I was actively maintaining this lib).
I agree, I tried to that in the past, but welp... Can't say that's an easy task 😅 Well since I'm here, I'm going to review your PR :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good work 👍
Some changes could indeed have been in another PR but it's ok.
Only one major change request, in the new mgl-raster-dem-source component (see comment)
Seems safe to me to be part of a minor release. But I'm also fine to make a major version out of this too, because they may be some typings breaking changes (and the mapbox-gl version gap is quite important too). What do you think @dmytro-gokun ?
@@ -20,6 +20,7 @@ Include the following components: | |||
- [mgl-geojson-source](https://github.com/Wykks/ngx-mapbox-gl/wiki/API-Documentation#mgl-geojson-source-mapbox-gl-style-spec) | |||
- [mgl-canvas-source](https://github.com/Wykks/ngx-mapbox-gl/wiki/API-Documentation#mgl-canvas-source-mapbox-gl-style-spec) | |||
- [mgl-image-source](https://github.com/Wykks/ngx-mapbox-gl/wiki/API-Documentation#mgl-image-source-mapbox-gl-style-spec) | |||
- [mgl-raster-dem-source](https://github.com/Wykks/ngx-mapbox-gl/wiki/API-Documentation#mgl-raster-dem-source-mapbox-gl-style-spec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing doc here. Do github still not allow PR for Wiki ? I really should move docs to the repository...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I don't have the ability to edit the wiki unfortunately.
projects/ngx-mapbox-gl/src/lib/source/raster-dem-source.component.ts
Outdated
Show resolved
Hide resolved
projects/ngx-mapbox-gl/src/lib/source/raster-source.component.ts
Outdated
Show resolved
Hide resolved
projects/ngx-mapbox-gl/src/lib/source/vector-source.component.ts
Outdated
Show resolved
Hide resolved
Thanks for the review! Just pushed a few changes based on the feedback.
Just FYI, but I did go through each field to compare and the new types were only extending what was already there if I remember correctly. With that said, up to you and @dmytro-gokun to decide what makes sense from a versioning perspective. |
@Wykks If there are no breaking changes then there is no need for a major version. But then we also should not update peerDependency version. If we decide to update peerDependency version - that screams a new major version to me :). As far as I can see, mapbox-gl itself is updating minor version and, thus, we should not expect any breaking changes here. |
@dmytro-gokun @Wykks Oh, interesting. I hadn't actually noticed the different Seems to me like the peer dependency version needs to match as we target new versions. Otherwise, consumers might run into issues. Not sure I'd use a new major version though since it's likely that the same thing will happen each time we target a new |
Yes, we set peerDependncies when building the library itself. IMO, we should keep that peerDependency set to 1.1 as long as we do not introduce any breaking changes.
That is fine to me as long as it works fine with older version when new features not used. That what backward compatibility means :). After some thinking. It might be easier (from the support point of view) to update peerDependncies to be >= mapbox-gl.latestVersion when we add support for a new version of mapbox-gl. However, if we do that, we must also increment majorVersion of this library if want to adhere to semantic versioning. And that is a bit problematic to me, as it means we'll end up with versions like 65 and even more pretty soon. Maybe not a real problem, though. |
Agreed. If we don't update
Yeah, I guess we get into the semantics of semantic versioning. 😄 Personally, I don't consider having to update |
Well, while theoretically possible, that would also mean that mapbox team have violated sematic versioning. Then we may have bigger problems than that :).
Well, we are not first people to discuss that. I think, it is universally agreed that updating peer dependency version is a breaking change and, thus, should be marked as a new major version. Check this for example: semver/semver#502 I do not think it's a good idea for us to break this rue of thumb. Again, if we want to make our lives easier and are not afraid of versions like 65 (after all, Chrome is not afraid :)), we should just go ahead updating peer dependencies versions and releasing new major versions of this package. @Wykks What do you think? |
Here's one example. In the current PR, binding
Very useful thread, thanks for sharing. In my mind, this applies in nearly all cases but not necessarily here. I see the dependency on
|
While this is clever, it clearly violates the idea behind semantic versioning. Personally, I do not like this as it goes against the community accepted standards and tooling which implies semantic versioning. However, I'd like to @Wykks to have a final say here as he is the author of this package. |
Yeah this makes sense, but that's not practical. Let's think about it more pragmatically. So we should just release this as part as a standard major version. And for the upcoming version of mapbox-gl, we may, or may not, increase major version depending of how confident we are about not introducing breaking changes. Thanks for your help ! :) (Welp, meanwhile, mapbox-gl just released v2.0.0 🤣 ) |
(I'm going to work in the v5 release this week for hopefully a release this week-end) |
* feat: update to mapbox-gl 1.12.0 (Wykks#253) * fix: Change many outputs to avoid confusion (fix Wykks#107) Inspired by @angular/component google-map component * docs: move docs to repository * test: fix map test * showcase: refactor whole app & add doc versionning BREAKING CHANGE: Remove undocumented resize API * chore: update and run prettier * docs: fix mgl-image example * feat(mglDraggable): remove marker support BREAKING CHANGE: Remove marker support for mglDraggable (use draggable input instead) * showcase: fix incorrect import (& small layout issue) * fix(draggable): fix incorrect use of takeUntil takeUntil should not be used before a switchMap. Using simple subscription pattern instead for consistency Also fix geolocate output type * feat: update to mapbox-gl 1.13.0 * test: fix layer test * chore(release): 5.0.0 * build(deps): bump @mapbox/mapbox-gl-geocoder to ^4.0.0 and add type definitions Co-authored-by: makspetrov <mp@keatech.com> * build(deps): use Angular 11 & mapbox-gl 2.0 Co-authored-by: makspetrov <mp@keatech.com> * chore(release): 6.0.0 * fix(deps): add @types/mapbox__mapbox-gl-geocoder (Wykks#274) * chore(release): 6.0.1 * fix: declare Position interface for geolocate-control (Wykks#276) * chore(release): 6.0.2 * fix: Position interface (Wykks#278) * chore(release): 6.0.3 * build: update @types/mapbox-gl 2.0.3 -> 2.1.0 (Wykks#281) * chore(release): 6.0.4 * doc: correct README.md on the subject of token being mandatory (Wykks#287) * build(deps): bump elliptic from 6.5.3 to 6.5.4 (Wykks#288) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](indutny/elliptic@v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): update dependencies Co-authored-by: Anthony MacKinnon <anthony@georadix.com> Co-authored-by: Wykks <contact@wykks.eu> Co-authored-by: Maks <Nosfit@ukr.net> Co-authored-by: makspetrov <mp@keatech.com> Co-authored-by: Dmytro Gokun <dmytro.gokun@gmail.com> Co-authored-by: Aymen Dhahri <41507665+DroidZed@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Here is a detailed list of changes covered by this PR:
mapbox-gl
dependency to >= 1.12.0 in order to take advantage of latest features.@types/mapbox-gl
, instead of redefining them, for most inputs. This makes it more futureproof and also resolves some missing valid values.@Input() canvas: string;
gets replaced with@Input() canvas: CanvasSourceOptions['canvas'];
mgl-layer
dblClick
mouseDown
mouseUp
mouseOver
mouseOut
contextMenu
touchStart
touchEnd
touchCancel
mgl-map
collectResourceTiming
crossSourceCollisions
fadeDuration
minPitch
maxPitch
touchPitch
renderWorldCopies
to dynamic inputs since there is now a method to update it on the map.classes
input since there is no matching option on the Mapbox map.load
since I didn't want to introduce a breaking change.mouseEnter
andmouseLeave
events since they only apply to a layer and don't work when none is specified.mgl-canvas-source
coordinates
now uses the relevant method on the map.mgl-geojson-source
minZoom
input since there is no matching option in Mapbox.attribution
clusterMinPoints
lineMetrics
promoteId
filter
mgl-raster-dem-source
mgl-raster-source
attribution
scheme
mgl-vector-source
bounds
scheme
attribution
promoteId
url
ortiles
now uses the relevant method on the map.mgl-video-source
coordinates
now uses the relevant method on the map.There are no breaking changes since the few inputs that were removed do not have matching options in Mapbox and therefore didn't do anything as far as I can tell. Note that this PR also covers the changes proposed in #246, #248, and #252 so there is no need to merge them if this gets approved.