checkPlugin: Don't capture stdout when unnecessary

This commit is contained in:
Richard Hansen 2021-01-09 00:59:56 -05:00 committed by John McLear
parent 102c01f723
commit 1a9bfc8d4f

View file

@ -71,7 +71,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
} }
try { try {
execSync('git pull'); execSync('git pull', {stdio: 'inherit'});
} catch (e) { } catch (e) {
console.error('Error git pull', e); console.error('Error git pull', e);
} }
@ -214,7 +214,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
parsedPackageJSON.devDependencies = Object.assign(devDependencies, lintDeps); parsedPackageJSON.devDependencies = Object.assign(devDependencies, lintDeps);
fs.writeFileSync(`${pluginPath}/package.json`, JSON.stringify(parsedPackageJSON, null, 2)); fs.writeFileSync(`${pluginPath}/package.json`, JSON.stringify(parsedPackageJSON, null, 2));
try { try {
execSync('npm install'); execSync('npm install', {stdio: 'inherit'});
} catch (err) { } catch (err) {
console.error(`Failed to create package-lock.json: ${err.stack || err}`); console.error(`Failed to create package-lock.json: ${err.stack || err}`);
} }
@ -231,7 +231,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
parsedPackageJSON.peerDependencies = peerDependencies; parsedPackageJSON.peerDependencies = peerDependencies;
fs.writeFileSync(`${pluginPath}/package.json`, JSON.stringify(parsedPackageJSON, null, 2)); fs.writeFileSync(`${pluginPath}/package.json`, JSON.stringify(parsedPackageJSON, null, 2));
try { try {
execSync('npm install --no-save ep_etherpad-lite@file:../../src'); execSync('npm install --no-save ep_etherpad-lite@file:../../src', {stdio: 'inherit'});
hasAutoFixed = true; hasAutoFixed = true;
} catch (e) { } catch (e) {
console.error('Failed to create package-lock.json'); console.error('Failed to create package-lock.json');
@ -283,7 +283,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
console.warn('Run npm install in the plugin folder and commit the package-lock.json file.'); console.warn('Run npm install in the plugin folder and commit the package-lock.json file.');
if (autoFix) { if (autoFix) {
try { try {
execSync('npm install'); execSync('npm install', {stdio: 'inherit'});
console.log('Making package-lock.json'); console.log('Making package-lock.json');
hasAutoFixed = true; hasAutoFixed = true;
} catch (e) { } catch (e) {
@ -435,7 +435,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
try { try {
console.log('Linting...'); console.log('Linting...');
const lintCmd = autoFix ? 'npx eslint --fix .' : 'npx eslint'; const lintCmd = autoFix ? 'npx eslint --fix .' : 'npx eslint';
execSync(lintCmd); execSync(lintCmd, {stdio: 'inherit'});
if (autoFix) { if (autoFix) {
// todo: if npm run lint doesn't do anything no need for... // todo: if npm run lint doesn't do anything no need for...
hasAutoFixed = true; hasAutoFixed = true;
@ -457,7 +457,7 @@ fs.readdir(pluginPath, (err, rootFiles) => {
if (autoCommit) { if (autoCommit) {
// holy shit you brave. // holy shit you brave.
console.log('Attempting autocommit and auto publish to npm'); console.log('Attempting autocommit and auto publish to npm');
execSync(cmd); execSync(cmd, {stdio: 'inherit'});
} else { } else {
console.log('Fixes applied, please check git diff then run the following command:'); console.log('Fixes applied, please check git diff then run the following command:');
console.log(`(cd node_modules/${pluginName} && ${cmd})`); console.log(`(cd node_modules/${pluginName} && ${cmd})`);