Skip to content

Commit

Permalink
misc(build): use cross platform sed for devtools script (#13242)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Oct 21, 2021
1 parent 12c32b3 commit cbc9282
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lighthouse-core/scripts/roll-to-devtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
# with a custom devtools location (could be path to standalone checkout):
# yarn devtools ~/code/devtools/devtools-frontend


set -euo pipefail

check="\033[96m ✓\033[39m"

if [[ -n "$1" ]]; then
dt_dir="$1"
else
dt_dir="$HOME/src/devtools/devtools-frontend"
fi
dt_dir="${1:-$HOME/src/devtools/devtools-frontend}"

if [[ ! -d "$dt_dir" || ! -a "$dt_dir/front_end/OWNERS" ]]; then
echo -e "\033[31m✖ Error!\033[39m"
Expand All @@ -48,10 +47,14 @@ echo -e "$check lighthouse-dt-bundle copied."

# generate bundle.d.ts
npx tsc --allowJs --declaration --emitDeclarationOnly dist/report/bundle.esm.js

# Exports of report/clients/bundle.js can possibly be mistakenly overriden by tsc.
sed -i '' 's/export type DOM = any;//' dist/report/bundle.esm.d.ts
sed -i '' 's/export type ReportRenderer = any;//' dist/report/bundle.esm.d.ts
sed -i '' 's/export type ReportUIFeatures = any;//' dist/report/bundle.esm.d.ts
# Funky sed inplace command so we support both GNU sed and BSD sed (used by GHA devtools runner on macos)
# https://stackoverflow.com/a/22084103/89484
sed -i.bak 's/export type DOM = any;//' dist/report/bundle.esm.d.ts
sed -i.bak 's/export type ReportRenderer = any;//' dist/report/bundle.esm.d.ts
sed -i.bak 's/export type ReportUIFeatures = any;//' dist/report/bundle.esm.d.ts


# copy report code $fe_lh_dir
fe_lh_report_dir="$fe_lh_dir/report/"
Expand Down

0 comments on commit cbc9282

Please sign in to comment.