Skip to content

Conversation

@kabaros
Copy link
Contributor

@kabaros kabaros commented Jan 6, 2026

This PR updates the npm-create command used to scaffold a new DHIS2 web app to change the default template, and add more options and flexibility.

The changes fall into two categories:

  1. The new templates: right now, there are two templates but the same mechanism can be used to add more.
  2. The way scaffolding works under the hood

You can test these changes from alpha channel of the CLI with npm create @dhis2/app@alpha

The new templates

This PR updates the default template that is provided out of the box to give a starting point that is more helpful, and less basic, than the previous version. These templates (and the defaults) are a result of conversations with the Dev Champions, and own experience of the amount of work we seem to have to do with the previous default templates to get them to a reaonsable working state.

The defaults aim to give a better starting point without being too opinionated, but also be pragmatic and use the template as a way to promote the rest of our app-platform eco-system - it's a lot of unnecessary work to get basics like the UI library and runtime query figured out right now.

Default template

The default template now shows:

  1. A list of data elements - the most basic action any new project would do is to list some metadata. Doing that is not intuitive enough in our stack, and providing one example of such an operation seems like a good place to start.
  2. Links to the documentation for the platform and UI library.
image

Like before, it allows choosing a package manager pnpm (default), npm or yarn, and a choice between TypeScript (default) and JavaScript.

In addition, it uses some of the features of the platform by default:

  • Installs and uses @dhis2/ui library to display the list of data elements
  • It sets up prettier, and eslint (and uses the shared configs for DHIS2)
  • It extends vite config, and configures @ aliases.

Secondary template (with react-router)

In addition to the basic template, there is an additional template with React Router.

image

Changes to how it works

ToDO.. add more details

The PR also changes how things work under the hood - this is less important imo, and I am happy to change it back if we still see a value in keeping and updating d2 app script init for example. These are the changes :

  1. Decouple from app script init - the logic to scaffold was moved to the npm-create CLI directly. This seems to me just another unnecessary level of indirection - we can keep app script init for backwards compatibility, but it's much simpler to have the scaffolding logic, and easier to work with, directly in the module now responsible for scaffolding new apps.
  2. The templates themselves live in the file system then some transformations are done on them (for package managers other than pnpm, and to convert to JS)
  3. Having typescript as the default (then using tsc to generate JavaScript from it)

dhis2-bot and others added 2 commits January 6, 2026 22:38
# [5.3.0-alpha.3](v5.3.0-alpha.2...v5.3.0-alpha.3) (2026-01-06)

### Bug Fixes

* use templates from file system not zip ([e5ce2c4](e5ce2c4))
as it can be inferred from command run
# [5.3.0-alpha.4](v5.3.0-alpha.3...v5.3.0-alpha.4) (2026-01-06)

### Bug Fixes

* drop package manager question ([9bf5926](9bf5926))
Copy link
Contributor

@KaiVandivier KaiVandivier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! 🙌 A couple comments and suggestions in here, but I'll approve so you can merge when ready

In addition to the other comments:

  1. I noticed .gitignore isn't ending up in the scaffolded apps for some reason 🤔
  2. Are you interested in updating cli-app-scripts, ui, and app-runtime to the latest versions once bootstrapped? Or waiting until cli-app-scripts is off alpha?

@kabaros kabaros marked this pull request as ready for review January 7, 2026 06:45
# [5.3.0-alpha.5](v5.3.0-alpha.4...v5.3.0-alpha.5) (2026-01-07)

### Bug Fixes

* skip language and template questions when args provided ([7a2b5cf](7a2b5cf))
@kabaros
Copy link
Contributor Author

kabaros commented Jan 7, 2026

I noticed .gitignore isn't ending up in the scaffolded apps for some reason 🤔

I could not reproduce this - it seems to copy .gitignore fine for me, does it ignore all dot files in your case? (i.e. .eslint)

Are you interested in updating cli-app-scripts, ui, and app-runtime to the latest versions once bootstrapped? Or waiting until cli-app-scripts is off alpha?

I will update cli-app-scripts once it's off alpha - I had a last step to ugprade to latest, but got rid of it and I thought to keep the updates manual for now. It's easy enough since it's not a zip file now, and there is a chance some of the dependencies are broken. Maybe I can add some tests/sanity checks at some point, and then we'd have more confidence bumping dependencies?

# [5.3.0-alpha.6](v5.3.0-alpha.5...v5.3.0-alpha.6) (2026-01-07)

### Bug Fixes

* update yarn and npm lock files ([d9f5d0b](d9f5d0b))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 5.3.0-alpha.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

kabaros and others added 2 commits January 7, 2026 10:10
# [5.3.0-alpha.7](v5.3.0-alpha.6...v5.3.0-alpha.7) (2026-01-07)

### Bug Fixes

* fix the pnpm semantic-release step ([3656df4](3656df4))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 5.3.0-alpha.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

kabaros and others added 2 commits January 7, 2026 11:16
# [5.3.0-alpha.8](v5.3.0-alpha.7...v5.3.0-alpha.8) (2026-01-07)

### Bug Fixes

* ensure gitignore is part of the scaffolded template ([212544b](212544b))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 5.3.0-alpha.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kabaros
Copy link
Contributor Author

kabaros commented Jan 7, 2026

never mind @kai - managed to reproduce the issue with gitignore

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@kabaros kabaros merged commit 8abeed6 into master Jan 7, 2026
7 checks passed
@kabaros kabaros deleted the alpha branch January 7, 2026 12:34
dhis2-bot added a commit that referenced this pull request Jan 7, 2026
# [5.3.0](v5.2.1...v5.3.0) (2026-01-07)

### Bug Fixes

* rerun pipeline ([3e79615](3e79615))

### Features

* add new templates and options to @dhis2/create-app ([#635](#635)) ([8abeed6](8abeed6))
@dhis2-bot
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants