reviewboard.extensions.packaging¶
Packaging support for Review Board extensions.
- class RBStaticMediaBuildContext(*, package_id: str, css_bundles: CSSBundleConfigs, js_bundles: JSBundleConfigs, source_root_dir: Path, static_dir: Path, build_dir: Optional[Path] = None)[source]¶
Bases:
StaticMediaBuildContext
Context for performing a static media build for an extension.
This will set up some default NPM workspace paths needed for building Review Board extensions.
New in version 7.0.
- get_npm_workspace_dirs() NPMWorkspaceDirs [source]¶
Return NPM workspace directories and symlinks to set up.
Subclasses can override this to return additional workspaces to include. The parent class should always be called and the results included.
- Returns:
A mapping of symlink names to target locations.
- Return type:
- get_lessc_global_vars() LessCSSVariables [source]¶
Return a dictionary of LessCSS global variables and their values.
Subclasses can override this to return custom variables.
The contents in here are considered deprecated, and should generally not be used for any production extensions.
- Returns:
A dictionary mapping variable names to values.
- Return type:
- __annotations__ = {}¶
- class RBStaticMediaBuilder(*, build_context: StaticMediaBuildContext)[source]¶
Bases:
StaticMediaBuilder
Static media builder for Review Board extensions.
This will take care of building static media files. As part of this, it will set up Babel, Rollup, and TypeScript configuration files needed to compile against Review Board JavaScript/TypeScript modules.
New in version 7.0.
- ensure_build_files() None [source]¶
Set up the build tree and configuration files.
This will set up the NPM workspaces and a starting
package.json
file that can be used to manage the build.If there are any changes to the
package.json
in the tree, they will be reported to the user.
- __annotations__ = {}¶
- class BuildStaticFiles(dist, **kw)[source]¶
Bases:
BuildStaticFiles
Builds static files for the extension.
This will build the static media files used by the extension. JavaScript bundles will be minified and versioned. CSS bundles will be processed through LessCSS (if using
.less
files), minified and versioned.- extension_entrypoint_group: Optional[str] = 'reviewboard.extensions'[source]¶
The packaging entry point group name that extensions register into.
This must be provided by subclasses.
- django_settings_module: Optional[str] = 'reviewboard.settings'[source]¶
The Python module path for the project’s settings.
This must be provided by subclasses.
- static_media_builder_cls[source]¶
alias of
RBStaticMediaBuilder
- static_media_build_context_cls[source]¶
alias of
RBStaticMediaBuildContext
- __annotations__ = {'_builder': 'StaticMediaBuilder', 'django_settings_module': 'Optional[str]', 'extension_entrypoint_group': 'Optional[str]', 'static_media_build_context_cls': 'Optional[type[StaticMediaBuildContext]]', 'static_media_builder_cls': 'Optional[type[StaticMediaBuilder]]'}¶