Skip to content

Commit

Permalink
misc(build): include locale files in devtools roll (#9639)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Nov 6, 2019
1 parent c660975 commit e2d7991
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions lighthouse-core/scripts/roll-to-devtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# yarn devtools node_modules/temp-devtoolsfrontend/front_end/

chromium_dir="$HOME/chromium/src"
check="\033[96m ✓\033[39m"

if [[ -n "$1" ]]; then
frontend_dir="$1"
Expand All @@ -29,26 +30,37 @@ if [[ ! -d "$frontend_dir" || ! -a "$frontend_dir/Runtime.js" ]]; then
echo " $frontend_dir"
exit 1
else
echo -e "\033[96m ✓\033[39m Chromium folder in place."
echo -e "$check Chromium folder in place."
fi

report_dir="lighthouse-core/report/html"
fe_lh_dir="$frontend_dir/audits/lighthouse"

lh_bg_js="dist/lighthouse-dt-bundle.js"
lh_worker_dir="$frontend_dir/audits_worker/lighthouse"
fe_worker_dir="$frontend_dir/audits_worker/lighthouse"

# copy lighthouse-dt-bundle (potentially stale)
cp -pPR "$lh_bg_js" "$lh_worker_dir/lighthouse-dt-bundle.js"
echo -e "\033[96m ✓\033[39m (Potentially stale) lighthouse-dt-bundle copied."
cp -pPR "$lh_bg_js" "$fe_worker_dir/lighthouse-dt-bundle.js"
echo -e "$check (Potentially stale) lighthouse-dt-bundle copied."

# copy report generator + cached resources into $fe_lh_dir
# use dir/* format to copy over all files in dt-report-resources directly to $fe_lh_dir
# use dir/* format to copy over all files in dt-report-resources directly to $fe_lh_dir
# dir/ format behavior changes based on if their exists a folder named dir, which can get weird
cp -r dist/dt-report-resources/* $fe_lh_dir
cp -r dist/dt-report-resources/* "$fe_lh_dir"
echo -e "$check Report resources copied."

# copy locale JSON files (but not the .ctc.json ones)
lh_locales_dir="lighthouse-core/lib/i18n/locales"
fe_locales_dir="$frontend_dir/audits_worker/lighthouse/locales"

mkdir -p "$fe_locales_dir"
find $lh_locales_dir -name '*.json' ! -name '*.ctc.json' -exec cp {} "$fe_locales_dir" \;
echo -e "$check Locale JSON files copied."

# update expected version string in tests
VERSION=$(node -e "console.log(require('./package.json').version)")
sed -i '' -e "s/Version:.*/Version: $VERSION/g" "$tests_dir"/*-expected.txt
echo -e "$check Updated Version string in tests."

echo "Done. To rebase the test expectations, run: yarn --cwd ~/chromium/src/third_party/blink/renderer/devtools test 'http/tests/devtools/audits/*.js' --reset-results"
echo ""
echo "Done. To rebase the test expectations, run: "
echo " yarn --cwd ~/chromium/src/third_party/blink/renderer/devtools test 'http/tests/devtools/audits/*.js' --reset-results"

0 comments on commit e2d7991

Please sign in to comment.