MCPcopy Index your code
hub / github.com/darkreader/darkreader / zip

Function zip

tasks/zip.js:52–75  ·  view source on GitHub ↗
({platforms, debug, version})

Source from the content-addressed store, hash-verified

50}
51
52async 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
77const zipTask = createTask(
78 'zip',

Callers

nothing calls this directly

Calls 4

getDestDirFunction · 0.90
getLastCommitTimeFunction · 0.85
archiveDirectoryFunction · 0.85
allMethod · 0.80

Tested by

no test coverage detected