Skip to content

Commit

Permalink
use spawn,sync and limit the return parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jan 8, 2020
1 parent 7ba88f6 commit c5fcecf
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/cli/lib/npm_init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ import hasYarn from './has_yarn';
const packageManager = hasYarn() ? 'yarn' : 'npm';

export default function npmInit() {
return new Promise((resolve, reject) => {
const command = spawn(packageManager, ['init', '-y'], {
const { status, signal, output, pid, stdout, stderr, error, ...rest } = spawn.sync(
packageManager,
['init', '-y'],
{
cwd: process.cwd(),
env: process.env,
stdio: 'pipe',
encoding: 'utf-8',
silent: true,
});

command.stdout.on('data', resolve);

command.stderr.on('data', reject);
});
}
);
return rest;
}

0 comments on commit c5fcecf

Please sign in to comment.