chaijs / chaijs.github.io

The chaijs.com website source code. Contributions welcome.
http://chaijs.github.io
49 stars 71 forks source link

Prefetch plugin data from npm #81

Closed keithamus closed 8 years ago

keithamus commented 9 years ago

Hey @logicalparadox here's a quick attempt at getting plugins to be prefetched.

This uses npm-plugin-fetcher which is a quick script I wrote for this - which just pulls downs package.json files with the chai-plugin keyword in their package.json (actually, the files it pulls are more than just package.json - they include readme data and other bits, see https://registry.npmjs.org/chai-spies as an example).

These are all downloaded into ./out/plugins/ as JSON files. For now to keep this PR simple, I've just refactored the plugins server and added the prefetch command to the makefile. But future PRs could drop the server requirement and make the site a fully static-generated site.

If you demo this server you'll notice there is a somewhat limited list of plugins available on the plugins page - this is because not all plugins include the chai-plugin keyword. If you're happy with this PR then I can go and make PRs in all of the packages we have manually listed to add those keywords - alternatively as a quick hack for now, we can just add a bunch of curls to the plugins make task (or we could do a combination of both).

Also, whereas before plugins in our plugins.js needed to say browser:true or node:true - now they have to include the keywords chai-plugin-browser (browser:true) or chai-plugin-browser-only (browser:true,node:false). I figured this was a happy compromise with our existing list - although we lose out on informing visitors exactly how to use the files in browser, but I don't see this as much of an issue personally.

Oh, and this fixes #34

keithamus commented 8 years ago

Closing this, as its now part of gh-pages.