( directory: string, settings: string, overwriteSettings: boolean )
| 108 | } |
| 109 | |
| 110 | async function write( |
| 111 | directory: string, |
| 112 | settings: string, |
| 113 | overwriteSettings: boolean |
| 114 | ) { |
| 115 | const location = path.join(directory, constants.MVN_SETTINGS_FILE); |
| 116 | const settingsExists = fs.existsSync(location); |
| 117 | if (settingsExists && overwriteSettings) { |
| 118 | core.info(`Overwriting existing file ${location}`); |
| 119 | } else if (!settingsExists) { |
| 120 | core.info(`Writing to ${location}`); |
| 121 | } else { |
| 122 | core.info( |
| 123 | `Skipping generation ${location} because file already exists and overwriting is not required` |
| 124 | ); |
| 125 | return; |
| 126 | } |
| 127 | |
| 128 | return fs.writeFileSync(location, settings, { |
| 129 | encoding: 'utf-8', |
| 130 | flag: 'w' |
| 131 | }); |
| 132 | } |
no outgoing calls
no test coverage detected