Gathering detailed insights and metrics for @udes/shelljs-nodecli
Gathering detailed insights and metrics for @udes/shelljs-nodecli
Gathering detailed insights and metrics for @udes/shelljs-nodecli
Gathering detailed insights and metrics for @udes/shelljs-nodecli
npm install @udes/shelljs-nodecli
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,844
Last Day
1
Last Week
5
Last Month
25
Last Year
121
7 Commits
8 Watching
3 Branches
1 Contributors
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
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
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;node_modules
;node_modules
of your CLI if it's installed globally.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`)
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})
MIT License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
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
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
60 existing vulnerabilities detected
Details
Score
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