Installations
npm install @udes/shelljs-nodecli
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.12.0
NPM Version
5.5.1
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
UdeS-STI
Download Statistics
Total Downloads
1,844
Last Day
1
Last Week
5
Last Month
25
Last Year
121
GitHub Statistics
7 Commits
8 Watching
3 Branches
1 Contributors
Bundle Size
64.83 kB
Minified
20.76 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.2.3
Package Id
@udes/shelljs-nodecli@0.2.3
Size
3.66 kB
NPM Version
5.5.1
Node Version
6.12.0
Total Downloads
Cumulative downloads
Total Downloads
1,844
Last day
0%
1
Compared to previous day
Last week
-28.6%
5
Compared to previous week
Last month
733.3%
25
Compared to previous month
Last year
-41.3%
121
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
ShellJS Node CLI Extension (UdeS version)
An extension for ShellJS that makes it easy to find and execute Node.js CLIs.
The difference between the original package and this version is that
the module will also searches inside the node_modules
of your CLI.
So, this module will searches as the following way:
node_modules
of the project where your CLI is installed or where you actually execute a command of your CLI;- global
node_modules
; node_modules
of your CLI if it's installed globally.
The Problem
ShellJS is a fantastic tool for interacting with the shell environment in a cross-platform way. It allows you to easily write scripts that would otherwise be written in bash without worrying about compatibility.
The only problem is that it's a real pain to execute Node binaries that
are installed locally. Most end up manually looking into the node_modules
directory to find the binary file to execute directly with Node, especially
when working on Windows, where the files in node_modules/.bin
tend not to
work from scripting environments like make and ShellJS. Consequently, you end
up seeing a lot of this:
1import shell from 'shelljs' 2 3const ESLINT = 'node_modules/eslint/bin/eslint.js' 4 5shell.exec(`node ${ESLINT} myfile.js`)
The Solution
Since Node binaries are specified in their package.json
files, it's
actually pretty easy to look up the location of the runtime file and
get the path. That's where the ShellJS Node CLI extension comes in:
1import ShellJSNodeCLI from '@udes/shelljs-nodecli' 2 3ShellJSNodeCLI.exec('eslint myfile.js')
The nodeCLI utility has its own exec()
that is specifically for use
when executing Node CLIs. It searches through the working directory's
node_modules
directory to find a locally installed utility. If it's
not found there, then it searches globally. Finally, it will searches
inside the node_modules
of your CLI. If it's still not found, then
an error is thrown.
You can pass in as many string arguments as you'd like, and they will automatically be concatenated together with a space in between, such as:
1import ShellJSNodeCLI from '@udes/shelljs-nodecli' 2 3ShellJSNodeCLI.exec("eslint -f compact myfile.js");
This ends up creating the following string:
1eslint -f compact myfile.js
This frees you from needing to do tedious string concatenation to execute the command.
The exec()
method otherwise behaves exactly the same as the default
ShellJS exec()
method, meaning you can use the same options and
callback arguments, such as:
1import ShellJSNodeCLI from '@udes/shelljs-nodecli' 2 3const version = ShellJSNodeCLI.exec('eslint -v', {silent:true}).output; 4 5const child = ShellJSNodeCLI.exec('some_long_running_process', {async:true}) 6child.stdout.on('data', (data) => { 7 /* ... do something with data ... */ 8}) 9 10ShellJSNodeCLI.exec('some_long_running_process', (code, output) => { 11 console.log('Exit code:', code) 12 console.log('Program output:', output) 13})
Copyright
- Copyright 2014 Nicholas C. Zakas. All rights reserved.
- Copyright 2017 Université de Sherbrooke. All rights reserved.
License
MIT License
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
Found 2/7 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Reason
60 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-mh2h-6j8q-x246
- Warn: Project is vulnerable to: GHSA-5q88-cjfq-g2mh
- Warn: Project is vulnerable to: GHSA-xp63-6vf5-xf3v
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq
- Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-8g7p-74h8-hg48
- Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-675m-85rw-j3w4
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3
- Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
2.2
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More