commit | d02489e19be0a8a8cdc18b8bf85614cfbf7da737 | [log] [tgz] |
---|---|---|
author | Tao Zhou <taoalpha@google.com> | Mon May 16 11:44:13 2022 +0200 |
committer | Tao Zhou <taoalpha@google.com> | Mon May 16 11:44:13 2022 +0200 |
tree | fe75e3aab08150a958d16177b2102d80d03df302 | |
parent | f6f8fdd2e33ebe9a3d33ce23a61e3b825067338a [diff] |
v0.0.9 Some fixes around plugin injection and rule evaluation. Change-Id: Ifd8fd9027f3e8f2af43abdf53d3c637f5766f5f7
Gerrit FE Dev helper is a chrome extension that will focus on helping frontend developers on Gerrit development.
As mentioned in readme from polygerrit-ui, we already support to start your local host for developing / debugging / testing, but it has quite a few restrictions:
To solve these pain points, I created this chrome extension that basically just proxy all assets requests or any requests to local server, and you will have the ability to inject any plugins from local as well.
See in release notes.
npm install npm run build
Then you should have gerrit_fe_dev_helper.zip
that you can test with, or download from chrome web store here: https://chrome.google.com/webstore/detail/gerrit-fe-dev-helper/jimgomcnodkialnpmienbomamgomglkd.
After you installed and enabled the extension, you should see something similar to demo.png.
./polygerrit-ui/run-server.sh
Gerrit dev helper is enabled
), and now your gerrit assets should be loaded from local serverThe extension comes with a set of default rules, but you can change the rules by just clicking the extension icon again.
The extension supports six different type of rules:
The two options of injecting any plugins meant to help you develop your plugins for your gerrit sites.
Use injectHtmlPlugin
rule or use redirect
rule if its an existing html plugin.
For single-file js plugins, use injectJsPlugin
rule or use redirect
if its an exising js plugin.
For multi-file modularized js plugins (you have import / export in source code), you have two options:
injectJsModule
, this will load the js with type="module"
, and due to restriction of type="module"
, Gerrit won't be able to recognize the plugin without a proper url set when calling Gerrit.install
, so you also need to tweak your code to call Gerrit.install(callback, undefined, 'http://localhost:8081/plugins_/checks/gr-checks/gr-checks.js')
to let Gerrit treat it as a legit pluginhttp://localhost:8081/plugins_/checks/gr-checks/gr-checks.js
with type="module"
, and then treat it as a html pluginEither way, you need to block the existing plugin if its already on the page.
Please don't hesitate to contact taoalpha@google.com for support on this extension.