From 94a168e242c866a51235d06b059b25d6c8a0f78c Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 10 Jan 2023 14:26:17 -0800 Subject: [PATCH 1/2] Prepare extension release process --- dwds/debug_extension_mv3/CONTRIBUTING.md | 94 +++++++++++++++++++ .../tool/build_extension.sh | 15 ++- dwds/debug_extension_mv3/web/manifest.json | 68 ++++++-------- 3 files changed, 138 insertions(+), 39 deletions(-) create mode 100644 dwds/debug_extension_mv3/CONTRIBUTING.md diff --git a/dwds/debug_extension_mv3/CONTRIBUTING.md b/dwds/debug_extension_mv3/CONTRIBUTING.md new file mode 100644 index 000000000..18a604903 --- /dev/null +++ b/dwds/debug_extension_mv3/CONTRIBUTING.md @@ -0,0 +1,94 @@ +## Building + +> Note: First make the script executable: `chmod +x tool/build_extension.sh` + +- For development: `./tool/build_extension.sh` +- For release: `./tool/build_extension.sh prod` + +The dart2js-compiled extension will be located in the `/compiled` directory. + +## Local Development + +### \[For Googlers\] Create an `extension_key.txt` file: + +- Create a `extension_key.txt` file at the root of `/debug_extension`. Paste in + the value of one of the whitelisted developer keys into this txt file. + IMPORTANT: DO NOT COMMIT THE KEY. It will be copied into the `manifest.json` + when you build the extension. + +### Build and upload your local extension + +- Build the extension following the instructions above +- Visit chrome://extensions +- Toggle "Developer mode" on +- Click the "Load unpacked" button +- Select the extension directory: `/compiled` + +### Debug your local extension + +- Click the Extensions puzzle piece, and pin the Dart Debug Extension with the + dev icon (unpin the published version so you don't confuse them) +- You can now use the extension normally by clicking it when a local Dart web + application has loaded in a Chrome tab +- To debug, visit chrome://extensions and click "Inspect view on background + page" to open Chrome DevTools for the extension +- More debugging information can be found in the + [Chrome Developers documentation](https://developer.chrome.com/docs/extensions/mv3/devguide/) + +## Release process + +- Update the version in `web/manifest.json`, `pubspec.yaml`, and in the + `CHANGELOG`. +- Follow the instructions above to build the release version of the extension. + +> \*At this point, you should manually verify that everything is working by +> following the steps in [Local Development](#local-development), except load +> the extension from the `compiled` directory. You will need to add an extension +> key to the `manifest.json` file in `compiled` to test locally. + +- Open a PR to submit the version change. +- Once submitted, pull the changes down to your local branch, and create a zip + of the `compiled` directory. **Remove the Googler extension key that was added + by the builder to the `manifest.json` file.** +- Rename the zip `version_XX.XX.XX.zip` (eg, `version_1.24.0.zip`) and add it to + the go/dart-debug-extension-zips folder + +> *You must be a Googler to do this. Ask for help if not.* + +- Go to the + [Chrome Web Store Developer Dashboard](https://chrome.google.com/webstore/devconsole). +- At the top-right, under Publisher, select dart-bat. + +> *If you don’t see dart-bat as an option, you will need someone on the Dart +> team to add you to the dart-bat Google group.* + +- Under Items, select the "Dart Debug Extension". +- Go to “Package” then select “Upload new package”. + +> *The first time you do this, you will be asked to pay a $5 registration fee. +> The registration fee can be expensed.* + +- Upload the zip file you created in step 4. +- Save as draft, and verify that the new version is correct. +- Publish. The extension will be published immediately after going through the + review process. + +## Rollback process + +> The Chrome Web Store Developer Dashboard does not support rollbacks. Instead +> you must re-publish an earlier version. This means that the extension will +> still have to go through the review process, which can take anywhere from a +> few hours (most common) to a few days. + +- Find the previous version you want to rollback to in the + go/dart-debug-extension-zips folder. + +> *You must be a Googler to do this. Ask for help if not.* + +- Unzip the version you have chosen, and in `manifest.json` edit the version + number to be the next sequential version after the current "bad" version (eg, + the bad version is `1.28.0` and you are rolling back to version `1.27.0`. + Therefore you change `1.27.0` to `1.29.0`). +- Re-zip the directory and rename it to the new version number. Add it to the + go/dart-debug-extension-zips folder. +- Now, follow steps 6 - 11 in [Release process](#release-process). diff --git a/dwds/debug_extension_mv3/tool/build_extension.sh b/dwds/debug_extension_mv3/tool/build_extension.sh index 4600bb4b4..a7870fe30 100755 --- a/dwds/debug_extension_mv3/tool/build_extension.sh +++ b/dwds/debug_extension_mv3/tool/build_extension.sh @@ -9,12 +9,25 @@ # Builds the unminifed dart2js app (see DDC issue: https://github.com/dart-lang/sdk/issues/49869): # ./tool/build_extension.sh + +prod="false" + +case "$1" in + prod) + prod="true" + shift;; +esac + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Building dart2js-compiled extension to /compiled directory." echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" dart run build_runner build web --output build --release +if [ $prod == true ]; then + exit 1 +fi + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Updating manifest.json in /compiled directory." echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -dart tool/update_dev_files.dart +dart tool/update_dev_files.dart \ No newline at end of file diff --git a/dwds/debug_extension_mv3/web/manifest.json b/dwds/debug_extension_mv3/web/manifest.json index e44ed5828..291340c54 100644 --- a/dwds/debug_extension_mv3/web/manifest.json +++ b/dwds/debug_extension_mv3/web/manifest.json @@ -1,40 +1,32 @@ { - "name": "MV3 Dart Debug Extension", - "version": "1.0", - "manifest_version": 3, - "devtools_page": "static_assets/devtools.html", - "action": { - "default_icon": "static_assets/dart_dev.png" - }, - "externally_connectable": { - "ids": [ - "nbkbficgbembimioedhceniahniffgpl" - ] - }, - "permissions": [ - "debugger", - "notifications", - "scripting", - "storage", - "tabs", - "webNavigation" - ], - "host_permissions": [ - "" - ], - "background": { - "service_worker": "background.dart.js" - }, - "content_scripts": [ - { - "matches": [ - "" - ], - "js": [ - "detector.dart.js" - ], - "run_at": "document_end" - } - ], - "options_page": "static_assets/settings.html" + "name": "Dart Debug Extension", + "version": "1.31", + "manifest_version": 3, + "devtools_page": "static_assets/devtools.html", + "action": { + "default_icon": "static_assets/dart_dev.png" + }, + "externally_connectable": { + "ids": ["nbkbficgbembimioedhceniahniffgpl"] + }, + "permissions": [ + "debugger", + "notifications", + "scripting", + "storage", + "tabs", + "webNavigation" + ], + "host_permissions": [""], + "background": { + "service_worker": "background.dart.js" + }, + "content_scripts": [ + { + "matches": [""], + "js": ["detector.dart.js"], + "run_at": "document_end" + } + ], + "options_page": "static_assets/settings.html" } From 3a445557f128ef46b5c6d34df50a2a3b9bae05f4 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 10 Jan 2023 14:32:55 -0800 Subject: [PATCH 2/2] New line end of file --- dwds/debug_extension_mv3/tool/build_extension.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwds/debug_extension_mv3/tool/build_extension.sh b/dwds/debug_extension_mv3/tool/build_extension.sh index a7870fe30..9df8f4fa9 100755 --- a/dwds/debug_extension_mv3/tool/build_extension.sh +++ b/dwds/debug_extension_mv3/tool/build_extension.sh @@ -30,4 +30,4 @@ fi echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "Updating manifest.json in /compiled directory." echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -dart tool/update_dev_files.dart \ No newline at end of file +dart tool/update_dev_files.dart