|
1 | 1 | # Project Instructions |
2 | 2 |
|
3 | | -This codebase is a fork of https://github.com/ChromeDevTools/devtools-frontend. |
| 3 | +This is the React Native DevTools frontend, a fork of [Chrome DevTools](https://github.com/ChromeDevTools/devtools-frontend). |
4 | 4 |
|
5 | | -## Editing Policy |
| 5 | +Changes should generally be scoped to the `front_end/` directory. Do not edit `front_end/generated/`. |
| 6 | + |
| 7 | +## Guidelines |
6 | 8 |
|
7 | 9 | - Make minimal edits. No speculative refactors. |
8 | | -- Changes should generally be scoped to the `front_end/` directory. Focus code searches here. |
| 10 | +- Use `.js` extensions in TypeScript imports. Use `type` imports where possible (`import type`). |
| 11 | +- New files in Meta-owned paths must prepend `// Copyright (c) Meta Platforms, Inc. and affiliates.` as the first line of the license header, above the Chromium Authors license. Keep in sync with `META_CODE_PATHS` in `scripts/eslint_rules/lib/check-license-header.js`. |
| 12 | + |
| 13 | +## Build system |
9 | 14 |
|
10 | | -## Workflow |
| 15 | +Each module directory has a `BUILD.gn` file. Update these when adding new files or dependencies. |
11 | 16 |
|
12 | | -- Update `BUILD.gn` files when adding new modules and imports. |
13 | | -- New files should prepend "Copyright (c) Meta Platforms, Inc. and affiliates." as the first line of the license header, above the Chromium Authors license. Keep in sync with `META_CODE_PATHS` in `scripts/eslint_rules/lib/check-license-header.js`. |
| 17 | +- `generate_css("css_files")` — lists `.css` source files. |
| 18 | +- `devtools_module("name")` — lists `.ts` source files in `sources` and dependencies as `:bundle` refs in `deps`. |
| 19 | +- `devtools_entrypoint("bundle")` — declares the barrel file that re-exports the module's public API. |
| 20 | +- `devtools_entrypoint("meta")` — declares the `-meta.ts` file that registers panels/views. Use `visibility` to restrict to specific entrypoints. |
| 21 | +- `ts_library("unittests")` — lists `.test.ts` files with `testonly = true`. |
14 | 22 |
|
15 | 23 | ## Architecture |
16 | 24 |
|
17 | | -- For UI code, prefer modern `html` template code and locate styles in one adjacent CSS file. Example: `front_end/ui/components/cards/Cards.ts`. |
| 25 | +- **UI components** extend `HTMLElement`, use Lit `html` templates (from `front_end/ui/lit/lit.js`), and locate styles in one adjacent CSS file. Prefix custom elements with `devtools-`. Example: `front_end/ui/components/cards/Card.ts`. |
| 26 | +- **Panels** extend `UI.Widget.VBox` and are registered via a `-meta.ts` file using `UI.ViewManager.registerViewExtension()`, which lazily loads the panel implementation. |
| 27 | +- **Entrypoints**: `front_end/entrypoints/rn_fusebox/` is the primary React Native entry point. |
| 28 | +- **RN-specific code** lives in paths listed in `META_CODE_PATHS` (e.g. `panels/rn_welcome/`, `panels/react_devtools/`, `models/react_native/`, `core/rn_experiments/`). |
0 commit comments