Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve overall run-ios experience and get rid of CFBundleIdentifier #139

Merged
merged 5 commits into from
Feb 1, 2019

Conversation

grabbou
Copy link
Member

@grabbou grabbou commented Jan 31, 2019

Fixes #107

Summary:

Bugs fixed:

  • "CFBundleIdentifier" printed every time "run-ios" fails, shadowing the real cause for the problem
  • "run-ios" running a previous/cached version of an app (usually when there was an error during build step that was ignored)

Changes made:

  • Decided to turn Flow and ESLint and apply all the changes as I am working on it. I know the diff might be strange at first sight, but if you look closely, it's just cosmetics to satisfy various rules
  • I also extracted some blocks to separate utilities for better readability
  • I also removed a no longer needed check for CRNA which is deprecated (and IMO, is not needed)
  • Converted few functions to "async" form for better readability
  • Started capturing the "stderr" of "xcodebuild" and started relying on its error code in order to avoid going to next step when it fails
  • Added a new type of error to differentiate from other errors and also be able to capture additional data. Logic and styling subject to change, encapsulated inside Logger.

Test Plan:

Here's how the error messages look before/now:

While try to build a project with a wrong "schema" :

Before:
screenshot 2019-01-31 at 18 07 43

After:
screenshot 2019-01-31 at 18 05 23

While building a project that has a typo in "AppDelegate.m":

Before:
screenshot 2019-01-31 at 18 08 19

After:
screenshot 2019-01-31 at 18 06 36

You can try it out by running run-ios command on a broken project (typo, wrong configuration) or by passing a non-existing schema

Copy link
Contributor

@eliperkins eliperkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I left a comment about error phrasing, but this looks great otherwise!

packages/cli/src/runIOS/runIOS.js Outdated Show resolved Hide resolved
@grabbou grabbou added this to the Better UX milestone Jan 31, 2019
@estevaolucas
Copy link

Nice work! 👏

Started capturing the "stderr" of "xcodebuild" and started relying on its error code in order to avoid going to next step when it fails

Cool, so this will prevent us to have a "main.jsbundle does not exist." error, right? 🙌(I've suffered with it this week - https://stackoverflow.com/a/54464135/1394414)

const debug = (...messages: Array<string>) => {
console.log(`${chalk.black.bgWhite(' DEBUG ')} ${joinMessages(messages)}`);
};

class ProcessError extends Error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't belong to logger. Can you move it to some kind of errorHelpers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good idea. I'd suggest "errors" for now.

packages/cli/src/util/logger.js Outdated Show resolved Hide resolved
packages/cli/src/runIOS/runIOS.js Show resolved Hide resolved
packages/cli/src/runIOS/runIOS.js Show resolved Hide resolved
errorOutput
)
);
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this return necessary after we rejected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not - just my personal preference of early returns over /else clause (visual appearance).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll update it to if/else here 👌

@grabbou
Copy link
Member Author

grabbou commented Feb 1, 2019

Check @thymikee if you are happy with the last commit and if yes, let's merge it 🔥


class ProcessError extends Error {
constructor(msg: string, processError: string) {
super(`${chalk.red(msg)}\n\n${chalk.gray(processError)}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks silly, but I'm cool with that :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it's a "temporary" solution when we figure out proper logging. I think it's a good starting point.

@orlowang
Copy link

I follow the issue " ":CFBundleIdentifier", Does Not Exist"to here, and this issue is still exist🙁

@thymikee
Copy link
Member

Please note this is only available since RN 0.59 which is still in RC period. Your project uses 0.57.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of "CFBundleIdentifier" error
6 participants