Repository navigation
Conversation
Add `--template plugin` with a `--pluginType` option (form-field, enrollment, bulk-data-entry, dashboard). The plugin template is a shared TypeScript base plus a per-type overlay containing d2.config.js, Plugin.tsx, typed host props (taken from the Capture and Dashboard app source) and an App.tsx harness that renders the plugin with mocked props. pluginType values follow a CAPTURE_<KIND> convention for Capture plugins and DASHBOARD for dashboard plugins. Passing --pluginType alone implies --template plugin; an interactive prompt asks for the type otherwise. Also delete .ts files (not only .tsx) when converting a template to JS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… prettier check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The templates are built with Vite, and "moduleResolution": "node" ignores package "exports", so subpath entry points such as @dhis2/app-runtime/experimental could not be resolved by tsc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 1, 2026
Draft
Draft
Merged
…ATA_ENTRY Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kabaros
marked this pull request as ready for review
December 3, 2026 12:09
There is no default plugin type any more. Interactive runs prompt for it (with nothing preselected), and --template plugin --yes without --pluginType exits with an error listing the valid types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Why
There's no starter for DHIS2 plugins. Developers copy a reference repo and wire up
entryPoints.pluginandpluginTypeby hand, and the prop types they copy often don't match what Capture or the Dashboard actually passes.Changes
New
plugintemplate with--pluginType--pluginTypepluginTypein d2.configform-fieldCAPTURE_FORM_FIELDenrollmentCAPTURE_ENROLLMENTbulk-data-entryTRACKER_BULK_DATA_ENTRYdashboardDASHBOARDtemplates/template-ts-plugin), plus an overlay for each type (templates/plugin-types/<type>). Each overlay has:d2.config.jswith bothappandpluginentry points.Plugin.tsxbuilt with@dhis2/ui.src/types/plugin.ts, with the host props typed from the Capture and Dashboard app source (not from the docs, which are out of date in places).App.tsxharness that renders the plugin with mocked props and stateful callbacks, so you can develop it withpnpm startwithout a host.--pluginTypeon its own implies--template plugin. Using it with another template is an error. Interactive mode asks "Which kind of plugin?", and--template plugin --yeswithout--pluginTypeexits with an error listing the valid types.pluginTypevalues follow a naming convention (table above). Capture doesn't read the value. The Dashboard only lists plugins whose type isDASHBOARD(or unset)..tsfiles as well as.tsx.All TypeScript templates now use
"moduleResolution": "bundler". They're built with Vite, andnoderesolution ignores packageexports. (dhis2/app-runtime#1448 also fixes this on the runtime side.)Docs:
docs/commands/create-app.mdand the package README.Testing
tests/plugin-templates.jscover option resolution and check that every overlay has its required files.tsc --noEmit, lint,pnpm buildandpnpm testpass, and the built manifest containsplugin_type.--jsplugin scaffold builds.bundler.Related PRs
Part of a set that makes DHIS2 plugins (Capture form field / enrollment / bulk data entry, Dashboard) easier to build, and brings the docs in line with what the host apps actually pass:
<Plugin>custom props,experimentaltypes undernoderesolution@/aliases and@dhis2/app-runtime/experimentalpnpm create @dhis2/app --template plugin --pluginType <type>dhis2-pluginsagent skill🤖 Generated with Claude Code