MCPcopy Index your code
hub / github.com/ampproject/amphtml / writeIfUpdated

Function writeIfUpdated

build-system/common/update-packages.js:18–26  ·  view source on GitHub ↗

* Writes the given contents to the patched file if updated * @param {string} patchedName Name of patched file * @param {string} file Contents to write

(patchedName, file)

Source from the content-addressed store, hash-verified

16 * @param {string} file Contents to write
17 */
18function writeIfUpdated(patchedName, file) {
19 if (
20 !fs.existsSync(patchedName) ||
21 fs.readFileSync(patchedName, 'utf8') != file
22 ) {
23 fs.writeFileSync(patchedName, file);
24 logLocalDev('Patched', cyan(patchedName));
25 }
26}
27
28/**
29 * Patches Web Animations polyfill by wrapping its body into `install` function.

Callers 4

patchWebAnimationsFunction · 0.85
patchResizeObserverFunction · 0.85
patchShadowDomFunction · 0.85

Calls 2

logLocalDevFunction · 0.85
cyanFunction · 0.85

Tested by

no test coverage detected