https://github.com/npm/cmd-shim
The cmd-shim used in npm
https://github.com/npm/cmd-shim
npm-cli
Last synced: about 1 year ago
JSON representation
The cmd-shim used in npm
- Host: GitHub
- URL: https://github.com/npm/cmd-shim
- Owner: npm
- License: isc
- Created: 2013-03-31T17:43:56.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2025-04-28T18:53:15.000Z (about 1 year ago)
- Last Synced: 2025-05-03T23:02:46.649Z (about 1 year ago)
- Topics: npm-cli
- Language: JavaScript
- Homepage:
- Size: 298 KB
- Stars: 77
- Watchers: 14
- Forks: 41
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
# cmd-shim
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.
[](https://github.com/npm/cmd-shim)
[](https://libraries.io/npm/cmd-shim)
[](https://www.npmjs.com/package/cmd-shim)
## Installation
```
npm install cmd-shim
```
## API
### cmdShim(from, to) -> Promise
Create a cmd shim at `to` for the command line program at `from`.
e.g.
```javascript
var cmdShim = require('cmd-shim');
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name').then(() => {
// shims are created!
})
```
### cmdShim.ifExists(from, to) -> Promise
The same as above, but will just continue if the file does not exist.