|
2 | 2 |
|
3 | 3 | Angular DevTools is a browser DevTools extension for debugging and profiling Angular applications. |
4 | 4 |
|
5 | | -## Installing and Running locally |
| 5 | +## Developing Locally |
6 | 6 |
|
7 | | -To setup your local development environment for Angular DevTools, see [DEVELOPING.md](./DEVELOPING.md) |
| 7 | +<!-- This duplicates some general content for setting up the angular/angular repository, however it is important to |
| 8 | + have complete instructions here for Mozilla Add-On reviewers who need to be able to reproduce Angular DevTools |
| 9 | + builds and will use the same documentation. --> |
8 | 10 |
|
9 | | -## Publish Angular DevTools |
| 11 | +### Set up |
10 | 12 |
|
11 | | -Publishing Angular DevTools is a five step process: |
12 | | -1. Sync and update workspace. |
13 | | -1. Update extension version numbers. |
14 | | -1. Publish to Chrome. |
15 | | -1. Publish to Firefox. |
16 | | -1. Commit and merge the updated version numbers. |
| 13 | +Follow the instructions below to set up your Angular DevTools development |
| 14 | +environment. Note that all commands should be executed in the repository root, not |
| 15 | +`devtools/`. All file paths are also relative to the repository root. |
17 | 16 |
|
18 | | -### 1. Sync workspace |
| 17 | +Debian Linux, MacOS, and Windows via WSL should build successfully. Building |
| 18 | +natively on Windows without WSL is not supported at the moment. |
19 | 19 |
|
20 | | -Before starting anything, make sure your workspace is up to date with latest changes and dependencies. |
| 20 | +To set up your development environment, first install the [correct version of Node](/.nvmrc). If you have |
| 21 | +[`nvm`](https://github.com/nvm-sh/nvm) set up, this can be done with: |
21 | 22 |
|
22 | 23 | ```shell |
23 | | -git checkout main |
24 | | -git pull upstream main |
25 | 24 | nvm install |
26 | | -yarn --frozen-lockfile |
27 | 25 | ``` |
28 | 26 |
|
29 | | -### 2. Update extension version numbers |
30 | | - |
31 | | -Bump the version numbers listed in |
32 | | -[`manifest.chrome.json`](/devtools/projects/shell-browser/src/manifest/manifest.chrome.json) |
33 | | -and [`manifest.firefox.json`](/devtools/projects/shell-browser/src/manifest/manifest.firefox.json). |
| 27 | +Second, install [Yarn](https://classic.yarnpkg.com/en/): |
34 | 28 |
|
35 | | -### 3. Publish to Chrome Chrome |
| 29 | +```shell |
| 30 | +npm install -g yarn@1 |
| 31 | +``` |
36 | 32 |
|
37 | | -To publish Angular DevTools to the Chrome Web Store, first build and package the extension. |
| 33 | +Third, install NPM dependencies: |
38 | 34 |
|
39 | 35 | ```shell |
40 | | -# Build the Chrome version. |
41 | | -yarn devtools:build:chrome |
42 | | - |
43 | | -# Package the extension. |
44 | | -(cd dist/bin/devtools/projects/shell-browser/src/prodapp && zip -r ~/devtools-chrome.zip *) |
| 36 | +yarn --frozen-lockfile |
45 | 37 | ``` |
46 | 38 |
|
47 | | -Then upload it to the Chrome Web Store. |
| 39 | +Now you should be ready to build the DevTools extension. |
48 | 40 |
|
49 | | -1. Go to the extension [page](https://chrome.google.com/webstore/category/extensions) |
50 | | -1. Make sure your email is part of the Google Group we use for publishing the extension |
51 | | -1. Navigate to "Developer Dashboard" |
52 | | -1. Enter your account credentials |
53 | | -1. You should be able to change the publisher to "Angular" |
| 41 | +### Dev builds |
54 | 42 |
|
55 | | -You can choose to either publish immediately or only get approval but hold to publish at a later time. |
56 | | -Note that even publishing immediately still requires approval from Chrome Web Store before it is |
57 | | -available to users. Historically this has been pretty quick (< 30 minutes), but there is no hard upper |
58 | | -limit on how long a review might take: https://developer.chrome.com/docs/webstore/review-process#review-time. |
| 43 | +To run the extension in development mode run: |
59 | 44 |
|
60 | | -### 4. Firefox |
| 45 | +```shell |
| 46 | +yarn devtools:devserver |
| 47 | +``` |
61 | 48 |
|
62 | | -To publish Angular DevTools as a Firefox Add-on, first build and package the extension. |
| 49 | +You can also run a standalone version of the demo app with: |
63 | 50 |
|
64 | 51 | ```shell |
65 | | -# Build the Firefox version. |
66 | | -yarn devtools:build:firefox |
67 | | - |
68 | | -# Package the extension. |
69 | | -(cd dist/bin/devtools/projects/shell-browser/src/prodapp && zip -r ~/devtools-firefox.zip *) |
| 52 | +yarn devtools:devserver:demo-standalone |
70 | 53 | ``` |
71 | 54 |
|
72 | | -Then upload it: |
| 55 | +This would start a development server that you can access on <http://localhost:4200>. In development, Angular DevTools |
| 56 | +uses a "development shell." This is different from "chrome shell" in a way, that it runs the user's app in an iframe. |
| 57 | +DevTools then communicate with the user's app via message passing. |
73 | 58 |
|
74 | | -1. Go to the Firefox Addons [page](https://addons.mozilla.org/developers/addons) |
75 | | -1. For email enter `[email protected]` |
76 | | -1. Find the password [on Valentine](http://valentine/#/show/1651707871496288) |
77 | | -1. Setup Google Authenticator with the 2FA QR code. You can find the QR code on Valentine |
| 59 | +### Release builds |
78 | 60 |
|
79 | | -The Firefox publishing process is slightly more involved than Chrome. In particular, they |
80 | | -require extension source code with instructions to build and run it. Since DevTools exists in |
81 | | -a monorepo with critical build tooling existing outside the `devtools/` directory, we need to |
82 | | -upload the entire monorepo. Package it without dependencies and generated files with the |
83 | | -following command and upload it. |
| 61 | +You can build the release version of Angular DevTools for either Chrome or Firefox with: |
84 | 62 |
|
85 | 63 | ```shell |
86 | | -zip -r ~/angular-source.zip * -x ".git/*" -x "node_modules/*" -x "**/node_modules/*" -x "dist/" |
| 64 | +yarn devtools:build:chrome |
| 65 | +yarn devtools:build:firefox |
87 | 66 | ``` |
88 | 67 |
|
89 | | -Suggested note to reviewer: |
| 68 | +Either way, the built extension will be at `dist/bin/devtools/projects/shell-browser/src/prodapp`. |
90 | 69 |
|
91 | | -> This is a monorepo and includes much more code than just the DevTools extension. The relevant |
92 | | -> code is under `devtools/...` and `devtools/README.md` contains instructions for building and |
93 | | -> testing locally. |
94 | | -> |
95 | | -> The uploaded source is equivalent to |
96 | | -> https://github.com/angular/angular/tree/${permalink to current main}/ with the single change |
97 | | -> of a bumped version number in the `manifest.json` file. |
| 70 | +#### Installation |
98 | 71 |
|
99 | | -### 5. Commit and merge |
100 | | - |
101 | | -Commit the version bump: |
102 | | - |
103 | | -```shell |
104 | | -git checkout -b devtools-release |
105 | | -git add . && git commit -m "release: bump Angular DevTools version to 1.0.10" |
106 | | -git push -u origin devtools-release |
107 | | -``` |
| 72 | +For Chrome, you can install the extension from `dist/bin/devtools/projects/shell-browser/src/prodapp` by following the |
| 73 | +guide from [here](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world#load-unpacked). |
108 | 74 |
|
109 | | -Then create and merge a PR targeting `patch` with this change. |
| 75 | +For Firefox, to load the extension, you can go to the about:debugging page, click the "This Firefox" option and then |
| 76 | +click the Load Temporary Add-on button. You'll have to select the manifest file in |
| 77 | +`dist/bin/devtools/projects/shell-browser/src/prodapp` directly. |
110 | 78 |
|
111 | | -Once the PR merges and both Chrome and Firefox are showing the new version to end users, then |
112 | | -the release is complete! |
0 commit comments