({platforms, debug, version})
| 50 | } |
| 51 | |
| 52 | async function zip({platforms, debug, version}) { |
| 53 | if (debug) { |
| 54 | throw new Error('zip task does not support debug builds'); |
| 55 | } |
| 56 | version = version ? `-${version}` : ''; |
| 57 | const releaseDir = 'build/release'; |
| 58 | const promises = []; |
| 59 | const date = await getLastCommitTime(); |
| 60 | /** @type {Array<import('./types.js').PlatformId>} */ |
| 61 | const chromePlatforms = [PLATFORM.CHROMIUM_MV2, PLATFORM.CHROMIUM_MV3, PLATFORM.CHROMIUM_MV2_PLUS]; |
| 62 | const enabledPlatforms = Object.values(PLATFORM).filter((platform) => platform !== PLATFORM.API && platforms[platform]); |
| 63 | for (const platform of enabledPlatforms) { |
| 64 | const format = chromePlatforms.includes(platform) ? 'zip' : 'xpi'; |
| 65 | promises.push(archiveDirectory({ |
| 66 | dir: getDestDir({debug, platform}), |
| 67 | dest: `${releaseDir}/darkreader-${platform}${version}.${format}`, |
| 68 | date, |
| 69 | // Reproducible builds: set permission flags on file like chmod 644 or -rw-r--r-- |
| 70 | // This is needed because the built file might have different flags on different systems |
| 71 | mode: 0o644, |
| 72 | })); |
| 73 | } |
| 74 | await Promise.all(promises); |
| 75 | } |
| 76 | |
| 77 | const zipTask = createTask( |
| 78 | 'zip', |
nothing calls this directly
no test coverage detected