Skip to content

Conversation

@grabbou
Copy link
Collaborator

@grabbou grabbou commented Apr 3, 2017

Issue #87

As of now, the only valid approach for integrating Haul with existing React Native applications is to define a script phase that runs every time we build our project and overwrites packager.sh (used to automatically start packager on run) and react-native-xcode.sh (used to bundle your app).

Problem with setting env variable CLI_PATH is that some scripts are defined in React.xcodeproj. That means scripts defined there will not receive env variables set by parent project.

Thanks to regular expressions, this is rather easy.

@grabbou grabbou changed the title Add iOS build phase [WIP] Add iOS build phase Apr 3, 2017
@grabbou grabbou changed the title [WIP] Add iOS build phase Add iOS build phase Apr 3, 2017
{
type: 'input',
name: 'entry',
message: 'Enter the name of the .xcodeproj file',
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the path and not name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, it's path

let project = fs.readFileSync(path.join(entry, 'project.pbxproj')).toString();

// Are we already integrated?
if (project.includes('AD0CE2C91E925489006FC317')) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's store this in a constant

entry = path.resolve(cwd, result.entry);
}

const progress = ora('Adding haul to your native build pipeline');
Copy link
Member

Choose a reason for hiding this comment

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

Adding haul to your XCode build scripts

Though I feel like we should ask before this change. Looks rather invasive and I might just want to try before integrating.


// Are we already integrated?
if (project.includes('AD0CE2C91E925489006FC317')) {
progress.info('Haul is already part of your build pipeline');
Copy link
Member

Choose a reason for hiding this comment

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

nit: Mention XCode

Copy link
Member

Choose a reason for hiding this comment

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

build pipeline sounds very serious, maybe build scripts is better

progress.succeed('Added haul to your native build pipeline');
} else {
progress.fail(
'Failed to add Haul to your build pipeline. See docs for manual instructions.',
Copy link
Member

Choose a reason for hiding this comment

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

nit: Mention XCode

Link to docs?


if (sectionsCount > 0) {
fs.writeFileSync(path.join(entry, 'project.pbxproj'), project);
progress.succeed('Added haul to your native build pipeline');
Copy link
Member

Choose a reason for hiding this comment

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

nit: Mention XCode

@satya164 satya164 merged commit 3627c1b into master Apr 3, 2017
@satya164 satya164 deleted the feat/init branch April 3, 2017 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants