better-opn
Advanced tools
Comparing version 0.1.4 to 1.0.0-rc.1
"use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
const _require = require('child_process'), | ||
execSync = _require.execSync; | ||
var { | ||
execSync | ||
} = require('child_process'); | ||
const OSX_CHROME = 'google chrome'; | ||
const Actions = Object.freeze({ | ||
var OSX_CHROME = 'google chrome'; | ||
var Actions = Object.freeze({ | ||
NONE: 0, | ||
@@ -16,8 +19,8 @@ BROWSER: 1 | ||
const getBrowserEnv = () => { | ||
var getBrowserEnv = () => { | ||
// Attempt to honor this environment variable. | ||
// It is specific to the operating system. | ||
// See https://github.com/sindresorhus/opn#app for documentation. | ||
const value = process.env.BROWSER; | ||
let action; | ||
var value = process.env.BROWSER; | ||
var action; | ||
@@ -41,4 +44,4 @@ if (!value) { | ||
const startBrowserProcess = function startBrowserProcess(browser, url) { | ||
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var startBrowserProcess = function startBrowserProcess(browser, url) { | ||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
// If we're on OS X, the user hasn't specifically | ||
@@ -48,3 +51,3 @@ // requested a different browser, we can try opening | ||
// existing tab when possible instead of creating a new one. | ||
const shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (typeof browser !== 'string' || browser === OSX_CHROME); | ||
var shouldTryOpenChromeWithAppleScript = process.platform === 'darwin' && (typeof browser !== 'string' || browser === OSX_CHROME); | ||
@@ -56,3 +59,3 @@ if (shouldTryOpenChromeWithAppleScript) { | ||
execSync('ps cax | grep "Google Chrome"'); | ||
execSync(`osascript ../openChrome.applescript "${encodeURI(url)}"`, { | ||
execSync("osascript ../openChrome.applescript \"".concat(encodeURI(url), "\""), { | ||
cwd: __dirname, | ||
@@ -77,3 +80,3 @@ stdio: 'ignore' | ||
const options = _objectSpread({ | ||
var options = _objectSpread({ | ||
app: browser | ||
@@ -83,9 +86,10 @@ }, opts); | ||
console.debug(options); | ||
return require('opn')(url, options); | ||
return require('open')(url, options); | ||
}; | ||
module.exports = (target, opts) => { | ||
const _getBrowserEnv = getBrowserEnv(), | ||
action = _getBrowserEnv.action, | ||
value = _getBrowserEnv.value; | ||
var { | ||
action, | ||
value | ||
} = getBrowserEnv(); | ||
@@ -92,0 +96,0 @@ switch (action) { |
{ | ||
"name": "better-opn", | ||
"version": "0.1.4", | ||
"version": "1.0.0-rc.1", | ||
"description": "A better opn. Reuse the same tab on Chrome for 👨💻.", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"engines": { | ||
"node": ">6.0.0" | ||
"node": ">8.0.0" | ||
}, | ||
@@ -37,3 +37,3 @@ "files": [ | ||
"dependencies": { | ||
"opn": "^5.4.0" | ||
"open": "^6.4.0" | ||
}, | ||
@@ -47,5 +47,4 @@ "devDependencies": { | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"opn": "^5.4.0", | ||
"prettier": "^1.13.7" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131117
7
7
82
+ Addedopen@^6.4.0
+ Addedopen@6.4.0(transitive)
- Removedopn@^5.4.0
- Removedopn@5.5.0(transitive)