Skip to content

Commit

Permalink
Add setup script and dev instructions in README (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie authored Jan 15, 2024
1 parent 12a45e0 commit 3b3ac6c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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/"

0 comments on commit 3b3ac6c

Please sign in to comment.