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

Setup local testing for PurchaseTester Typescript #326

Merged

Conversation

joshdholtz
Copy link
Member

@joshdholtz joshdholtz commented Jan 6, 2022

Follow up to #320

Motivation

Use local repo for react-native-purchases instead of pointing to published version to use for local development

Description

  • New react-native.config.js to define local decency for auto linking
  • Updated metro.config.js to:
    • Look at the root package.json with nodeModulesPath and watchFolders
    • Set resolverMainFields to look at source so react-native-purchases doesn't use the compiled dist
  • Updated .circleci/config.yml
    • Need to run yarn install (or npm install) in the root directory because this as local dependency needs its own node_modules

@joshdholtz joshdholtz force-pushed the purchase-tester-typescript-local-testing branch from d12cdf4 to fef8eb9 Compare January 6, 2022 22:37
@joshdholtz joshdholtz marked this pull request as ready for review January 6, 2022 23:31
@joshdholtz joshdholtz requested a review from a team January 6, 2022 23:31
@joshdholtz joshdholtz changed the title [WIP] Setup local testing for PurchaseTester Typescript Setup local testing for PurchaseTester Typescript Jan 6, 2022
resolver: {
// Tells metro to look at for `react-native-purchases`
// This fixes issues with referencing file in package.json which
// creates a symlink and metro can't handle symlinks
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 on the comment!

resolverMainFields: ['source', 'react-native', 'main'], // will first look the source then main
},

// Metro will automatically update when something is changed in this path
Copy link
Contributor

Choose a reason for hiding this comment

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

😻

},
};
// IMPORTANT
// Make sure `npm install` is run in this refernced package's directory
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Make sure `npm install` is run in this refernced package's directory
// Make sure `npm install` is run in this referenced package's directory

:)

Copy link
Member Author

Choose a reason for hiding this comment

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

Typos are going to be my legacy at RevenueCat but I'll fix it this one time 🙃

@joshdholtz joshdholtz requested a review from beylmk January 7, 2022 17:39
@@ -408,7 +408,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNPurchases (from `../../../`)
- RNPurchases (from `../../..`)
Copy link
Contributor

Choose a reason for hiding this comment

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

how does this get set now that it's not in the podfile? is that what metro is doing 😅 sorry if this is a dumb question

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah! Not dumb question at all. This is auto linked with the introduction of the new react-native.config.js file. So whenever pod install is run, RN looks inside of react-native.config.js and will see this path and install it with cocoa pods

@joshdholtz joshdholtz merged commit 8843578 into purchase-tester-typescript Jan 11, 2022
@joshdholtz joshdholtz deleted the purchase-tester-typescript-local-testing branch January 11, 2022 13:50
joshdholtz added a commit that referenced this pull request Jan 13, 2022
* Initial commit of purchaseTester typescript example

* Made things a little prettier for offering detail

* Removed console log

* Typescript example using local RNPurchases pod

* Fix some things were states weren't updating

* Trying to fix CircleCI

* This is it

* name isn't a thing for the RN builds

* name also isn't a thing for iOS RN builds

* Add set attributes which isnt really working yet

* Fix broken test

* Fix broken test... again

* Ignore package-lock.json, try using rn/yarn_install on circleci, move RC init to app.tsx

* Trying to get yarn_install to run in the example directory

* Change yarn cache folder

* Try bringing in the yarn install from the orb for testing

* Try yarn cwd before calling rn/yarn_install

* That didn't work

* This should fix android

* This should fix macos symlink issue

* Reset cache to see if fix worked

* Lets start over on circleci

* Add path for yarn pod

* Experimenting

* This should do it

* --cwd doesnt work with yarn pods

* Need to warn install both examples

* Try with rn/yarn_install but copied over with path param

* Forgot to replace cache path

* Cleanup because things works :)

* Need to put path to ios directory

* Use conditional logic and use --cwd if not empty string

* Rename to use standard revenuecat tester package and bundle id

* Bump to react-native-community/[email protected]

* Rename isSetup to hasKeys

* Setup local testing for PurchaseTester Typescript (#326)

* This works so much better for local testing

* Updated comments to be more helpful

* Fixed typo

* Need to await the initial fetchData

* Rename storekit config file and add second target that does not use sk config file

Co-authored-by: Josh Holtz <[email protected]>
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.

2 participants