@@ -99,65 +99,65 @@ function copyAssets() {
9999 const prefixedFileName = `react-native-d3-chart-${ file } ` ;
100100 const targetPath = path . join ( iosDir , prefixedFileName ) ;
101101
102- // Only copy files (not directories or .DS_Store)
103- if (
104- fs . lstatSync ( sourcePath ) . isFile ( ) &&
105- ! file . startsWith ( '.DS_Store' )
106- ) {
107- if ( file === 'chart.html' ) {
108- // For HTML file, update script references to use prefixed names
109- let htmlContent = fs . readFileSync ( sourcePath , 'utf8' ) ;
110- htmlContent = htmlContent
111- . replace (
112- 'src="d3.v7.min.js"' ,
113- 'src="react-native-d3-chart-d3.v7.min.js"'
114- )
115- . replace (
116- 'src="d3-time-format.js"' ,
117- 'src="react-native-d3-chart-d3-time-format.js"'
118- ) ;
119-
120- fs . writeFileSync ( targetPath , htmlContent ) ;
121- console . log (
122- `react-native-d3-chart: Created iOS-specific ${ prefixedFileName } with updated script references`
102+ // Only copy files (not directories or .DS_Store)
103+ if (
104+ fs . lstatSync ( sourcePath ) . isFile ( ) &&
105+ ! file . startsWith ( '.DS_Store' )
106+ ) {
107+ if ( file === 'chart.html' ) {
108+ // For HTML file, update script references to use prefixed names
109+ let htmlContent = fs . readFileSync ( sourcePath , 'utf8' ) ;
110+ htmlContent = htmlContent
111+ . replace (
112+ 'src="d3.v7.min.js"' ,
113+ 'src="react-native-d3-chart-d3.v7.min.js"'
114+ )
115+ . replace (
116+ 'src="d3-time-format.js"' ,
117+ 'src="react-native-d3-chart-d3-time-format.js"'
123118 ) ;
124- } else {
125- // For other files, just copy
126- fs . copyFileSync ( sourcePath , targetPath ) ;
127- console . log (
128- `react-native-d3-chart: Copied ${ file } to iOS bundle as ${ prefixedFileName } `
129- ) ;
130- }
119+
120+ fs . writeFileSync ( targetPath , htmlContent ) ;
121+ console . log (
122+ `react-native-d3-chart: Created iOS-specific ${ prefixedFileName } with updated script references`
123+ ) ;
124+ } else {
125+ // For other files, just copy
126+ fs . copyFileSync ( sourcePath , targetPath ) ;
127+ console . log (
128+ `react-native-d3-chart: Copied ${ file } to iOS bundle as ${ prefixedFileName } `
129+ ) ;
131130 }
132- } ) ;
133-
134- // Add assets to Xcode project
135- try {
136- const {
137- addAssetsToXcodeProject,
138- } = require ( './add-ios-assets.js' ) ;
139- const xcodeProjectPath = path . join ( iosDir , xcodeProj ) ;
140- const assetFiles = files
141- . filter (
142- ( file ) =>
143- ! file . startsWith ( '.DS_Store' ) &&
144- fs . lstatSync ( path . join ( iosAssetsSource , file ) ) . isFile ( )
145- )
146- . map ( ( file ) => `react-native-d3-chart-${ file } ` ) ;
147-
148- addAssetsToXcodeProject ( xcodeProjectPath , assetFiles ) ;
149- } catch ( error ) {
150- console . warn (
151- 'react-native-d3-chart: Failed to update Xcode project:' ,
152- error . message
153- ) ;
154131 }
132+ } ) ;
133+
134+ // Add assets to Xcode project
135+ try {
136+ const {
137+ addAssetsToXcodeProject,
138+ } = require ( './add-ios-assets.js' ) ;
139+ const xcodeProjectPath = path . join ( iosDir , xcodeProj ) ;
140+ const assetFiles = files
141+ . filter (
142+ ( file ) =>
143+ ! file . startsWith ( '.DS_Store' ) &&
144+ fs . lstatSync ( path . join ( iosAssetsSource , file ) ) . isFile ( )
145+ )
146+ . map ( ( file ) => `react-native-d3-chart-${ file } ` ) ;
147+
148+ addAssetsToXcodeProject ( xcodeProjectPath , assetFiles ) ;
155149 } catch ( error ) {
156150 console . warn (
157- 'react-native-d3-chart: Failed to copy iOS assets :' ,
151+ 'react-native-d3-chart: Failed to update Xcode project :' ,
158152 error . message
159153 ) ;
160154 }
155+ } catch ( error ) {
156+ console . warn (
157+ 'react-native-d3-chart: Failed to copy iOS assets:' ,
158+ error . message
159+ ) ;
160+ }
161161 } else {
162162 console . log (
163163 'react-native-d3-chart: No Xcode project found, skipping iOS assets'
0 commit comments