From efd87268daab8f99adfd6af70b37b8148b2cbe69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Mon, 29 May 2017 23:04:51 +0100 Subject: [PATCH] chore: use `stdio` option on execa --- scripts/format | 13 +++++-------- scripts/license-to-fail | 16 ++++++---------- scripts/quality-docs | 13 +++++-------- scripts/run-staged-pkg | 14 +++++--------- 4 files changed, 21 insertions(+), 35 deletions(-) diff --git a/scripts/format b/scripts/format index f2edb54a..88f371a9 100755 --- a/scripts/format +++ b/scripts/format @@ -11,7 +11,6 @@ const globby = require('globby'); const main = require('apr-main'); const argv = require('yargs').argv; const path = require('path'); -const fs = require('fs'); const getStaged = awaitify(sgf); @@ -37,15 +36,13 @@ const run = async (files = []) => { return; } - const cp = execa( + return execa( 'prettier', - ['--write', '--single-quote'].concat(filter(files)) + ['--write', '--single-quote'].concat(filteredFiles), + { + stdio: 'inherit' + } ); - - cp.stdout.pipe(process.stdout); - cp.stderr.pipe(process.stderr); - - return cp; }; const all = async () => { diff --git a/scripts/license-to-fail b/scripts/license-to-fail index 59728d44..9499ab17 100755 --- a/scripts/license-to-fail +++ b/scripts/license-to-fail @@ -12,16 +12,12 @@ const CWD = path.join(__dirname, '..'); const BIN = path.join(CWD, 'node_modules/.bin/license-to-fail'); const run = async (dirs = []) => - forEach(dirs, async dir => { - const cp = execa(BIN, [config], { - cwd: dir - }); - - cp.stdout.pipe(process.stdout); - cp.stderr.pipe(process.stderr); - - return cp; - }); + forEach(dirs, async dir => + execa(BIN, [config], { + cwd: dir, + stdio: 'inherit' + }) + ); const all = async () => { const files = await globby(['packages/*/', '.'], { diff --git a/scripts/quality-docs b/scripts/quality-docs index 7a9c335c..5433d9e3 100755 --- a/scripts/quality-docs +++ b/scripts/quality-docs @@ -8,14 +8,11 @@ const argv = require('yargs').argv; const path = require('path'); const run = async (files = []) => - forEach(files, async file => { - const cp = execa('quality-docs', [file]); - - cp.stdout.pipe(process.stdout); - cp.stderr.pipe(process.stderr); - - return cp; - }); + forEach(files, async file => + execa('quality-docs', [file], { + stdio: 'inherit' + }) + ); const all = async () => { const files = await globby(['packages/**/*.md', './*.md'], { diff --git a/scripts/run-staged-pkg b/scripts/run-staged-pkg index 132373c0..e6191094 100755 --- a/scripts/run-staged-pkg +++ b/scripts/run-staged-pkg @@ -24,14 +24,10 @@ const statuses = [ 'Unmerged' ]; -const exec = (args = []) => { - const cp = execa('lerna', args); - - cp.stdout.pipe(process.stdout); - cp.stderr.pipe(process.stderr); - - return cp; -}; +const exec = (args = []) => + execa('lerna', args, { + stdio: 'inherit' + }); const lint = scope => exec(['run', 'lint', '--scope', scope]); const test = scope => exec(['run', 'test', '--scope', scope]); @@ -65,7 +61,7 @@ const gather = async () => { JSON.parse(await readFile(path.join(folder, 'package.json'), 'utf-8')) ); - return await map(pkgs.map(({ name }) => name), run); + return map(pkgs.map(({ name }) => name), run); }; main(gather());