| 43 | var configPath = path.join(__dirname, "src/components/SubfFlowCanva/nodeConfig.js"); |
| 44 | // Read the existing config file |
| 45 | var readConfig = function () { |
| 46 | var data = fs.readFileSync(configPath, "utf-8"); |
| 47 | var configMatch = data.match(/const nodeConfigInit = (.*);/s); |
| 48 | if (!configMatch) |
| 49 | throw new Error("Config not found in file"); |
| 50 | var config = JSON.parse(configMatch[1]); |
| 51 | return config; |
| 52 | }; |
| 53 | // Write the updated config file |
| 54 | var writeConfig = function (config) { |
| 55 | var data = "// nodeConfig.js\n\nconst nodeConfigInit = ".concat(JSON.stringify(config, null, 2), ";\n\nexport default nodeConfigInit;\n"); |