mirror of
https://github.com/SukkaW/Surge.git
synced 2026-02-03 04:21:53 +08:00
Perf: speed up build
This commit is contained in:
@@ -40,8 +40,13 @@ module.exports.traceAsync = traceAsync;
|
||||
*/
|
||||
module.exports.task = (__filename, fn, customname = null) => {
|
||||
const taskName = customname ?? path.basename(__filename, path.extname(__filename));
|
||||
return () => {
|
||||
return async () => {
|
||||
console.log(`🏃 [${taskName}] Start executing`);
|
||||
return traceAsync(`✅ [${taskName}] Executed successfully`, fn);
|
||||
const start = performance.now();
|
||||
await fn();
|
||||
const end = performance.now();
|
||||
console.log(`✅ [${taskName}] Executed successfully: ${(end - start).toFixed(3)}ms`);
|
||||
|
||||
return { start, end, taskName };
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user