Skip to content

Commit

Permalink
Upgrade opn to open (#622)
Browse files Browse the repository at this point in the history
* Upgrade `opn` to `open`

* Require Node.js 8
  • Loading branch information
LitoMore authored and SBoudrias committed Jul 1, 2019
1 parent 932ef07 commit c09422b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: node_js
node_js:
- 12
- 10
- 8
- 6
before_install:
- npm install --global npm@latest
after_success:
Expand Down
2 changes: 1 addition & 1 deletion lib/completion/completer.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Completer {
const flag = help.flags[key];

if (flag.alias) {
alias.push(Object.assign({}, flag, {name: flag.alias}));
alias.push({...flag, name: flag.alias});
}

flag.name = key;
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/help.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const inquirer = require('inquirer');
const opn = require('opn');
const open = require('open');

module.exports = app => {
app.insight.track('yoyo', 'help');
Expand Down Expand Up @@ -31,6 +31,6 @@ module.exports = app => {
return;
}

opn(answer.whereTo);
open(answer.whereTo);
});
};
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"yo-complete": "lib/completion/index.js"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"postinstall": "yodoctor",
Expand Down Expand Up @@ -57,7 +57,7 @@
"lodash": "^4.17.10",
"meow": "^3.0.0",
"npm-keyword": "^5.0.0",
"opn": "^5.3.0",
"open": "^6.3.0",
"package-json": "^5.0.0",
"parse-help": "^1.0.0",
"read-pkg-up": "^4.0.0",
Expand Down Expand Up @@ -108,6 +108,9 @@
"mocha"
]
}
]
],
"rules": {
"promise/prefer-await-to-then": 0
}
}
}
8 changes: 4 additions & 4 deletions test/route-help.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ describe('help route', () => {
this.homeRoute = sinon.spy();
this.router = new Router(sinon.stub(), this.insight);
this.router.registerRoute('home', this.homeRoute);
this.opn = sinon.stub();
this.open = sinon.stub();
const helpRoute = proxyquire('../lib/routes/help', {
opn: this.opn
open: this.open
});
this.router.registerRoute('help', helpRoute);
});
Expand Down Expand Up @@ -42,8 +42,8 @@ describe('help route', () => {
const url = 'http://yeoman.io';
this.sandbox.stub(inquirer, 'prompt').returns(Promise.resolve({whereTo: url}));
return this.router.navigate('help').then(() => {
sinon.assert.calledWith(this.opn, url);
sinon.assert.calledOnce(this.opn);
sinon.assert.calledWith(this.open, url);
sinon.assert.calledOnce(this.open);
});
});
});

0 comments on commit c09422b

Please sign in to comment.