cerebral / webpackbin

[Deprecated]. Please move to codesandbox.io.
https://webpackbin-prod.firebaseapp.com/
202 stars 26 forks source link

API for project upload #7

Closed mbrookes closed 6 years ago

mbrookes commented 7 years ago

Hi @christianalfoni!

We link to a simple example webpackbin from the Material-UI issue template, but it would be fantastic to be able to link to live versions of the examples from the Material-UI docs examples, either updating the js file in an existing base project, or uploading an entire project programmatically when the docs example changes.

The result would be similar to what AngularMaterial do with CodePen.

Is this a feature you'd consider adding in some form? Thanks!

christianalfoni commented 7 years ago

Hi there :)

There has been talk of pointing a bin to a repo, so whenever you open the bin it will grab the files from the repo, or some folder in repo. Would that suffice?

mbrookes commented 7 years ago

Thanks Christian for the quick response.

That would work - we could have a folder for each demo in the Material-UI repo. Would it grab a whole bin project including the config so we can bump imported package versions without having to edit the bins and update the URLs every time?

Our docs demos are designed to run independently of the docs site (fully copy pasteable), ~although we may need to massage the imports to work with WebpackBin, but that's easily scriptable.~ Edit - seems the imports work as-is!

christianalfoni commented 7 years ago

I think this feature will pan out to be something like you just pasting in the url to the repo (folder) you want webpackbin too look up. It will then change URL to grab the contents somehow, probably API, or maybe need to download ZIP. The content is extracted and it checks package.json for version and dependencies. Then it will build up the bin and store url and current version on the BIN itself.... that way it can check if version has changed to trigger a new download to update the bin.

It gets quite complicated, cause it also needs to have loaders added. And if you can manually save loaders after bin has been extracted from repo you could also potentially change the code, which means you should probably be able to reset the bin... so yeah, quite a few things to keep in mind :-)

But this would not work well without a file explorer, so will implement that first. It already handles folders using folder/index.js in the filename, there is just no UI for handling it :)

mbrookes commented 7 years ago

I'm missing the link here to why a file explorer is needed?

If in webpackbin we can just paste in the link to a repo folder that contains the bin project, and it grabs the needed files from there, and does its magic, what's the file explorer used for?

I don't think it's necessary to be able to browse a github repo for an MVP version at least. Copy/paste of URL is plenty good enough.