From 9aa96e278e7ba6babe82736bd87c657104d45547 Mon Sep 17 00:00:00 2001 From: Marcel Krcah Date: Tue, 15 Dec 2020 18:07:28 +0100 Subject: [PATCH] Run npm script --- Examples.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Examples.md b/Examples.md index a360e76..9e486fe 100644 --- a/Examples.md +++ b/Examples.md @@ -1256,6 +1256,14 @@ https://gist.github.com/junegunn/15859538658e449b886f (for OS X) ### NPM [npm-fzf](https://github.com/hankchanocd/npm-fzf) - Fuzzy search npm modules with `fzf`. +``` +# run npm script (requires jq) +fns() { + local script + script=$(cat package.json | jq -r '.scripts | keys[] ' | sort | fzf) && npm run $(echo "$script") +} +``` + ### Locate `Alt-i` to paste item from `locate /` output (zsh only):