raine / ramda-cli

:ram: A CLI tool for processing data with functional pipelines
ISC License
573 stars 12 forks source link

--import parameter installs modules from npm #13

Closed raine closed 5 years ago

raine commented 5 years ago

In previous usage of the --import <pkg> parameter, the modules would have had to been manually installed by the user. With this change, --import will transparently install modules for the user as needed.

Since this is a command-line tool, a goal was to have importing of previously installed modules resolve instantly. This means it won't be checking npm registry for updates either. This could be circumvented by importing a module with the tag latest, e.g. ramda@latest. Worth noting is that it accepts same package arguments as npm install. Versions, tags, github repos, tarballs, whatever.

The way you set an alias for imported module has changed as well. Instead --import R=ramda, you now do --import ramda:R. replem implements this new format and it feels nicer to use.

The installed modules are cached at ~/.config/ramda-cli.

screenshot 2019-01-06 at 17 01 38

% date -v +7d +%s | ramda -rR --js --import moment:m 'm.unix' 'x => x.fromNow()'
in 7 days

Two npm modules were spawned in creating this: