Folder Structure
In order to separate the source code, unit tests, documentation, the following folder structure is used:
.
├─ .github
│ └─ workflows
│ ├─ publish-github-packahes.yml
│ └─ publish-github-pages.yml
├─ docs
│ └─ .vitepress
│ │ ├─ theme
│ │ │ ├─ index.js
│ │ │ └─ style.css
│ │ └─ config.mjs
│ ├─ public
│ │ └─ assets
│ │ └─ logos
│ ├─ about.md
│ ├─ ...
│ └─ vitepless-examples.md
├─ src
│ ├─ greeter.mjs
│ └─ mathematics.cjs
├─ test
│ ├─ greeter.test.js
│ └─ mathematics.test.js
├─ .gitignore
├─ .npmrc
├─ babel.config.json
├─ package.json
├─ package-lock.json
└─ README.md.github/workflows Folder
The .github/workflows folder contains workflows for building and publishing the content of the docs folder to GitHub Pages and publishing package to GitHub Packages.
docs Folder
The docs folder contains project documentation, both development and end-user. This is also the source for the GitHub Pages site.
src Folder
For this package the source code is placed into /src folder. The reason for that is to provide logical separation between the busibess functionality of the package and development infrastructure like testing and documentation.
However...
Other projects, especially built with CAP may (and even should) not use /src folder for the source code. Instead, you place the source code directly in the root folder of the repository.
src/greeter.mjs File
The src/greeter.mjs file contains the Greeter Node.js module in ES (ECMAScript) format. The .mjs extension is used to explicitly specify ES module format.
src/mathematics.cjs File
The src/mathematics.cjs file contains the Mathematics Node.js module in CommonJS format. The .cjs extension is used to explicitly specify CommonJS module format.
test Folder
The test folder contains scripts for testing Greeter and Mathematics modules.
package.json File
packaje.json is Node.js the package definition file. See also npm Docs for more information about package.json file structure.
README.md File
The README.md file contains brief information for developers and end-users. It may be used instead of project documentation for small or utility projects. For larger projects use GitHub Pages.