MCPcopy
hub / github.com/zxlie/FeHelper / firefoxPreprocess

Function firefoxPreprocess

gulpfile.js:386–407  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

384
385// Firefox前置处理
386function firefoxPreprocess(cb) {
387 const destDir = 'output-firefox/apps';
388 buildManifest('firefox', destDir);
389
390 ['background/background.js', 'options/index.js'].forEach(file => {
391 const filePath = path.join(destDir, file);
392 if (!fs.existsSync(filePath)) return;
393 const source = fs.readFileSync(filePath, 'utf-8');
394 const patched = source.replace(/chrome\.runtime\.requestUpdateCheck/g, `chrome.runtime[${FIREFOX_REQUEST_UPDATE_CHECK_KEY}]`);
395 if (patched !== source) {
396 fs.writeFileSync(filePath, patched);
397 }
398 });
399
400 FIREFOX_REMOVE_TOOLS.forEach(tool => {
401 const toolDir = path.join(destDir, tool);
402 if (fs.existsSync(toolDir)) {
403 shell.exec(`rm -rf ${toolDir}`);
404 }
405 });
406 cb();
407}
408
409
410// chrome前置处理

Callers

nothing calls this directly

Calls 2

buildManifestFunction · 0.85
cbFunction · 0.85

Tested by

no test coverage detected