File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ const { withDangerousMod } = require ( '@expo/config-plugins' ) ;
2+ const fs = require ( 'fs' ) ;
3+ const path = require ( 'path' ) ;
4+
5+ function modifyPodfile ( podfilePath ) {
6+ let podfile = fs . readFileSync ( podfilePath , 'utf8' ) ;
7+
8+ const preinstallScript = `
9+ pre_install do |installer|
10+ installer.pod_targets.each do |pod|
11+ if pod.name.eql?('react-native-quick-sqlite')
12+ def pod.build_type
13+ Pod::BuildType.static_library
14+ end
15+ end
16+ end
17+ end
18+ ` ;
19+
20+ // Ensure we don't add duplicate scripts
21+ if ( ! podfile . includes ( 'react-native-quick-sqlite' ) ) {
22+ podfile = podfile . replace ( / t a r g e t \s + ' [ ^ ' ] + ' \s + d o / , `$&\n${ preinstallScript } ` ) ;
23+ fs . writeFileSync ( podfilePath , podfile , 'utf8' ) ;
24+ }
25+ }
26+
27+ const withPowerSyncQuickSQLite = ( config ) => {
28+ return withDangerousMod ( config , [
29+ 'ios' ,
30+ ( config ) => {
31+ const podfilePath = path . join ( config . modRequest . platformProjectRoot , 'Podfile' ) ;
32+ modifyPodfile ( podfilePath ) ;
33+ return config ;
34+ } ,
35+ ] ) ;
36+ } ;
37+
38+ module . exports = withPowerSyncQuickSQLite ;
You can’t perform that action at this time.
0 commit comments