Files
graylog2-server/graylog2-web-interface/packages/graylog-web-plugin
Dennis Oelkers f95f2a9be4 Improve build stability of graylog-web-plugin module. (#10100)
In recent weeks, we have seen build instabilities for the
`graylog-web-plugin` module, where the build contains an empty `lib`
directory, no files from the `src` dir were transpiled, but `yarn
install` succeeded.

The causes for this were:

- The `preinstall` task erroneously catching build errors (the `||`
  clause was meant to suppress build errors when no `src` dir is
present, which should not happen anymore)

- Installing inconsistent `babel` dependencies. `@babel/preset-env` was
  pinned to a specific version, while others had wider version
specifiers. This lead to situations where incompatible versions were
installed.

To address these issues, this change is:

1.) Preventing silent build errors in `graylog-web-plugin` by to
  improving the `preinstall` task
2.) Pinning `babel` dependencies to constant, consistent versions
2021-02-19 14:07:53 +01:00
..
2020-11-16 18:41:59 +01:00
2020-11-16 18:41:59 +01:00
2020-11-16 18:41:59 +01:00

Graylog Web Plugin Archetype

This module is supposed to help with developing web interface plugins for Graylog. It provides classes which help generating a webpack configuration, defining the plugin manifest (metadata as well as entities which are provided to the web interface) as well as the PluginStore class which is used for registering plugins to make them accessible for the web interface.

This module is supposed to be used in conjunction with the maven archetype which can be found here and requires a checkout of the Graylog server repository in some place.

Installation

npm install --save graylog-web-plugin

Usage

$ npm init
[...]
$ npm --save-dev graylog-web-plugin

Create a file named build.config.js in your plugin directory, looking like this:

module.exports = {
  web_src_path: '<path to your Graylog git repository>',
};

and use a webpack.config.js like this:

const PluginWebpackConfig = require('graylog-web-plugin').PluginWebpackConfig;
const loadBuildConfig = require('graylog-web-plugin').loadBuildConfig;
const path = require('path');
const buildConfig = loadBuildConfig(path.resolve(__dirname, './build.config'));

module.exports = new PluginWebpackConfig('my.fully.qualified.plugin.classname', buildConfig, {
  // Here goes your additional webpack configuration.
});

The third (optional) parameter for the PluginWebpackConfig constructor is an object which is merged into the generated webpack config, so you can add/overwrite any part of the generated configuration.

Contributing

Feel free to contribute to this collection of helpers by forking the repository and submitting a pull request. Thanks!

Release a new version

$ npm version [<newversion> | major | minor | patch]
$ git push origin master && git push --tags
$ npm publish

Release History

  • 0.0.21 Add optimizations for production builds.
  • 0.0.20 Add plugin fqdn as prefix of built module.json.
  • 0.0.19 Add webpack config to compile typescript code in plugins.
  • 0.0.18 Removing now unneeded shared bundle.
  • 0.0.17 Bugfix, using absolute filename for build config.
  • 0.0.16 Adding build config file including option specifying location of Graylog server repo checkout.
  • 0.0.15 Bugfix, add missing import
  • 0.0.14 Add shared and vendor bundle to generated webpack config
  • 0.0.13 First actually usable version