diff --git a/README.md b/README.md index ad1e26d4eb4..8889ccd7be5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,34 @@ Source code for React Native's debugger frontend, based on Chrome DevTools. This This repository is a fork of [ChromeDevTools/devtools-frontend](https://github.com/ChromeDevTools/devtools-frontend). +## Development + +### Initial setup + +1. Install [`depot_tools`](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) (ensuring your `PATH` is updated). + +2. This repository must be located inside a gclient workspace directory. Run the `setup.sh` script to perform this one-time step (which will relocate the repo folder). + + ```sh + # Using `source` will enable the script to change dir in your shell + source setup.sh + ``` + +### Build and run + +```sh +npm run build +# or npm run build-release +``` + +This can then be served from a static web server to test locally: + +```sh +python3 -m http.server 8000 --directory out/Default/gen/front_end +``` + +The frontend will be available at `http://localhost:8000/inspector.html` (or `http://localhost:8000/rn_inspector.html` for the RN-specific entry point). + ## Contributing ### Project documentation diff --git a/setup.sh b/setup.sh new file mode 100755 index 00000000000..3ac8d056aa9 --- /dev/null +++ b/setup.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright (c) Meta Platforms, Inc. and affiliates. +# 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. + +PROJECT_NAME=rn-chrome-devtools-frontend +WORKSPACE_DIR="${PROJECT_NAME}__workspace" + +if [ "$(basename "$(dirname "$PWD")")" = "$WORKSPACE_DIR" ]; then + echo "[setup] Error: Already in workspace directory" + exit 1 +fi + +STARTING_DIR=$PWD + +echo "[setup] Creating workspace directory at $(dirname "$PWD")/$WORKSPACE_DIR/" +cd .. +mkdir $WORKSPACE_DIR + +echo "[setup] Moving repo folder into workspace" +mv $STARTING_DIR "$WORKSPACE_DIR/$PROJECT_NAME" + +echo "[setup] Syncing gclient workspace" +cd $WORKSPACE_DIR +gclient config --unmanaged $PROJECT_NAME --name $PROJECT_NAME +gclient sync --no-history + +echo "[setup] Moving to project folder" +cd $PROJECT_NAME + +echo "[setup] Success: Repo ready at $PWD/"