MCPcopy Create free account
hub / github.com/decaporg/decap-cms / switchVersion

Function switchVersion

cypress/utils/config.js:27–40  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

25}
26
27async 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
42module.exports = { copyBackendFiles, updateConfig, switchVersion };

Callers 1

switchToVersionFunction · 0.85

Calls 3

replaceMethod · 0.80
readFileMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected