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

feat: expo user agent #49

Merged
merged 30 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"prepare": "bob build",
"example": "yarn --cwd example",
"pods": "cd example && pod-install --quiet",
"bootstrap": "yarn example && yarn && yarn pods"
"bootstrap": "yarn example && yarn && yarn pods",
"postinstall": "node src/postInstall.js"
},
"keywords": [
"react-native",
Expand Down
22 changes: 22 additions & 0 deletions src/postInstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require('fs');
xtreem88 marked this conversation as resolved.
Show resolved Hide resolved

// set package.json file paths
const expoPJsonFile = `${__dirname}/../../customerio-expo-plugin/package.json`;
const rnPJsonFile = `${__dirname}/../package.json`;

// try and catch to prevent errors
try {
// check if expo plugin is installed
if (fs.existsSync(expoPJsonFile)) {
// read package.json file for current package
const rnPJson = fs.readFileSync(rnPJsonFile, 'utf8');

// import expo plugin's package.json
const expoPJson = require(expoPJsonFile);

const rnPackage = JSON.parse(rnPJson);
rnPackage.expoVersion = expoPJson.version;

fs.writeFileSync(rnPJsonFile, JSON.stringify(rnPackage, null, 2));
}
} catch (error) {} // do nothing if this operation fails