Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yyz945947732/open-npm-link

Open the npm link for the package
https://github.com/yyz945947732/open-npm-link

browser launch npm npmlink open opener opens package website

Last synced: 28 days ago
JSON representation

Open the npm link for the package

Awesome Lists containing this project

README

        

# open-npm-link

> Open the npm link for the package



Version


PRs Welcome


GitHub license

This is meant to be used in command-line tools and scripts, not in the browser.

## Install

```bash
npm install --save open-npm-link
```

**Warning:** This package is native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and no longer provides a CommonJS export. If your project uses CommonJS, you will have to [convert to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) or use the [dynamic `import()`](https://v8.dev/features/dynamic-import) function. Please don't open issues for questions regarding CommonJS / ESM.

## Usage

```js
import open from 'open-npm-link';

// Opens the react npm link in the default browser.
await open('lodash');

// Opens the react npm link in the specified browser.
await open('lodash', 'chrome');
```

### API

```js
function(packageName?: string, browser?: string): string;
```

## Supported browser

- [`chrome`](https://www.google.com/chrome) - Web browser
- [`firefox`](https://www.mozilla.org/firefox) - Web browser
- [`edge`](https://www.microsoft.com/edge) - Web browser
- `browser` - Default web browser
- `browserPrivate` - Default web browser in incognito mode

`browser` and `browserPrivate` only supports `chrome`, `firefox`, and `edge`.

## Related

- [open-npm-link-cli](https://github.com/yyz945947732/open-npm-link-cli) - CLI for this module

## LICENSE

[MIT](https://github.com/yyz945947732/open-npm-link/blob/master/LICENSE)

---

This project is created using [generator-stupid](https://github.com/yyz945947732/generator-stupid).