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

Migrate to caniuse-lite. #57

Closed
ben-eb opened this issue Apr 8, 2017 · 14 comments
Closed

Migrate to caniuse-lite. #57

ben-eb opened this issue Apr 8, 2017 · 14 comments

Comments

@ben-eb
Copy link
Contributor

ben-eb commented Apr 8, 2017

Hi @Nyalab!

I've been working on an unofficial way to consume caniuse support data that is intended for modules, whereas the official dataset is intended for people. So I dropped a lot of keys that Autoprefixer & Browserslist don't use and then compacted the rest of the data. The end result weighs around 7 times less than the official database as of this writing, and the only downside is a slight performance hit when the data is restored into a caniuse format. We optimised for size, not speed, but I think we can perhaps improve this further in the future. For now the dataset is as close to caniuse-db as possible, for easy migration.

So I think it's important to use a single source of truth for the support data, and as I am starting to make much more use of caniuse-api I'd like to update the module to use caniuse-lite too.

My only reservation about the migration is that you are using the title key from each feature. I'd like to know if that can be dropped so that we can keep caniuse-lite as lean as possible. But I would like some input from caniuse-api users, on whether they think this is necessary or not. I'm open to any feedback! 😄

Copying in users of this module/caniuse data: @agauniyal, @una, @schiehll, @sylvainpolletvillard, @MoOx, @bebraw & @ai.

Thanks!

@ai
Copy link

ai commented Apr 8, 2017

I think caniuse-lite is one of the best thing in frontend in 2017. With it we will dramatically reduce node_modules size around the world. Autoprefixer and Browserslist will use it in next major release.

@ben-eb
Copy link
Contributor Author

ben-eb commented Apr 10, 2017

I did some additional research into the title key, the additional cost of including it is quite insignificant (as of right now it adds 11KB total weight to the data), whereas I think not including it might negatively impact caniuse-api; and I don't believe that we should expect people to load both datasets, it should be either or.

For example, https://github.com/ZoomZhao/canidiff uses both browserslist and caniuse-db; with browserslist moving its source of truth to caniuse-lite, this module will have to load the data essentially twice; ping @ZoomZhao.

So based on this my conclusion is that we should add the title key as well to caniuse-lite. Any objections?

@MoOx
Copy link
Collaborator

MoOx commented Apr 10, 2017

What about letting people choose between one or the other? Anyway, node_modules for real world projet is never less than 100MB so not sure it's super important.

@ai
Copy link

ai commented Apr 10, 2017

@MoOx nobody block you from using caniuse-db. But from my point of view using caniuse-lite is more reasonable for everyone.

Many users complains about node_modules size and caniuse-db is often biggest dependency.

@ben-eb
Copy link
Contributor Author

ben-eb commented Apr 10, 2017

The problem with allowing choice of dataset is that people will want to choose different options and users will be stuck with even more to download; both caniuse-lite and caniuse-db, for those modules who don't agree on a single source of truth. Hypothetically speaking, we would have an even bigger mess than what we started with.

That's why I would like us to unify caniuse tools around this smaller dataset, which is specifically designed for module authors and use cases that need only the statistics that caniuse-db provides (which is most likely the vast majority).

I am currently working on a fully automated publishing/testing solution for caniuse-lite so that the maintenance cost can be handled entirely by computers, making the human cost very small (financial, mostly).

@bebraw
Copy link

bebraw commented Apr 10, 2017

@ben-eb Could caniuse-db consume caniuse-lite as a dependency? Maybe that would keep both parties happy.

@ai
Copy link

ai commented Apr 10, 2017

@bebraw unfortunately, caniuse-db author ignore community needs and don’t answer. I suggested him to reduce dependency size and his answer was that caniuse-db is just for Can I Use website.

So there is no way to change something in caniuse-db. This is main reason to create caniuse-lite — to solve our needs, reduce size and inconsistency.

@bebraw
Copy link

bebraw commented Apr 10, 2017

@ai Ok, sad to hear. Big 👍 for caniuse-lite then.

@ben-eb
Copy link
Contributor Author

ben-eb commented Apr 14, 2017

0.3.0 is out, includes the title key for each feature. 😃

@ai
Copy link

ai commented Apr 14, 2017

@Nyalab your comments will be very helpful here.

@Nyalab
Copy link
Owner

Nyalab commented Apr 16, 2017

Hello everyone, sorry for the delay, i was moving houses, it is over now.

It is ok for me to switch on caniuse-lite, good job from you guys! I do not have much time right now because of the house moving, if you want to do a PR you can, i will review it as soon as i can, else i will do it when i will have some time available except when i am not making boxes 🤣

@ben-eb
Copy link
Contributor Author

ben-eb commented Apr 16, 2017

@Nyalab Cool, planning to start automated releases tomorrow, will send a PR just before this. 👍

@agauniyal
Copy link

agauniyal commented Apr 18, 2017

@ben-eb nice effort 👍 . So after this change, which repo/package should we be using? This caniuse-api or some other?

Edit: Does caniuse-lite supports "CSS 2.1 properties (well-supported subset)" properties? For ref - #55

@ben-eb
Copy link
Contributor Author

ben-eb commented Apr 18, 2017

@agauniyal Yep, I think I will recommend a major release of caniuse-api because of the data source migration. However the surface API does not need to be changed. 😃

I'm waiting on a caniuse-db release to see if my publish script is working as intended and then I can recommend switching.

@Nyalab Nyalab closed this as completed in 1f10589 May 3, 2017
Nyalab added a commit that referenced this issue May 3, 2017
Migrate from caniuse-db to caniuse-lite. Closes #57 #60.
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

No branches or pull requests

6 participants