feat: add new templates and options to @dhis2/create-app #634
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.




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:
You can test these changes from alpha channel of the CLI with
npm create @dhis2/app@alphaThe 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:
Like before, it allows choosing a package manager
pnpm(default),npmoryarn, and a choice betweenTypeScript(default) andJavaScript.In addition, it uses some of the features of the platform by default:
@aliases.Secondary template (with react-router)
In addition to the basic template, there is an additional template with React Router.
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 initfor example. These are the changes :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 keepapp script initfor 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.git archive(more info to follow)