Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaspiterek committed Jan 8, 2024
1 parent 351ec8b commit 1c6964a
Showing 1 changed file with 33 additions and 117 deletions.
150 changes: 33 additions & 117 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,150 +1,66 @@
# @kitconcept/volto-quote-block

## Introduction
[![NPM](https://img.shields.io/npm/v/@kitconcept/volto-quote-block.svg)](https://www.npmjs.com/package/@kitconcept/volto-quote-block)
[![Build Status](https://github.com/kitconcept/volto-quote-block/actions/workflows/code.yml/badge.svg)](https://github.com/kitconcept/volto-quote-block/actions)
[![Build Status](https://github.com/kitconcept/volto-quote-block/actions/workflows/unit.yml/badge.svg)](https://github.com/kitconcept/volto-quote-block/actions)
[![Build Status](https://github.com/kitconcept/volto-quote-block/actions/workflows/acceptance.yml/badge.svg)](https://github.com/kitconcept/volto-quote-block/actions)

## Development
<img alt="kitconcept GmbH" width="200px" src="https://kitconcept.com/logo.svg">

You can develop an add-on in isolation using the boilerplate already provided by the add-on generator.
The project is configured to have the current add-on installed and ready to work with.
This is useful to bootstrap an isolated environment that can be used to quickly develop the add-on or for demo purposes.
It's also useful when testing an add-on in a CI environment.
The Volto Quote Block allows editors to add a quote to a Volto page.

```{note}
It's quite similar when you develop a Plone backend add-on in the Python side, and embed a ready to use Plone build (using buildout or pip) in order to develop and test the package.
```

The dockerized approach performs all these actions in a custom built docker environment:

1. Generates a vanilla project using the official Volto Yo Generator (@plone/generator-volto)
2. Configures it to use the add-on with the name stated in the `package.json`
3. Links the root of the add-on inside the created project

After that you can use the inner dockerized project, and run any standard Volto command for linting, acceptance test or unit tests using Makefile commands provided for your convenience.

### Setup the environment
## Installation

Run once
Create a new Volto project (you can skip this step if you already have one):

```shell
make dev
```

which will build and launch the backend and frontend containers.
There's no need to build them again after doing it the first time unless something has changed from the container setup.

In order to make the local IDE play well with this setup, is it required to run once `yarn` to install locally the required packages (ESlint, Prettier, Stylelint).

Run

```shell
yarn
npm install -g yo @plone/generator-volto
yo @plone/volto my-volto-project --addon @kitconcept/volto-quote-block
cd my-volto-project
```

### Build the containers manually

Run
Add `@kitconcept/volto-quote-block`to your package.json:

```shell
make build-backend
make build-addon
```
"addons": [
"@kitconcept/volto-quote-block"
],
### Run the containers

Run

```shell
make start-dev
"dependencies": {
"@kitconcept/volto-quote-block": "*"
}
```

This will start both the frontend and backend containers.

### Stop Backend (Docker)

After developing, in order to stop the running backend, don't forget to run:

Run
Download and install the new add-on by running:

```shell
make stop-backend
```

### Linting

Run

```shell
make lint
yarn install
```

### Formatting
Start Volto with:

Run

```shell
make format
```

### i18n

Run

```shell
make i18n
```

### Unit tests

Run

```shell
make test
yarn start
```

### Acceptance tests

Run once
Go to http://localhost:3000, login, create a new page. The quote block will show up in the Volto blocks chooser.

```shell
make install-acceptance
```
## Block configuration

For starting the servers
#### `showImageField`

Run
This option will enable an image and an alignment widget in the block settings, allowing you to add an image to your quote block and align it, left, right and centered to the quote. By default this option is set to `true`.

```shell
make start-test-acceptance-server
```js
config.blocks.blocksConfig.heading.showImageField = true;
```

The frontend is run in dev mode, so development while writing tests is possible.
## Credits

Run

```shell
make test-acceptance
```
<img alt="Deutsches Zentrum für Luft- und Raumfahrt (DLR)" width="200px" src="https://www.dlr.de/static/media/Logo-de.697a8e1f.svg" style="background-color:white">

To run Cypress tests afterwards.
The development of this plugin has been kindly sponsored by [Deutsches Zentrum für Luft- und Raumfahrt (DLR)](https://dlr.de/de).

When finished, don't forget to shutdown the backend server.
# License

```shell
make stop-test-acceptance-server
```

### Release

Run

```shell
make release
```

For releasing a RC version

Run

```shell
make release-rc
```
The project is licensed under the MIT license.

0 comments on commit 1c6964a

Please sign in to comment.