MCPcopy
hub / github.com/PrismJS/prism / run

Function run

dangerfile.js:88–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86};
87
88const run = async () => {
89 const minified = await getChangedMinifiedFiles();
90
91 if (minified.length === 0) {
92 markdown(`## No JS Changes`);
93 return;
94 }
95
96 const rows = [];
97 let totalFileSize = 0;
98 let totalMasterFileSize = 0;
99
100 for (const file of minified) {
101 const [fileContents, fileMasterContents] = await Promise.all([
102 readPRFile(file).catch(() => ''),
103 readBaseFile(file).catch(() => ''),
104 ]);
105
106 const [fileSize, fileMasterSize] = await Promise.all([
107 gzipSize(fileContents),
108 gzipSize(fileMasterContents),
109 ]);
110
111 totalFileSize += fileSize;
112 totalMasterFileSize += fileMasterSize;
113
114 rows.push([
115 file,
116 formatBytes(fileMasterSize),
117 formatBytes(fileSize),
118 absDiff(fileMasterSize, fileSize),
119 percDiff(fileMasterSize, fileSize),
120 ]);
121 }
122
123 markdown(`## JS File Size Changes (gzipped)
124
125${getSummary(rows, totalMasterFileSize, totalFileSize)}
126
127<details>
128
129| file | master | pull | size diff | % diff |
130| --- | --- | --- | --- | --- |
131${rows.map(row => `| ${row.join(' | ')} |`).join('\n')}
132
133</details>
134`);
135};
136
137run().catch(err => {
138 console.error(err);

Callers 1

dangerfile.jsFile · 0.70

Calls 7

getChangedMinifiedFilesFunction · 0.85
readPRFileFunction · 0.85
readBaseFileFunction · 0.85
formatBytesFunction · 0.85
absDiffFunction · 0.85
percDiffFunction · 0.85
getSummaryFunction · 0.85

Tested by

no test coverage detected