Commit Graph

31 Commits

Author SHA1 Message Date
Indrajit Raychaudhuri 6833fcd2f2 node: Cleanup and optimize 'node' module
Changes:
- Simplify nodenv and nvm initialization
- Check for availability of `nodenv` or `nvm` function instead of command
- Unset local variables outside condition block
2021-06-01 21:43:11 -05:00
Ehren Kret 53033bc5d9 Fix broken source commands in node module
Placing `--no-use` inside the quoted string results in source
attempting to load a file which literally ends with ` --no-use`
instead of passing --no-use as an argument.
2021-05-24 11:33:49 -05:00
Indrajit Raychaudhuri 9459a716bf node: Add handy aliases for 'npm'
Add standard `npm` aliases that are used frequently.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri 28ec39d9b2 node: Add environment variable to store 'n' cache
See: https://github.com/tj/n#installation for details.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri 9f37fc9841 node: Optimize completions for loading lazily on demand
Move `grunt` and `gulp` to separate completion definitions wrapping
`grunt --completion=zsh` and `gulp --completion=zsh` respectively.

Since the completions are loaded lazily on demand, they avoid the
performance overhead during Zsh initialization.

Additionally, remove `npm` completion since it is already bundled with
Zsh for quite a while.
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri f84075b8d4 node: Prefer nodenv over nvm when available
Reverse `nodenv` vs `nvm` selection order, preferring `nodenv` instead.

For additional rationale, see: https://github.com/nodenv/nodenv/wiki/Why-nodenv%3F
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri af46875c5e node: Revamp and optimize 'node' module
Changes:
- nodenv and nvm now honors (and prioritizes) `$XDG_CONFIG_HOME` over
  `$HOME` to lookup local nodenv/nvm installation.
- Make `nvm` loading lazy (via `--no-use` argument).
- Remove redundant NODENV_ROOT or NVM_DIR, respective script already
  set them up.
- Adhere to more idiomatic Zsh operation and minimize external command
  usage (like `sed`).
2021-05-21 13:39:23 -05:00
Indrajit Raychaudhuri 68300e6de4 node: Fixup nvm path detection for Homebrew based nvm
Prefer using `brew --prefix nvm` instead of just `brew --prefix` and
actually use the variable `nvm_prefix` once detected and set up.
2021-05-05 11:50:59 -05:00
Texas Toland ff91c8d410
Make .zcomp* location configurable (#1842) 2020-06-04 13:53:44 -07:00
laggardkernel 61de4d199d node: support environment variables NVM_DIR and NODENV_ROOT 2019-09-10 09:00:11 -07:00
Jeff Widman 4a16d3fa50 Fix typo: gupl --> gulp (#1668) 2019-01-02 18:04:07 -08:00
Indrajit Raychaudhuri d45d87b08f node: Make nvm lookup mechanism more efficient in homebrewed environment
In homebrewed environment, avoid using `brew --prefix nvm` which is
ruby based and is super slow. Instead, rely on homebrew standard
behavior wherein all installed packages are available in canonical
path $(brew --prefix)/opt/<package> (for nvm it would obviously be
`$(brew --prefix)/opt/nvm`).

NB: `$(brew --prefix)` (without additional argument) is a simple shell
shortcut and doesn't have the same performance impact.
2018-12-12 22:32:51 -06:00
Indrajit Raychaudhuri a2398fc045 node: Cache completion for additional helpers
Add support for npm and additional well-known helper commands
2018-12-11 08:12:09 -06:00
Casey McGinty 2995b7d0c8 Update cache files when .zpreztorc file is modified
Fixes #1581
2018-05-06 13:22:22 -07:00
Kaleb Elwert 948d9b3aa5 Store cache files in a user-writable location
Fixes #1122
2017-11-10 11:37:14 -08:00
Indrajit Raychaudhuri a60499f933 [general] Miscellaneous cleanup and formatting 2017-08-04 13:45:56 -05:00
Indrajit Raychaudhuri 8846db9d4d [node] Always quote files when `source`-ing 2017-07-23 00:35:56 -05:00
Fernando H-T Goldáraz 42d9b78907 broken $path and $PATH if nodenv exists (#1315)
This change fixes a bug where no command can be found
(e.g. `ls`) due to the $path array being set to two elements,
one of them with all the previous paths separated by spaces.
This makes zsh break $PATH, instead of colons there are
spaces, and nothing works.

The idea is to have the array be set leveraging the word splitting
that we usually are told to avoid by quoting.
2017-05-02 11:38:19 -07:00
Griffin Yourick 94708f6b50 Fix path in node module 2017-04-10 11:43:17 -07:00
Griffin Yourick 8dafaae5a4 Use patterns from ruby module for initializing nodenv 2017-04-10 11:36:56 -07:00
Jamie Rolfs 483447082b Add nodenv support to Node.js module
- Implementation from https://github.com/sorin-ionescu/prezto/pull/1001
- Documentation from https://github.com/sorin-ionescu/prezto/pull/1178
2017-04-04 21:26:33 -07:00
Sorin Ionescu ee0b02464c [Fix #819] Check for node as a last resort 2015-02-24 15:29:25 -05:00
Tobias Witt e144abb285 Fix node-module
The change recently introduced for #777 was actually breaking the module
completely, as it was only loaded if neither `node` nor `nvm`
were available.
2015-02-23 12:11:21 -05:00
Sorin Ionescu 1292587f95 [Fix #777] Check for nvm or node 2015-02-22 21:53:40 -05:00
Sorin Ionescu b948e3630b Load Homebrew installed NVM 2014-10-13 11:57:20 -04:00
Sorin Ionescu a84ac5b002 Only one newline at end of file 2014-10-09 23:38:15 -04:00
Zeh Rizzatti 185235003e Add support for nvm 2013-01-29 13:43:06 -05:00
Sorin Ionescu 060d9064f8 [Fix #202] Load modules all or nothing 2012-08-04 14:32:59 -04:00
Sorin Ionescu bede1a2a71 Improve cache file generation 2012-07-03 21:38:56 -04:00
Sorin Ionescu e5ec94af42 Check for non-empty files, not just existance 2012-05-05 18:08:25 -04:00
Sorin Ionescu a7340886b3 [#23] Rename plugins to modules 2012-04-05 13:39:40 -04:00