Skip to content

Commit

Permalink
Removing progress as process.stdout is giving error in some CLIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Prakash-Verma committed Apr 21, 2021
1 parent f420905 commit fb5e913
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
19 changes: 0 additions & 19 deletions builder/strictify/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,3 @@ function setDifference(aSet: Set<string>, bSet: Set<string>) {
});
return list;
}

export function startProgress() {
let timerCount = 0;
const progressText = ['|', '/', '-', '\\'];
const intervalTimer = setInterval(() => {
clearConsoleLine();
if (timerCount === 4) {
timerCount = 0;
}
process.stdout.write(progressText[timerCount]);
++timerCount;
}, 250);
return intervalTimer;
}

export function clearConsoleLine() {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
}
9 changes: 0 additions & 9 deletions builder/strictify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BuilderOutput, createBuilder } from '@angular-devkit/architect';
import { exec } from 'child_process';

import {
clearConsoleLine,
createBuildCommand,
extractOnlyErrors,
getAllErrors,
Expand All @@ -11,11 +10,9 @@ import {
getTsConfigPath,
listAllErrorsInStrictFiles,
Options,
startProgress,
} from './helper';

export default createBuilder<Options>((options, context) => {
const intervalTimer = startProgress();
return new Promise<BuilderOutput>((resolve, reject) => {
const projectName = context.target ? context.target.project : '';
context.getProjectMetadata(projectName).then((projectMetaData) => {
Expand All @@ -24,7 +21,6 @@ export default createBuilder<Options>((options, context) => {

context.reportStatus(`Executing "${command}"...`);
exec(command, (error) => {
clearConsoleLine();
console.log('\n\n________________________________');
if (error) {
const errorMessage = extractOnlyErrors(error.message);
Expand All @@ -33,7 +29,6 @@ export default createBuilder<Options>((options, context) => {
if (listOfFilesWithError.size === 0) {
// Has different errors, need to report same
reject(error);
clearInterval(intervalTimer);
return;
}

Expand All @@ -44,7 +39,6 @@ export default createBuilder<Options>((options, context) => {
);
if (strictFilesWithError.length === 0) {
resolve({ success: true });
clearInterval(intervalTimer);
return;
}

Expand All @@ -56,7 +50,6 @@ export default createBuilder<Options>((options, context) => {
'\n\n'
)
);
clearInterval(intervalTimer);
return;
}

Expand All @@ -69,11 +62,9 @@ export default createBuilder<Options>((options, context) => {
errorsArr
);
reject(new Error('\nFix these issues: ' + errorsInStrictFiles));
clearInterval(intervalTimer);
return;
}
resolve({ success: true });
clearInterval(intervalTimer);
return;
});
});
Expand Down

0 comments on commit fb5e913

Please sign in to comment.