From 246927a7ee523704ff76f28eed08c13db3062eed Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 7 Oct 2021 11:19:52 -0700 Subject: [PATCH] fix: Make update_metadata.sh work on macOS (#5590) --- tests/scripts/update_metadata.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/scripts/update_metadata.sh b/tests/scripts/update_metadata.sh index d3b97f3ab42..c6afc8ad00d 100755 --- a/tests/scripts/update_metadata.sh +++ b/tests/scripts/update_metadata.sh @@ -10,25 +10,29 @@ blockly_size=$(wc -c < "build/blockly_compressed.js") blocks_size=$(wc -c < "build/blocks_compressed.js") blockly_gz_size=$(wc -c < "build/blockly_compressed.js.gz") blocks_gz_size=$(wc -c < "build/blocks_compressed.js.gz") -quarter=$(date "+Q%q %Y") +quarters=(1 1 1 2 2 2 3 3 3 4 4 4) +month=$(date +%-m) +quarter=$(echo Q${quarters[$month - 1]} $(date +%Y)) version=$(npx -c 'echo "$npm_package_version"') replacement="# ${quarter}\t${version}\t${blockly_size}\n" replacement+="readonly BLOCKLY_SIZE_EXPECTED=${blockly_size}" -sed -ri "s/readonly BLOCKLY_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ +sed -ri.bak "s/readonly BLOCKLY_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ tests/scripts/check_metadata.sh replacement="# ${quarter}\t${version}\t${blocks_size}\n" replacement+="readonly BLOCKS_SIZE_EXPECTED=${blocks_size}" -sed -ri "s/readonly BLOCKS_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ +sed -ri.bak "s/readonly BLOCKS_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ tests/scripts/check_metadata.sh replacement="# ${quarter}\t${version}\t${blockly_gz_size}\n" replacement+="readonly BLOCKLY_GZ_SIZE_EXPECTED=${blockly_gz_size}" -sed -ri "s/readonly BLOCKLY_GZ_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ +sed -ri.bak "s/readonly BLOCKLY_GZ_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ tests/scripts/check_metadata.sh replacement="# ${quarter}\t${version}\t${blocks_gz_size}\n" replacement+="readonly BLOCKS_GZ_SIZE_EXPECTED=${blocks_gz_size}" -sed -ri "s/readonly BLOCKS_GZ_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ - tests/scripts/check_metadata.sh \ No newline at end of file +sed -ri.bak "s/readonly BLOCKS_GZ_SIZE_EXPECTED=[0-9]+/${replacement}/g" \ + tests/scripts/check_metadata.sh + +rm tests/scripts/check_metadata.sh.bak \ No newline at end of file