ramda-cli icon indicating copy to clipboard operation
ramda-cli copied to clipboard

ramda-cli-tutorial.md

Open thurt opened this issue 9 years ago • 2 comments

https://gist.github.com/raine/d12d0ec3e72b2945510b

Thanks for the tutorial! A few things:

  • After installing ramda-cli, I have command ramda, not R. I see that alias R='ramda' is in the readme but it could also go in this tutorial at the beginning.
  • I was confused by reverse 'take 10' -- initially thinking that reverse takes take 10 as an argument. I suggest putting reverse on a newline. I think this makes it more consistent by showing each line is equivalent to one argument to R.pipe:
curl -s $url | R -p 'filter where-eq fork: false' \
  'project [\name \stargazers_count]' \
  'sort-by prop \stargazers_count' \
  reverse \
  'take 10'
  • Regarding run from file: Can I require the version of ramda installed by ramda-cli in my script? Or should I install npm install -g ramda separately?

thurt avatar May 01 '16 18:05 thurt

Thanks for the feedback, Taylor.

  • After writing the tutorial, I removed the R command alias from getting installed and changed it to recommendation of using a shell alias instead.
  • Good point. I think wrapping reverse in quotes would also help.
  • Good question. I believe using require("ramda") would use ramda from ramda-cli. I'm not sure if ramda-cli would understand globally installed modules. It's probably not the best practice but I tend to install the modules to home directory. There could be a node_modules specific to ramda-cli. Like cd ~/.ramda-cli && npm install whatever.

If you have any thoughts or feedback on the readme also I'd appreciate that as well!

raine avatar May 09 '16 12:05 raine

Hi @raine

Regarding bullet point 3: I could not load ramda-cli or ramda with require so I already went out looking for the answer. The story goes:

To use global modules, you can create a symlink via npm command

$ npm link name-of-module

This puts a symlink to the package in the local node_modules folder. After this, you can directly require any of the module's dependencies (without having to install them separately) by following the folder pattern:

require('ramda-cli/node_modules/ramda')

I am planning on working through the readme at some point this week so I will get back to you on that one. Feel free to close this issue!

thurt avatar May 10 '16 01:05 thurt