Skip to content

Commit

Permalink
feat: improve progress indicator for iOS builds without xcpretty (#1254)
Browse files Browse the repository at this point in the history
* refactor: build indicator for ios

* refactor: change after CR

* Update packages/platform-ios/src/commands/runIOS/index.ts

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
  • Loading branch information
Swor71 and thymikee committed Aug 21, 2020
1 parent c736b21 commit fbfb055
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/platform-ios/src/commands/runIOS/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
getDefaultUserTerminal,
} from '@react-native-community/cli-tools';
import {Device} from '../../types';
import ora from 'ora';

type FlagsT = {
simulator?: string;
Expand Down Expand Up @@ -296,6 +297,7 @@ function buildProject(
'-destination',
`id=${udid}`,
];
const loader = ora();
logger.info(
`Building ${chalk.dim(
`(using "xcodebuild ${xcodebuildArgs.join(' ')}")`,
Expand Down Expand Up @@ -325,7 +327,9 @@ function buildProject(
if (logger.isVerbose()) {
logger.debug(stringData);
} else {
process.stdout.write('.');
loader.start(
`Building the app${'.'.repeat(buildOutput.length % 10)}`,
);
}
}
});
Expand All @@ -336,7 +340,7 @@ function buildProject(
if (xcpretty) {
xcpretty.stdin.end();
} else {
process.stdout.write('\n');
loader.stop();
}
if (code !== 0) {
reject(
Expand All @@ -353,6 +357,7 @@ function buildProject(
);
return;
}
logger.success('Successfully built the app');
resolve(getProductName(buildOutput) || scheme);
});
});
Expand Down

0 comments on commit fbfb055

Please sign in to comment.