commit | dc0c4076efcce19f99e69d990b6d7d76f5dba5eb | [log] [tgz] |
---|---|---|
author | Ben Rohlfs <brohlfs@google.com> | Wed Nov 29 09:22:38 2023 +0100 |
committer | Ben Rohlfs <brohlfs@google.com> | Mon Dec 04 10:12:19 2023 +0100 |
tree | ecab0607b1fbdbd7a60f1fe6465de23ef22588ba | |
parent | dae934460d06d88ede4db94681387ac194a393e2 [diff] |
Add prettier config and reformat all files We are using this file as a template as we do for main Gerrit: https://github.com/google/gts/blob/main/.prettierrc.json Change-Id: I8c61ebf209f998943fbf0e2df13b9d38a4e5a934
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, Tao Zhou created this Chrome extension. It proxies all assets requests or any requests to a local HTTP server, and has the ability to inject any plugins exposed by the local HTTP server.
See in release notes and Features below.
The easiest is to install from the Chrome web store here: https://chrome.google.com/webstore/detail/gerrit-fe-dev-helper/jimgomcnodkialnpmienbomamgomglkd.
After you have installed and enabled the extension, you should see something similar to demo.png.
To build from source:
npm install npm run build
Then you should have gerrit_fe_dev_helper.zip
that you can test with.
yarn start
Or if you are developing a plugin, serve your plugin via a local HTTP server via any means.
Example:
npx http-server -c-1 --cors
Gerrit dev helper is enabled
, and now your Gerrit assets should be loaded from your local HTTP serverThe extension comes with a set of default rules, but you can change the rules by clicking the extension icon again.
The extension supports six different type of rules:
The two options to inject any plugins (injectJsPlugin
and injectHtmlPlugin
) are meant to help you develop your plugins for your Gerrit sites. As they are served from your local HTTP server, you do not need to deploy them on the target Gerrit server.
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.
npm run build
.Developer Mode
.Load Unpacked
.dist
directory.As a Google developer you will have to add a key
to the manifest.json
in the dist/
directory as documented here: http://go/extension-identification#i%E2%80%99m-developing-a-chrome-extension-on-my-computer
This section is for members of Google's developer team only.
manifest.json
and package.json
.npm run build
.Upload dogfood version
button.Upload new package
button.Please don't hesitate to contact dhruvsri@google.com for support on this extension.