1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +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 git clone git@github.com:MetaMask/extension_bundlesize_stats.git temp
if [[ -f "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json" ]] {
then echo " '${CIRCLE_SHA1}': ";
printf 'Bundle size of the commit is already recorded' cat test-artifacts/chrome/mv3/bundle_size_stats.json;
cd .. echo ", ";
rm -rf temp } >> temp/stats/bundle_size_data.temp.js
exit 0
fi
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 echo " }" >> temp/stats/bundle_size_data.js
mv temp/stats/bundle_size_stats.json "temp/stats/bundle_size_stats-${CIRCLE_SHA1}.json"
cd temp cd temp
git add . 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" repo_slug="$CIRCLE_PROJECT_USERNAME/extension_bundlesize_stats"
git push "https://$GITHUB_TOKEN_USER:$GITHUB_TOKEN@github.com/$repo_slug" main 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 distFolder = 'dist/chrome';
const backgroundFileList = []; const backgroundFileList = [];
const uiFileList = []; const uiFileList = [];
const commonFileList = [];
const files = await fs.readdir(distFolder); const files = await fs.readdir(distFolder);
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
const file = files[i]; const file = files[i];
if (CommonFileRegex.test(file)) { if (CommonFileRegex.test(file)) {
const stats = await fs.stat(`${distFolder}/${file}`); const stats = await fs.stat(`${distFolder}/${file}`);
backgroundFileList.push({ name: file, size: stats.size }); commonFileList.push({ name: file, size: stats.size });
uiFileList.push({ name: file, size: stats.size });
} else if ( } else if (
backgroundFiles.includes(file) || backgroundFiles.includes(file) ||
BackgroundFileRegex.test(file) BackgroundFileRegex.test(file)
@ -83,6 +83,11 @@ async function main() {
0, 0,
); );
const commonBundleSize = commonFileList.reduce(
(result, file) => result + file.size,
0,
);
const result = { const result = {
background: { background: {
name: 'background', name: 'background',
@ -94,6 +99,11 @@ async function main() {
size: uiBundleSize, size: uiBundleSize,
fileList: uiFileList, fileList: uiFileList,
}, },
common: {
name: 'common',
size: commonBundleSize,
fileList: commonFileList,
},
}; };
if (out) { if (out) {
@ -115,6 +125,7 @@ async function main() {
{ {
background: backgroundBundleSize, background: backgroundBundleSize,
ui: uiBundleSize, ui: uiBundleSize,
common: commonBundleSize,
timestamp: new Date().getTime(), timestamp: new Date().getTime(),
}, },
null, null,