1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Graph improvements (#15793)

This commit is contained in:
Jyoti Puri 2022-09-16 22:26:36 +05:30 committed by GitHub
parent d91eabfd16
commit 441e894e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

View File

@ -40,25 +40,21 @@ git config --global user.name "MetaMask Bot"
git clone git@github.com:MetaMask/extension_bundlesize_stats.git temp
if [[ -f "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json" ]]
then
printf 'Bundle size of the commit is already recorded'
cd ..
rm -rf temp
exit 0
fi
{
echo " '${CIRCLE_SHA1}': ";
cat test-artifacts/chrome/mv3/bundle_size_stats.json;
echo ", ";
} >> temp/stats/bundle_size_data.temp.js
cp -R test-artifacts/chrome/mv3/bundle_size_stats.json temp/stats
cp temp/stats/bundle_size_data.temp.js temp/stats/bundle_size_data.js
echo " bundle_size_stats-${CIRCLE_SHA1}.json" >> temp/stats/fileList.txt
mv temp/stats/bundle_size_stats.json "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json"
echo " }" >> temp/stats/bundle_size_data.js
cd temp
git add .
git commit --message "Bundle size at commit: ${CIRCLE_SHA1}"
git commit --message "Adding bundle size at commit: ${CIRCLE_SHA1}"
repo_slug="$CIRCLE_PROJECT_USERNAME/extension_bundlesize_stats"
git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" main

View File

@ -53,14 +53,14 @@ async function main() {
const distFolder = 'dist/chrome';
const backgroundFileList = [];
const uiFileList = [];
const commonFileList = [];
const files = await fs.readdir(distFolder);
for (let i = 0; i < files.length; i++) {
const file = files[i];
if (CommonFileRegex.test(file)) {
const stats = await fs.stat(`${distFolder}/${file}`);
backgroundFileList.push({ name: file, size: stats.size });
uiFileList.push({ name: file, size: stats.size });
commonFileList.push({ name: file, size: stats.size });
} else if (
backgroundFiles.includes(file) ||
BackgroundFileRegex.test(file)
@ -83,6 +83,11 @@ async function main() {
0,
);
const commonBundleSize = commonFileList.reduce(
(result, file) => result + file.size,
0,
);
const result = {
background: {
name: 'background',
@ -94,6 +99,11 @@ async function main() {
size: uiBundleSize,
fileList: uiFileList,
},
common: {
name: 'common',
size: commonBundleSize,
fileList: commonFileList,
},
};
if (out) {
@ -115,6 +125,7 @@ async function main() {
{
background: backgroundBundleSize,
ui: uiBundleSize,
common: commonBundleSize,
timestamp: new Date().getTime(),
},
null,