Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

better-opn

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-opn - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

6

CHANGELOG.md

@@ -10,2 +10,8 @@ # Changelog

## [2.1.0] - 2020-10-18
### Added
- Support reuse tab with same host (#13) @otakustay
## [2.0.0] - 2020-04-06

@@ -12,0 +18,0 @@

15

dist/index.js

@@ -41,2 +41,15 @@ "use strict";

};
};
var normalizeURLToMatch = target => {
// We may encounter URL parse error but want to fallback to default behavior
try {
// Url module is deprecated on newer version of NodeJS, only use it when URL class is not supported (like Node 8)
var URL = // eslint-disable-next-line node/prefer-global/url
typeof global.URL === 'undefined' ? require('url').URL : global.URL;
var url = new URL(target);
return url.origin;
} catch (_unused) {
return target;
}
}; // Copy from

@@ -65,3 +78,3 @@ // https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/openBrowser.js#L64

execSync('ps cax | grep "' + chromiumBrowser + '"');
execSync("osascript ../openChrome.applescript \"".concat(encodeURI(url), "\" \"").concat(chromiumBrowser, "\""), {
execSync("osascript ../openChrome.applescript \"".concat(encodeURI(process.env.OPEN_MATCH_HOST_ONLY === 'true' ? normalizeURLToMatch(url) : url), "\" \"").concat(chromiumBrowser, "\""), {
cwd: __dirname,

@@ -68,0 +81,0 @@ stdio: 'ignore'

2

package.json
{
"name": "better-opn",
"version": "2.0.0",
"version": "2.1.0",
"description": "A better opn. Reuse the same tab on Chrome for 👨‍💻.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -22,4 +22,14 @@ # better-opn

### Reuse tab by match host
In case your app can navigate to another pathnames and still want to reuse opened tab, set environment variable `OPEN_MATCH_HOST_ONLY=true` can tell this program to find reusable tab by only match the host part of your URL.
```js
process.env.OPEN_MATCH_HOST_ONLY = 'true';
opn('http://localhost:3000/foo/bar'); // This will reuse any tab with URL starting with http://localhost:3000/
```
## Author
- [Michael Lin](https://michaellin.me)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc