Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
cmd-shim
Advanced tools
Package description
The cmd-shim npm package is designed to create command shims (or symbolic links) on Windows and Unix-like systems for node.js scripts. This allows node.js scripts to be executed as if they were native commands in the user's shell, making it easier to use node.js tools across different platforms without worrying about the underlying differences in how executable scripts are handled.
Creating command shims
This feature allows the creation of a command shim for a node.js script. The code sample demonstrates how to create a shim for a node.js script located at 'path/to/node-script.js' and place the resulting shim at 'path/to/shim'. This makes the script executable as if it were a native command.
const cmdShim = require('cmd-shim');
cmdShim('path/to/node-script.js', 'path/to/shim', function (err) {
if (err) throw err;
});
npx is a package runner tool that comes with npm. It allows you to execute any package from the npm registry without having to install it globally. While npx does not create shims, it provides a similar convenience by allowing direct execution of node.js scripts and commands. Unlike cmd-shim, npx is focused on temporary or one-off execution rather than creating a persistent executable shim.
ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API. While it primarily offers a way to script shell commands within Node.js, it shares the cross-platform scripting goal with cmd-shim. However, ShellJS does not specifically focus on creating command shims but rather on providing a wide range of shell commands within Node.js scripts.
Changelog
Readme
The cmd-shim used in npm to create executable scripts on Windows, since symlinks are not suitable for this purpose there.
On Unix systems, you should use a symbolic link instead.
npm install cmd-shim
Create a cmd shim at to
for the command line program at from
.
e.g.
var cmdShim = require('cmd-shim');
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name').then(() => {
// shims are created!
})
The same as above, but will just continue if the file does not exist.
FAQs
Used in npm for command line application support
We found that cmd-shim demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).