Skip to content

Commit

Permalink
Enable npm and yarn package listing
Browse files Browse the repository at this point in the history
This PR adds scripts in command_lib/base.yml and snippets.yml
to list the packages installed by npm and yarn.

Works towards #609

Signed-off-by: Rose Judge <[email protected]>
Signed-off-by: abhay <[email protected]>
Signed-off-by: Nisha K <[email protected]>
  • Loading branch information
rnjudge authored and Nisha K committed May 20, 2020
1 parent 54b5cb7 commit db83e03
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
39 changes: 39 additions & 0 deletions tern/command_lib/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,42 @@ gem:
- "pkgs=`gem list 2> /dev/null | awk '{print $1}'`"
- "for p in $pkgs; do proj_url=`gem spec $p homepage | head -1 | cut -f2 -d' '`; if [ -z $proj_url ]; then echo 'Unknown'; else echo $proj_url; fi; done"
delimiter: "\n"
# npm----------------------------------------------------------------------
npm:
pkg_format: ''
os_guess:
- 'None'
path:
- 'usr/bin/npm'
pkg_separators:
- '@'
- '@^'
- '@~'
pinning_separator: '@'
names:
invoke:
1:
container:
- "npm list -g | sed 's/\\(^[^a-z]*\\)\\([_.a-z0-9-]*\\)\\(@.*\\)/\\2/g' | grep -v '/usr*' | uniq"
delimiter: "\n"
versions:
invoke:
1:
container:
- "pkgs=`npm list -g | sed 's/\\(^[^a-z]*\\)\\([_.a-z0-9-]*\\)\\(@.*\\)/\\2/g' | grep -v '/usr*' | uniq`"
- "for p in $pkgs; do npm show $p version; done"
delimiter: "\n"
licenses:
invoke:
1:
container:
- "pkgs=`npm list -g | sed 's/\\(^[^a-z]*\\)\\([_.a-z0-9-]*\\)\\(@.*\\)/\\2/g' | grep -v '/usr*' | uniq`"
- "for p in $pkgs; do lic=`npm show $p license`; if [ -z \"$lic\" ]; then echo 'Unknown'; else echo $lic; fi; done"
delimiter: "\n"
proj_urls:
invoke:
1:
container:
- "pkgs=`npm list -g | sed 's/\\(^[^a-z]*\\)\\([_.a-z0-9-]*\\)\\(@.*\\)/\\2/g' | grep -v '/usr*' | uniq`"
- "for p in $pkgs; do npm view $p repository.url; done"
delimiter: "\n"
16 changes: 15 additions & 1 deletion tern/command_lib/snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,18 @@ bundle:
- 'init'
- 'package'
- 'exec'
packages: 'gem'
packages: 'gem'
npm:
install: 'install'
remove: 'uninstall'
ignore:
- 'ping'
packages: 'npm'
yarn:
install: 'install'
remove: 'uninstall'
ignore:
- 'publish'
- 'add'
- 'remove'
packages: 'npm'

0 comments on commit db83e03

Please sign in to comment.