From 8f8db7020c8f21512e4541c0f1070ee901e63400 Mon Sep 17 00:00:00 2001 From: "S.TAKENO" Date: Sat, 28 May 2022 18:50:25 +0900 Subject: [PATCH] Update usage in README.md due to eseca update As seen by https://github.com/sindresorhus/execa, `execa` has been changed . This PR fixes example codes --- readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 8937a3f..b053604 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ $ npm install --save listr ## Usage ```js -import execa from 'execa'; +import { execa } from 'execa'; import Listr from 'listr'; const tasks = new Listr([ @@ -27,16 +27,16 @@ const tasks = new Listr([ return new Listr([ { title: 'Checking git status', - task: () => execa.stdout('git', ['status', '--porcelain']).then(result => { - if (result !== '') { + task: () => execa('git', ['status', '--porcelain']).then(({stdout}) => { + if (stdout !== '') { throw new Error('Unclean working tree. Commit or stash changes first.'); } }) }, { title: 'Checking remote history', - task: () => execa.stdout('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']).then(result => { - if (result !== '0') { + task: () => execa('git', ['rev-list', '--count', '--left-only', '@{u}...HEAD']).then(({stdout, exitCode}) => { + if (exitCode !== 0) { throw new Error('Remote history differ. Please pull changes.'); } })