|
1 | 1 | const path = require("path")
|
2 | 2 | const fs = require("fs")
|
3 | 3 | const fsExtra = require('fs-extra')
|
4 |
| -const replaceInFileSync = (file,from,to) => { |
| 4 | + |
| 5 | +const replaceInFileSync = (file, from, to) => { |
5 | 6 | const data = fs.readFileSync(file, 'utf8');
|
6 |
| - const newData = data.replace(from, to) |
7 |
| - fs.writeFileSync(file, newData, {encoding:"utf8"}) |
| 7 | + const newData = data.replace(new RegExp(from, 'g'), to); |
| 8 | + fs.writeFileSync(file, newData, { encoding: "utf8" }); |
8 | 9 | }
|
9 | 10 |
|
10 | 11 |
|
@@ -55,6 +56,11 @@ files.forEach((fileName)=>{
|
55 | 56 | replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
|
56 | 57 | replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../index.ts","./src/index.ts" )
|
57 | 58 | replaceInFileSync(path.join(__dirname, "lib/flagsmith/index.js.map"),"../../../utils","./src/utils" )
|
| 59 | +replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/index.js.map"),"../../../utils","./src/utils" ) |
| 60 | +replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/index.js.map"),"../../../utils","./src/utils" ) |
| 61 | +replaceInFileSync(path.join(__dirname, "lib/flagsmith/react.js.map"),"../../../utils","./src/utils" ) |
| 62 | +replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/react.js.map"),"../../../utils","./src/utils" ) |
| 63 | +replaceInFileSync(path.join(__dirname, "lib/react-native-flagsmith/react.js.map"),"../../../utils","./src/utils" ) |
58 | 64 |
|
59 | 65 | // fix paths in flagsmith-es/index.js sourcemaps
|
60 | 66 | replaceInFileSync(path.join(__dirname, "lib/flagsmith-es/index.js.map"),"../../../flagsmith-core.ts","./src/flagsmith-core.ts" )
|
@@ -140,7 +146,7 @@ function syncFolders(src, dest) {
|
140 | 146 | }
|
141 | 147 | }
|
142 | 148 |
|
143 |
| - console.log('Folders synchronized successfully!'); |
| 149 | + console.log('Folders synchronized successfully!', src, dest); |
144 | 150 | } catch (err) {
|
145 | 151 | console.error('Error synchronizing folders:', err);
|
146 | 152 | }
|
|
0 commit comments