chore: use stdio option on execa

This commit is contained in:
Sérgio Ramos 2017-05-29 23:04:51 +01:00
parent 0dbd8a6b84
commit efd87268da
4 changed files with 21 additions and 35 deletions

View File

@ -11,7 +11,6 @@ const globby = require('globby');
const main = require('apr-main'); const main = require('apr-main');
const argv = require('yargs').argv; const argv = require('yargs').argv;
const path = require('path'); const path = require('path');
const fs = require('fs');
const getStaged = awaitify(sgf); const getStaged = awaitify(sgf);
@ -37,15 +36,13 @@ const run = async (files = []) => {
return; return;
} }
const cp = execa( return execa(
'prettier', '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 () => { const all = async () => {

View File

@ -12,16 +12,12 @@ const CWD = path.join(__dirname, '..');
const BIN = path.join(CWD, 'node_modules/.bin/license-to-fail'); const BIN = path.join(CWD, 'node_modules/.bin/license-to-fail');
const run = async (dirs = []) => const run = async (dirs = []) =>
forEach(dirs, async dir => { forEach(dirs, async dir =>
const cp = execa(BIN, [config], { execa(BIN, [config], {
cwd: dir cwd: dir,
}); stdio: 'inherit'
})
cp.stdout.pipe(process.stdout); );
cp.stderr.pipe(process.stderr);
return cp;
});
const all = async () => { const all = async () => {
const files = await globby(['packages/*/', '.'], { const files = await globby(['packages/*/', '.'], {

View File

@ -8,14 +8,11 @@ const argv = require('yargs').argv;
const path = require('path'); const path = require('path');
const run = async (files = []) => const run = async (files = []) =>
forEach(files, async file => { forEach(files, async file =>
const cp = execa('quality-docs', [file]); execa('quality-docs', [file], {
stdio: 'inherit'
cp.stdout.pipe(process.stdout); })
cp.stderr.pipe(process.stderr); );
return cp;
});
const all = async () => { const all = async () => {
const files = await globby(['packages/**/*.md', './*.md'], { const files = await globby(['packages/**/*.md', './*.md'], {

View File

@ -24,14 +24,10 @@ const statuses = [
'Unmerged' 'Unmerged'
]; ];
const exec = (args = []) => { const exec = (args = []) =>
const cp = execa('lerna', args); execa('lerna', args, {
stdio: 'inherit'
cp.stdout.pipe(process.stdout); });
cp.stderr.pipe(process.stderr);
return cp;
};
const lint = scope => exec(['run', 'lint', '--scope', scope]); const lint = scope => exec(['run', 'lint', '--scope', scope]);
const test = scope => exec(['run', 'test', '--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')) 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()); main(gather());