(version)
| 25 | } |
| 26 | |
| 27 | async function switchVersion(version) { |
| 28 | const htmlFile = path.join(devTestDirectory, 'index.html'); |
| 29 | const content = await fs.readFile(htmlFile); |
| 30 | |
| 31 | const replaceString = |
| 32 | version === 'latest' |
| 33 | ? '<script src="dist/decap-cms.js"></script>' |
| 34 | : `<script src="https://unpkg.com/decap-cms@${version}/dist/decap-cms.js"></script>`; |
| 35 | |
| 36 | await fs.writeFile( |
| 37 | htmlFile, |
| 38 | content.toString().replace(/<script src=".+?decap-cms.+?"><\/script>/, replaceString), |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | module.exports = { copyBackendFiles, updateConfig, switchVersion }; |
no test coverage detected