Skip to content

Commit

Permalink
Fix outdated rxjs pipe function (#271)
Browse files Browse the repository at this point in the history
This addresses #270

According to the `rxjs` v5 to v6 migration guidelines, the `catch` operator has now been changed to `catchError`.
https://github.com/ReactiveX/RxJS/blob/HEAD/MIGRATION.md#howto-convert-to-pipe-syntax
  • Loading branch information
jsaguilar authored and sindresorhus committed May 28, 2018
1 parent fba0ddf commit def347b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions index.js
Expand Up @@ -4,8 +4,8 @@ const execa = require('execa');
const del = require('del');
const Listr = require('listr');
const split = require('split');
const {merge} = require('rxjs');
const {filter} = require('rxjs/operators');
const {merge, throwError} = require('rxjs');
const {catchError, filter} = require('rxjs/operators');
const streamToObservable = require('@samverschueren/stream-to-observable');
const readPkgUp = require('read-pkg-up');
const hasYarn = require('has-yarn');
Expand Down Expand Up @@ -69,12 +69,14 @@ module.exports = (input, opts) => {
{
title: 'Installing dependencies using Yarn',
enabled: () => opts.yarn === true,
task: () => exec('yarn', ['install', '--frozen-lockfile', '--production=false']).catch(err => {
if (err.stderr.startsWith('error Your lockfile needs to be updated')) {
throw new Error('yarn.lock file is outdated. Run yarn, commit the updated lockfile and try again.');
}
throw err;
})
task: () => exec('yarn', ['install', '--frozen-lockfile', '--production=false']).pipe(
catchError(err => {
if (err.stderr.startsWith('error Your lockfile needs to be updated')) {
throwError(new Error('yarn.lock file is outdated. Run yarn, commit the updated lockfile and try again.'));
}
throwError(err);
})
)
},
{
title: 'Installing dependencies using npm',
Expand Down

0 comments on commit def347b

Please sign in to comment.