Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With the advent of Vue 3 and composables, this structure does not make as much sense as it previously did, and we have introduced a feature-based “v2 structure”.

v2 structure

Supported in Totara 19+. tui.json must be in the correct location to enable support for the v2 structure (directly under the component folder, not inside src/).

...

The file structure is just a guide, but for consistency the structure described above should be followed unless there is a good reason not to.

In When it is only possible for a component that by its nature contains only to contain a single feature due to its plugin type, for example a perform element or a block, the feature subdirectory may should be omitted and its contents placed directly under src/. If it is possible for the component to contain multiple features, feature subdirectories should be used.

Migrating from v1 to v2

As there is currently no mechanism for handling file renames, it is suggested that existing code be left in place for now. New development within a component can happen in the v2 structure though. As long as the tui.json file is in the correct place (not inside src/), the v1 and v2 structures may coexist within the same Tui component.

New features should be built using the v2 structure.

v1 structure

Supported in Totara 13+.

Code Block
core_mfa/
    src/
        tui.json
        upgrade.txt
        components/
            factors/
                FactorChooser.vue
        pages/
            Verify.vue
        js/
          constants.js

...