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

Function run

tasks/cli.js:146–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144}
145
146async function run() {
147 const args = process.argv.slice(3);
148
149 const shouldPrintHelp = args.length === 0 || process.argv[2] !== 'build' || args.includes('-h') || args.includes('--help');
150 if (shouldPrintHelp) {
151 printHelp();
152 process.exit(0);
153 }
154
155 const validationErrors = validateArguments(args);
156 if (validationErrors.length > 0) {
157 validationErrors.forEach(log.error);
158 printHelp();
159 process.exit(130);
160 }
161
162 const version = getVersion(args);
163
164 // If building signed build, check that required signature files exist
165 if (version) {
166 try {
167 const signatureDir = getSignatureDir(version);
168 const stats = await stat(signatureDir);
169 assert(stats.isDirectory());
170 } catch (e) {
171 console.log(`Could not find signature files for version ${version}`);
172 return;
173 }
174 }
175
176 // We need to install new deps prior to forking for them to be loaded properly
177 if (version) {
178 try {
179 await ensureGitClean();
180 await checkoutVersion(version, args.includes('--fix-deps'));
181 } catch (e) {
182 log.error(`Could not check out tag ${version}. ${e}`);
183 return;
184 }
185 }
186
187 const childArgs = parseArguments(args);
188
189 await executeChildProcess(childArgs);
190
191 if (version) {
192 log.ok('PACKING SIGNATURES');
193 await checkoutHead();
194
195 await runTasks([signature, zip], {
196 version,
197 platforms: {
198 [PLATFORM.FIREFOX_MV2]: true,
199 },
200 debug: false,
201 watch: false,
202 log: false,
203 test: false,

Callers 1

cli.jsFile · 0.70

Calls 11

runTasksFunction · 0.90
printHelpFunction · 0.85
validateArgumentsFunction · 0.85
getSignatureDirFunction · 0.85
assertFunction · 0.85
ensureGitCleanFunction · 0.85
checkoutVersionFunction · 0.85
parseArgumentsFunction · 0.85
executeChildProcessFunction · 0.85
checkoutHeadFunction · 0.85
getVersionFunction · 0.70

Tested by

no test coverage detected