webfactorymk/ng2-canvas-whiteboard

Use RxJS6 as main RxJS lib instead of needing to download rxjs-compat library

Closed this issue · 19 comments

Dear @Peshou ,

is it possible to use rxjs 6 instead of rxjs 5 for this package? Currently, if you want to use rxjs 6 you will need to add the compat lib.. Wouldn't it be better to use rxjs 6 as default and use a compat in case someone needs to use it with rxjs 5 instead? because sooner or later one will need to switch to rxjs 6.

what do you think on this?

All the best and cheers,

Hey @johannesschobel, yes, it is better to use rxjs 6, but for the need of backwards compatibility for the release with premade shapes, I needed to ignore the rxjs change and allow all people to have access to the package with lower angular / rxjs versions, since changing the rxjs version would make me create a breaking changes version.

For the next release, this should be reversed, and the core should use rxjs 6, but everyone else should use rxjs-compat for the sake of old versions and compatibility.

yeah, but the 2.0 version was already a major release - therefore, i thought it would be good to introduce this "breaking change" (switch rxjs) in this course..

the next release (3.0) will be most likely some time away 😞

Yeah, the problem is that if the canvas is using rxjs^5 and you are using rxjs^6, then you can use the compat lib and the canvas will work, but if it's the other way around, you will not be able to use the canvas, since your Angular rxjs^5 app will not be able to compile since it will not know where the imports to the rxjs 6 operators are and such.

That's why if the rxjs version is to be changed, then all the older apps and platforms will not be supported from that version onward.

For now, I wanted to allow everyone to use the library. At some point soon I should completely rewrite the imports so that rxjs^6 will be used.

If you find any way to tackle this problem so that all the sides can be happy and use the lib, please make sure to tell me so that I can fix the problem right away.

I will also change the name of this issue so that it describes the problem better.

Best Regards,
Stefan

Using rxjs-compat fixes the problem, sort of.

No Child Left Behind often also results in Every Children Left Behind.

Having to use rxjs-compat sounds like a penalty against developers who could always keep the dependencies up-to-date, in this case with rxjs 6.

In software releases, we can do better.

I myself also write components/tools for developers. So in the repository, I tagged the component with something like ForAngular4.2 and ForAngular5, especially for breaking changes in my component and major dependencies. And in Nuget, keep the older releases, and in the Readme.MD file, remind application developers to use older releases if they are still using older versions of Angular.

It is generally advised to keep dependencies up-to-date for many good reasons. For those who can't enjoy the benefits of Angular 5 or 6 and upcoming 7, they should be able to use the older releases of ng-white-board in npm, along with older versions of Angular.

Don't you think this may be a more optimal balance?

Yesterday I had spent hours trying to make it work in my app on NG6, with rxjs-compat. Today, I try this component on NG6 Heroes Demo, not working either, then try it on NG5 Heroes Demo, then this component is working right away. Your @Peshou component is exactly what I need.

I told my boss I may spend 1 day to fix this. And if not progressing well, I would have to wait for your working of moving to NG6.

So today, I will do something on the fork. And if progressing well, I may create a pull request. Or I had missed something that could make current release work for NG6? Or, if you @Peshou is doing similar thing right now, I would wait.

OK. I had created a fork and make this component wok well with Angular6/RXJS6, so far so good working in the Heroes NG6 demo. When this fork works well with my app, I will push it, likely next Monday.

It would be awesome if you could create a PR here

I had created a fork at https://github.com/zijianhuang/ng2-canvas-whiteboard

I don't think the fork is in production quality since I don't know how to bundle a module into a npm package, and I don't have time to learn such skills in near future. However, you @johannesschobel can still use the TS codes directly as I am doing right now, and in the future you may still switch to the new release of ng2-canvas-whiteboard which then will support NG6.

And the fork works well now with my NG 6 app with Angular 6.1.7. I got stuck a little bit. While I had made the fork work well with the Heroes demo program on last Friday, it does not compile well with my app and the compiler kept complaining about Map<K, U, T> which I am not using such generic type anywhere in the app or in 3rd lib. After spending hours, I found that the Azure Storage js lib has Map<T..> defined but very different from Map<K,U> used in ng2-canvas-whiteboard. So I had hacked the type definition file of Azure Storage js lib a little bit, ng2-canvas-whiteboard works happily with my app, no rxjs-compat lib needed.

Hey @zijianhuang , thank you very much for your time and effort.. However, wouldn't it be better to specifically target the issue in this repository (e.g., create a new ng6 branch)? What do you think @Peshou ?

@johannesschobel , only core member of the repository could create a branch, while other contributors like me could create forks and create PR. I made the fork so you can use the improvement with NG 6 before @Peshou could have time to work on the repository.

yeah, but you can provide a PR and send it to master branch.. @Peshou can then move the PR to another branch ;)

just done a PR, though I was expecting people just copy/paste from my fork. :) if they have urgent need for their Angular 6 app and dislike rxjs-compat.

Hey guys, I guess I will just make a new ng6 branch and push it to npm as 3.0.0, while still having a master branch support for the older angular versions. The problem wasn't upgrading to rxjs^6 since I did it pretty fast. The real problem was that older angular apps could not use the library after installing the upgraded package.

I guess i will control all of this on a new branch and merge the branch with some new master changes accordingly

thanks a lot - that is awesome! 👍

@Peshou, from my dim memory, npm tool chains allow detection of dependencies. For example, if ng2-canvas-whiteboard 3.0 package with npm will check if other dependencies still include Rxjs 5 and Angular 4.x. If so, just raise a warning or stop installation of v3 if the programmers don't read the release note.

Okay let me do that first and then I can publish the library version change

I will just add rxjs^6.0.0 as a peer dependency, so that will be the warning that's going to be raised.

Okay the version is ^3.0.0, check it out please, the way the module is built was changed, but for end users everything should be the same, please check it out and give me some feedback if all is okay

One more thing, I added master to contain the ng6 files and made an ng-legacy branch which will be used for the backwards compatibility since I want the master branch to be the branch with the latest changes in this library.