-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Export to fiddle #169
Comments
This sounds like such a good idea. I'll ping the creator of these services for good measure, feel free to chime in! /cc @christianalfoni (WebpackBin), @voronianski (ESNextBin), @ggoodman (Plunker) |
Sounds like fun. The challenge from the Plunker perspective is with respect to bundling. To reproduce the right UX, users would expect to be able to make changes to source files and have those recompiled on the fly. Plunker doesn't (currently) support bundling in its run server. It does support building with
The same logic could be applied to |
In order to support http://esnextb.in you just need to save GitHub gist with the following files:
example gist - https://gist.github.com/voronianski/0cfe5ed99c004b74a463 |
GitHub gists seem like an amazing “intermediate representation”. “Upload to gist” would be a great feature by itself, and if other tools could offer “import from gist”, the problem would be solved. |
That's a good point. To load any gist in the Plunker editor, this pattern On Mon, Jul 25, 2016 at 10:04 AM Dan Abramov notifications@github.com
|
The problem with gists is that they can't have subdirectories (and filenames cannot contain |
Oh, that’s frustrating. We could settle on a custom format like |
@ForbesLindesay this is, indeed, a problem. IIRC gist.run gets around this by using backslashes in lieu of forward slashes and does a dynamic remapping. Plunker's new embed editor copied this approach but I can't remember if I did the same for the older, main, editor. |
I started working on this today for CodeSandbox. The idea is that people can either paste a github url (codesandbox.io/s/github/:user/:repo/tree/:branch/:path*) or use a cli ( I'm getting the dependencies from the package.json and use all files in Let me know if you have more suggestions! |
@CompuIves how about files in the |
@viankakrisna CodeSandbox doesn't support static file hosting yet. I want to add this in the future, but I need to do some thinking on scalability and infrastructure for this. My proposal is to show this as a warning in the CLI until it's added to CodeSandbox. |
I think an overall better solution here is to not make the CLIs push to a specific code sharing tool, but rather a command to push to a github repo:
That way it will be possible for any bin service that integrates github support to use them, also public files. Basically:
Instead of creating a Making custom CLI command for create-react-app and custom implementation for codesandbox does not feel very "open sourcy" ;-) |
I agree, pushing to a repo is more open and solves the static file hosting too. There are two drawbacks with this approach we need to take note of:
It would be easier to implement a simple cli that can call an endpoint to create a sandbox, but I think that in the end it would be better and more fair to have a cli that can push to github instead. |
I don’t think CRA itself should integrate such a command. But if Code Sandbox provides a command that “just works” with CRA-generated projects it would be great, and we’d be happy to advertise it. Then somebody else could make another tool for other sandboxes, or maybe even collaborate on one tool with many targets. |
Yeah, if @CompuIves wants to pioneer this that would be awesome :) Will probably meet some issues and learn some lessons that could maybe go into a more generic tool later :D |
@christianalfoni, @CompuIves how do you go about serving apps with explicit dependencies on webpack builds with usable latency? Ultimately, if a tool like CRA can produce an output suitable for static consumption by a web browser, then any fiddle (or even dropbox) would be able to serve this. The challenge is closing the edit, preview, adjust cycle at scale with something as heavy as babel + webpack seems excessively $$ and risky (running untrusted code). |
@ggoodman Short story here is that NPM dependencies are packaged into a Webpack DLL separately from your bin code. The bundle is aggressively cached in browser, uses CDN for others to grab same compilation of packages. That means that only code that is really handled is your actual BIN code, as if there were no NPM dependencies, they are all externals. So it is insanely fast :) Though there are of course limits. It depends on the scope I suppose. I would suggest people would use this CLI tool for relatively small examples, not huge projects. But yeah, I feel very confident that both webpackbin and codesandbox can handle a lot bigger projects than what they currently do now as a "fiddle" service :) If that answered your question? |
Yes, already found some things 😄. Everything will be open source, git extractor is here: https://github.com/CompuIves/codesandbox-git-extractor. I will open source the cli as soon as I start working on that. |
I finished the CLI! You can find it here: https://github.com/CompuIves/codesandbox-cli. |
@CompuIves Awesome! Would you like to send a PR to add a snippet to the user guide? |
I'll close as we don't intend to implement this specifically ourselves. |
I want to find a way to provide something like “export to fiddle” by default. There is a lot of value in that for sharing prototypes and especially bug reports. I think everyone would win if it was easy to share editable source of your project right from the command line.
Fiddles are probably not the best tool for this because they tend to only have a single file view. But there are other tools such as http://plnkr.co, http://www.webpackbin.com/ and https://esnextb.in/. They allow multiple files and npm packages.
I think this would be an interesting direction to explore. I'm not saying we will necessarily build support for either of them but I think it's worth investigating.
The text was updated successfully, but these errors were encountered: