MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / replaceFile

Function replaceFile

tests/helpers/file-utils.js:12–23  ·  view source on GitHub ↗
(path, findString, replaceString)

Source from the content-addressed store, hash-verified

10}
11
12function replaceFile(path, findString, replaceString) {
13 if (fs.existsSync(path)) {
14 let newFile;
15 let file = fs.readFileSync(path, 'utf-8');
16 let find = new RegExp(findString);
17 let match = new RegExp(replaceString);
18 if (!match.test(file)) {
19 newFile = file.replace(find, replaceString);
20 fs.writeFileSync(path, newFile, 'utf-8');
21 }
22 }
23}
24
25module.exports = {
26 touch,

Callers 4

generateWithPrefixFunction · 0.85
generate-test.jsFile · 0.85
destroyAfterGenerateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…