MCPcopy Create free account
hub / github.com/ampproject/amphtml / removeConfig

Function removeConfig

build-system/tasks/prepend-global/index.js:275–287  ·  view source on GitHub ↗

* @param {string} target Target file from which to remove the AMP config * @return {!Promise }

(target)

Source from the content-addressed store, hash-verified

273 * @return {!Promise<void>}
274 */
275async function removeConfig(target) {
276 const file = await fs.promises.readFile(target);
277 let contents = file.toString();
278 if (numConfigs(contents) == 0) {
279 return;
280 }
281 sanityCheck(contents);
282 const config =
283 /self\.AMP_CONFIG\|\|\(self\.AMP_CONFIG=(.|\n)*?\/\*AMP_CONFIG\*\//;
284 contents = contents.replace(config, '');
285 await writeTarget_(target, contents, argv.dryrun);
286 log('Removed existing config from', cyan(target));
287}
288
289/**
290 * @return {Promise<void>}

Callers

nothing calls this directly

Calls 7

numConfigsFunction · 0.85
sanityCheckFunction · 0.85
writeTarget_Function · 0.85
cyanFunction · 0.85
logFunction · 0.50
toStringMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected