-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.plugin.js
36 lines (31 loc) · 1.06 KB
/
app.plugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const {withDangerousMod} = require('@expo/config-plugins');
const path = require('path');
const fs = require('fs');
const {
mergeContents,
} = require('@expo/config-plugins/build/utils/generateCode');
const withIOS = config => {
return withDangerousMod(config, [
'ios',
async config => {
const filePath = path.join(
config.modRequest.platformProjectRoot,
'Podfile',
);
const contents = fs.readFileSync(filePath, 'utf-8');
const moyasarPodfileDep = mergeContents({
tag: 'add Moyasar SDK to Podfile',
src: contents,
newSrc: [
`pod 'MoyasarSdk', git: 'https://github.com/moyasar/moyasar-ios-pod.git', :tag => 'v3.0.0'`,
].join('\n'),
anchor: 'use_expo_modules!',
offset: 1,
comment: '#',
});
fs.writeFileSync(filePath, moyasarPodfileDep.contents);
return config;
},
]);
};
module.exports = withIOS;