mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-02 18:11:04 +08:00
- Also upgrade the refactor script to automatically add the extensionpoint to the BUILD.gn to save myself some typing. Bug: 1006759 Change-Id: I3f789f96122569141194ce26ac288f01af68f6e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852209 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#704600} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: e55e98bc0ca76229380e3bca5a78e15d953da0c5
67 lines
2.1 KiB
Bash
Executable File
67 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Copyright 2019 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Must supply folder name"
|
|
exit
|
|
fi
|
|
|
|
MIGRATION_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
ROOT_PATH="$MIGRATION_SCRIPT_DIR/../.."
|
|
FRONT_END_PATH="$ROOT_PATH/front_end"
|
|
BUILD_GN_PATH="$ROOT_PATH/BUILD.gn"
|
|
|
|
FOLDER_PATH="$FRONT_END_PATH/$1"
|
|
|
|
if [ ! -d "$FOLDER_PATH" ]; then
|
|
echo "Folder on location $FOLDER_PATH does not exist"
|
|
exit
|
|
fi
|
|
|
|
FILES=$(find $FOLDER_PATH/*.js | xargs -n 1 basename -s .js)
|
|
|
|
npm run build
|
|
|
|
MODULE_FILE="$FRONT_END_PATH/$1/$1.js"
|
|
|
|
touch "$MODULE_FILE"
|
|
|
|
echo "// Copyright 2019 The Chromium Authors. All rights reserved." >> $MODULE_FILE
|
|
echo "// Use of this source code is governed by a BSD-style license that can be" >> $MODULE_FILE
|
|
echo "// found in the LICENSE file." >> $MODULE_FILE
|
|
echo "" >> $MODULE_FILE
|
|
|
|
for FILE in $FILES
|
|
do
|
|
npm run migrate -- $1 $FILE
|
|
# Remove old reference in all_devtools_files variable
|
|
# The start of the substitution reads the whole file, which is necessary to remove the newline characters
|
|
sed -i -e ":a;N;\$!ba;s/\"front\_end\/$1\/$FILE.js\"\,\n//g" "$BUILD_GN_PATH"
|
|
|
|
# Add to all_devtools_modules
|
|
sed -i -e "s/all\_devtools\_modules = \[/all\_devtools\_modules = \[ \"front\_end\/$1\/$FILE.js\"\,/" "$BUILD_GN_PATH"
|
|
# Add to copied_devtools_modules
|
|
sed -i -e "s/copied\_devtools\_modules = \[/copied\_devtools\_modules = \[ \"\$resources\_out\_dir\/$1\/$FILE.js\"\,/" "$BUILD_GN_PATH"
|
|
|
|
echo "import * as $FILE from './$FILE.js';" >> $MODULE_FILE
|
|
done
|
|
|
|
# Add module entrypoint to GN variables
|
|
sed -i -e "s/all\_devtools\_modules = \[/all\_devtools\_modules = \[ \"front\_end\/$1\/$1.js\"\,/" "$BUILD_GN_PATH"
|
|
sed -i -e "s/copied\_devtools\_modules = \[/copied\_devtools\_modules = \[ \"\$resources\_out\_dir\/$1\/$1.js\"\,/" "$BUILD_GN_PATH"
|
|
|
|
echo "" >> $MODULE_FILE
|
|
echo "export {" >> $MODULE_FILE
|
|
|
|
for FILE in $FILES
|
|
do
|
|
echo " $FILE," >> $MODULE_FILE
|
|
done
|
|
|
|
echo "};" >> $MODULE_FILE
|
|
|
|
git cl format
|