Skip to content

Commit

Permalink
Upgrade rxjs and listr
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 26, 2018
1 parent 334a18d commit d63af9a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
11 changes: 6 additions & 5 deletions index.js
@@ -1,11 +1,12 @@
'use strict';
require('any-observable/register/rxjs-all'); // eslint-disable-line import/no-unassigned-import
const execa = require('execa');
const del = require('del');
const Listr = require('listr');
const split = require('split');
require('any-observable/register/rxjs-all'); // eslint-disable-line import/no-unassigned-import
const Observable = require('any-observable');
const streamToObservable = require('stream-to-observable');
const {merge} = require('rxjs');
const {filter} = require('rxjs/operators');
const streamToObservable = require('@samverschueren/stream-to-observable');
const readPkgUp = require('read-pkg-up');
const hasYarn = require('has-yarn');
const prerequisiteTasks = require('./lib/prerequisite');
Expand All @@ -17,10 +18,10 @@ const exec = (cmd, args) => {
// Use `Observable` support if merged https://github.com/sindresorhus/execa/pull/26
const cp = execa(cmd, args);

return Observable.merge(
return merge(
streamToObservable(cp.stdout.pipe(split()), {await: cp}),
streamToObservable(cp.stderr.pipe(split()), {await: cp})
).filter(Boolean);
).pipe(filter(Boolean));
};

module.exports = (input, opts) => {
Expand Down
15 changes: 10 additions & 5 deletions lib/publish.js
@@ -1,7 +1,8 @@
'use strict';
const execa = require('execa');
const listrInput = require('listr-input');
const Observable = require('any-observable');
const {throwError, from} = require('rxjs');
const {catchError} = require('rxjs/operators');
const chalk = require('chalk');

const npmPublish = options => {
Expand Down Expand Up @@ -32,13 +33,17 @@ const handleError = (task, err, options, message) => {
task.title = title;
return npmPublish(Object.assign({otp}, options));
}
}).catch(err => handleError(task, err, options, 'OTP was incorrect, try again:'));
}).pipe(
catchError(err => handleError(task, err, options, 'OTP was incorrect, try again:'))
);
}

return Observable.throw(err);
return throwError(err);
};

const publish = (task, options) => Observable.fromPromise(npmPublish(options))
.catch(err => handleError(task, err, options));
const publish = (task, options) =>
from(npmPublish(options)).pipe(
catchError(err => handleError(task, err, options))
);

module.exports = publish;
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -28,6 +28,7 @@
"commit"
],
"dependencies": {
"@samverschueren/stream-to-observable": "^0.3.0",
"any-observable": "^0.3.0",
"chalk": "^2.3.0",
"del": "^3.0.0",
Expand All @@ -36,16 +37,15 @@
"has-yarn": "^1.0.0",
"inquirer": "^3.0.6",
"issue-regex": "^1.0.0",
"listr": "^0.12.0",
"listr": "^0.14.1",
"listr-input": "^0.1.1",
"log-symbols": "^2.1.0",
"meow": "^5.0.0",
"p-timeout": "^2.0.1",
"read-pkg-up": "^3.0.0",
"rxjs": "5.4.3",
"rxjs": "^6.2.0",
"semver": "^5.2.0",
"split": "^1.0.0",
"stream-to-observable": "^0.2.0",
"terminal-link": "^1.1.0",
"update-notifier": "^2.1.0"
},
Expand Down

0 comments on commit d63af9a

Please sign in to comment.