The ui directory contains the pages and public assets of a NextJs project. NextJs is an all-in-one framework to develop, preview and deploy UI using react. SOMOD adds reusability and sharing features to NextJs.
The pages in SOMOD are similar to NextJs's pages. SOMOD pages always have a .tsx extension.
The pages in NextJs allow the developer to write data fetching and UI components in the same file. But in SOMOD, data fetching is separated under the pages-data directory. A pages-data file must have a corresponding page under the pages directory.
The public directory in SOMOD is similar to NextJs's public directory
config.yaml defines a set of configurations this module needs. The config.yaml is explained in detail in its dedicated reference here.
The build command copies the files in ui/public to build/ui/public.
ui/config.yaml is validated and converted into build/ui/config.json during the build.
SOMOD prepare command generates pages, public, .env, and next.config.js by combining all dependency modules.
The namespace helps to resolve the conflicts when there is a page with the same name that exists in more than one dependency module.
The next.config.somod.js file in the project root extends the prepared next.config.js. The developer needs to create next.config.somod.js following the same structure as NextJs's configuration file. The prepared next.config.js includes configuration from next.config.somod.js if present. This file can not be shared and only works in the project root of the current module.
In the next section, let's explore the structure of config.yaml.