
Show HN: CLI for trying out Node.js modules easier - diggan
https://github.com/VictorBjelkholm/trymodule
======
gravypod
This is one of those really cool ideas that is obvious after someone else much
smarter then yourself thinks of it first.

I wish this was in NPM.

~~~
tolmasky
Actually it is, at least the npm website. Every page on npm has a "try it now"
link that takes you to a page on tonicdev where you can try the package. For
example: [http://tonicdev.com/npm/canvas](http://tonicdev.com/npm/canvas) \-
no need to download, build, or install. It loads a container so you have a
real node environment (I'm a dev in this if you have any questions).

~~~
BillinghamJ
I use this regularly - it's great. Only issue is I can never remember the
domain name! :)

It'd actually be pretty helpful if you made it something like
[https://try.tonicdev.com/npm/canvas](https://try.tonicdev.com/npm/canvas)
because then I can just type "try." and my browser will find it for me.

------
murukesh_s
Just 57 lines of code. Someone was asking about beautiful code in other
thread, I believe this is a fine example of it. Plumbing together reusable
modules to build useful (and never before imagined) stuff. Kudos to the author
and the node.js ecosystem..

~~~
diggan
Yeah, saw that though but can't agree that this would be an example of it.
It's more an example of the later part, the beauty of having small modules,
ready to be used and just plumbing them together in a small way.

Thanks for the kind words though, warms my heart that someone likes it.

------
alehander42
It would be very cool to detect an example from npm docs or github repo and
input it initially!

~~~
tolmasky
A bunch of npm modules now provide tonicExample or tonicExampleFilename, which
is used by npm/tonic try it now:
[https://tonicdev.uservoice.com/knowledgebase/articles/765846...](https://tonicdev.uservoice.com/knowledgebase/articles/765846-how-
do-i-customize-the-example-for-my-npm-package)

------
amelius
Next step: a try-it-on-the-web interface?

~~~
SlashmanX
Doesn't that already exist on the NPM interface? The "try it now in your
browser" which links to TonicDev. Or are you suggesting something else?

~~~
amelius
In that case, why would we need a CLI tool for trying out packages?

~~~
diggan
Offline capabilities + easier to use for some people (one of them being me).
Loading up a webpage every time I want to try some new nodejs module would not
work as well as opening up a nodejs repl with the module loaded there.

~~~
boucher
Obviously it won't work offline if you haven't already installed the package
(which seems like the general case?)

I'm biased of course, and I understand why some people are turned off by an in
browser solution. But I think it's probably faster, in most cases, to try
something you've never installed in Tonic than in this. (And I hope there's
genuine value in things like being able to share links to your experiments.)

~~~
diggan
Yeah, that is true for sure, difference being that the 10% use-case (installed
package before, offline now) is still usable if it's local and not on tonic-
dev.

I like tonic-dev, don't get me wrong. But the workflow for using a package in
tonic-dev is too slow compared to having it in a REPL, at least for me. Might
be because I'm using Firefox and the performance for tonic-dev is terrible
there, but mostly because I feel more at home in the terminal than in a js-
editor in the browser.

~~~
boucher
Understood. We definitely have work to do in Firefox.

