Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setup script and dev instructions in README #3

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/"