Comparing version 0.9.2 to 0.10.0
@@ -12,5 +12,3 @@ 'use strict'; | ||
const asyncExec = require('util').promisify(require('child_process').exec); | ||
/** | ||
@@ -26,2 +24,32 @@ * Runs the command and captures the stdout | ||
const spawn = require('child_process').spawn; | ||
/** | ||
* Runs the command without opening a new shell. | ||
* It prints stdout and stderr at the same time that captures it in | ||
* order to be passed in the resolved promise. | ||
*/ | ||
async function exe(cmd, quiet) { | ||
const args = cmd.split(/ +/); | ||
const child = spawn(args[0], args.slice(1)); | ||
let out = ''; | ||
const capture = data => { | ||
const s = data.toString('utf-8'); | ||
!quiet && process.stdout.write(s); | ||
out += s; | ||
}; | ||
child.stdout.on('data', capture); | ||
child.stderr.on('data', capture); | ||
return new Promise((resolve, reject) => child.on('exit', async function(code) { | ||
if (code == 0) { | ||
resolve(out); | ||
} else { | ||
reject(`${(quiet ? out : '')}\n!!! ERROR !!! Process '${cmd}' exited with code ${code}`); | ||
} | ||
})); | ||
} | ||
module.exports.exe = exe; | ||
const rl = require('readline').createInterface({ | ||
@@ -39,7 +67,6 @@ input: process.stdin, | ||
const path = require('path'); | ||
const workingPackage = require(path.resolve(process.cwd(), 'package.json')); | ||
module.exports.workingPackage = workingPackage; | ||
module.exports.elementName = workingPackage.name.replace(/^@vaadin\//, ''); | ||
module.exports.elementName = workingPackage.name.replace(/^@.+?\//, ''); | ||
@@ -46,0 +73,0 @@ const cliPackageName = require('../package.json').name; |
{ | ||
"name": "magi-cli", | ||
"version": "0.9.2", | ||
"version": "0.10.0", | ||
"description": "Elements team command-line team member", | ||
@@ -5,0 +5,0 @@ "main": "./bin/magi", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
35978
15
190