Skip to content

Commit

Permalink
docs: add development documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
EvaMart committed Mar 7, 2024
1 parent 00cf15c commit 9203b04
Showing 1 changed file with 74 additions and 11 deletions.
85 changes: 74 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,82 @@ If you want to contribute to this project, please read the [contributing guideli

## Development

:construction: This section is under construction. :construction:
This project is built using [Vue.js](https://vuejs.org/). The components are written in [Vue](https://vuejs.org/) and the bundling is done using [Rollup](https://rollupjs.org/). The rollup configuration is in the `rollup.config.js` file and the main entry point is the `src/index.js` file, all the components are exported from this file.
The components are written in the `src/components` folder. Each component should be in a separate folder and should contain the `.vue` file and, optionally, a `.scss` file. In order to be used in other applications, the package should be built, which creates a `dist` folder with the compiled files.

### How to add a new component.
The documentation is built using [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). The content of the documentation is written in markdown and should be added to the `docs` folder.
The configuration of the documentation is in the `mkdocs.yml` file. This file contains the structure of the documentation, including navigation, the theme used, etc. More information about how to configure the documentation can be found in the [documentation](https://squidfunk.github.io/mkdocs-material/reference/).

- Files are relative to the package.
- How the built is configured.
- How to push to npm.
- How to install package locally for development.
### How to add a new component.

If you want to add a new component, you should create a new component for it. Follow the steps below:

### Documentation:
- How documentation is organised.
- How to serve documentation locally.
- GitHub Actions in place. When do they run?
- Create the new component in the `src/components` folder. A component can be written in only one file or, if it is complex, it can be divided into smaller components in a folder.
- Add the new component to the `index.js`, as following:

## Publishing
```js
import newComponent from './components/newComponent.vue'

export {
newComponent,
...
}
```

> :warning: If the new component is a complex component, it should be divided into smaller components. In this case, the `index.js` file should export the smaller components and the main component.

> :warning: The documentation should be updated to include the new component.

### How to document a new component.

To document a new component, add the new component to the documentation as a single file in the `docs/components` folder. Documentation is written in markdown and should contain at least the following sections:

- Description of how the data being represented.
- How to use it.
- Example of usage.
- Props and events.

### How to build the package locally.

To build the package locally, run:
```bash
npm run build
```
This will create a `dist` folder with the compiled files.
The component will be available for other applications running locally to use.
To use the component in another application, you should link the package locally. To do so, run:
```bash
npm link
```
Then, in the application where you want to use the component, run:
```bash
npm link @inb/oeb_visualizations
```
This will link the local package to the application.

### How to serve the documentation locally.

The documentation is built using [mkdocs](https://www.mkdocs.org/). To serve the documentation locally, run:
```bash
mkdocs serve
```
This will start a local server and the documentation will be available at `http://localhost:8000/`.


## Publishing

### Publishing a new version of the package to npm

To publish a new version of the package to [npm](https://www.npmjs.com), follow the steps below:

- Update the version in the `package.json` file. If all commit messages follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard, you can use the `cz bump --version-scheme semver` command to update the version and the `CHANGELOG.md` file.
- Run the `npm run build` command to build the package.
- Run the `npm publish` command to publish the package to npmjs.

This package is published under the `@inb` scope as `@inb/oeb_visualizations`.
The package is available at [https://www.npmjs.com/package/@inb/oeb_visualizations](https://www.npmjs.com/package/@inb/oeb_visualizations).

### Publishing the documentation

The documentation is built and deployed to the `gh-pages` branch using GitHub Actions. Each time a new commit is pushed to the `main` branch, the documentation is built and deployed to the `gh-pages` branch.
The documentation is available at [https://inab.github.io/oeb-visualizations/](https://inab.github.io/oeb-visualizations/).

0 comments on commit 9203b04

Please sign in to comment.