(cb)
| 384 | |
| 385 | // Firefox前置处理 |
| 386 | function 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前置处理 |
nothing calls this directly
no test coverage detected