Nyalab / caniuse-api

request the caniuse data to check browsers compatibilities
MIT License
356 stars 27 forks source link

Some features are missing in features list if caniuse-db is at the same level in node_modules #32

Closed MoOx closed 8 years ago

MoOx commented 9 years ago

https://travis-ci.org/cssnext/cssnext/builds/64634160

I get the issue locally too with another one name. I checked my features.json and there is a lot missing.

MoOx commented 9 years ago

Ok got it. Since caniuse-db can be downloaded at the same time as caniuse-api if caniuse-db is installed beside caniuse-api, you can get a pretty short list like

[ 'ambient-light',
'atob-btoa',
'audio-api',
'audio',
'audiotracks',
'autofocus',
'background-attachment',
'background-img-opts',
'battery-status',
'blobbuilder',
'bloburls',
'border-image',
'border-radius',
'broadcastchannel',
'calc',
'canvas-blending',
'canvas-text',
'canvas',
'channel-messaging',
'classlist',
'clipboard',
'iframe-sandbox' ]

Which is clearly not enough. Not sure how to fix that...

MoOx commented 9 years ago

That happen if you have caniuse-db & caniuse-api at the same level (eg: both as dep in package.json)

onigoetz commented 8 years ago

Hi, Is there any lead to fix this ? because with npm3 it's automatically at the same level ...

This causes a lot of trouble in my builds both with npm2 and npm3

onigoetz commented 8 years ago

Maybe you could embed caniuse-db using bundledDependencies ?

Other projects do this as well like strongloop/fsevents#123

This would solve this problem once and for all, and I think many other problems open on caniuse-api (like #36, #29 and maybe #39 )

MoOx commented 8 years ago

The idea was to NOT have caniuse-db in this package so you handle the version/update yourself.

Maybe we need to wait for caniuse-db to be downloaded entierly...

onigoetz commented 8 years ago

yeah sure, I understand that tying the version to caniuse-db is not a good solution.

but a randomly failing build seems worse IMHO.

How could we wait for the download to finish ?

MoOx commented 8 years ago

How could we wait for the download to finish ?

Well caniuse-db is in dependencies (but with caret range), so should be downloaded before caniuse-api execute postinstall... Not sure how to trace the origin of the issue.

The generation is causing so much trouble. I will make this optional as it is for in browser usage (eg: browserify don't like dynamic require).

onigoetz commented 8 years ago

What do you mean by "I will make this optional as it is for in browser usage" ?

Actually, it seems that this was fixed in npm/npm#6926 but only for npm@3

onigoetz commented 8 years ago

This guy seems to have a solution to this : http://krasimirtsonev.com/blog/article/Fun-playing-with-npm-dependencies-and-postinstall-script

MoOx commented 8 years ago

Are you using npm@2?

onigoetz commented 8 years ago

Yes, in some projects it's npm2

ankurp commented 8 years ago

@MoOx Is there a fix for this or can https://github.com/MoOx/postcss-cssnext not use this module as this is failing for me too.

MoOx commented 8 years ago

Closed by #47