Skip to content

Commit

Permalink
chore: Add release packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericof committed Oct 8, 2021
1 parent 3ec6886 commit 1650e4b
Show file tree
Hide file tree
Showing 8 changed files with 2,314 additions and 55 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test code base
name: Code analysis checks
on: [push]
jobs:
build:
Expand Down Expand Up @@ -39,7 +39,3 @@ jobs:
# Validate code prettier
- name: Code prettier
run: yarn prettier

# Unit tests
- name: Unit tests
run: yarn test
37 changes: 37 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Unit tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: Main checkout
uses: actions/checkout@v2

# node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# node cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# node install
- name: Install dependencies
run: yarn install --frozen-lockfile

# Unit tests
- name: Unit tests
run: yarn test
37 changes: 37 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"npm": {
"publish": true
},
"git": {
"commitMessage": "chore: release v${version}"
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"infile": "CHANGELOG.md",
"preset": {
"name": "conventionalcommits",
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "refactor",
"section": "Changes"
},
{
"type": "chore",
"section": "Maintenance"
}
]
}
}
}
}
Empty file added CHANGELOG.md
Empty file.
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
# Blocks Conversion Tool

A tool to convert HTML (as used in Plone Classic) to Blocks (as used on Volto)
[![NPM](https://img.shields.io/npm/v/@plone/blocks-conversion-tool.svg)](https://www.npmjs.com/package/@plone/blocks-conversion-tool)
[![Code analysis checks](https://github.com/plone/blocks-conversion-tool/actions/workflows/code.yml/badge.svg)](https://github.com/plone/blocks-conversion-tool/actions/workflows/code.yml)
[![Unit tests](https://github.com/plone/blocks-conversion-tool/actions/workflows/unit.yml/badge.svg)](https://github.com/plone/blocks-conversion-tool/actions/workflows/unit.yml)

## Introduction

This package implements a server with a simple API to convert HTML (as used in Plone Classic) to Blocks (as used on Volto).

## Starting the server

### From source

```shell
git clone https://github.com/plone/blocks-conversion-tool.git
cd blocks-conversion-tool
yarn install
yarn start
```

### With Docker

```shell
docker run -it -p 5000:5000 plone/blocks-conversion-tool:latest
```

## Usage

## HTML to Blocks (Slate)

[Slate](https://github.com/eea/volto-slate) is going to be the default text block for Plone 6, to convert HTML to an array of blocks call the service passing the HTML as shown below:

```shell
curl -i -X POST http://localhost:5000/html -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"html": "<p>Hello world!</p>"}'
```

## HTML to Blocks (DraftJS)

Draft-JS is the legacy default text block used in Volto.

```shell
curl -i -X POST http://localhost:5000/html -H "Accept: application/json" -H "Content-Type: application/json" --data-raw '{"html": "<p>Hello world!</p>", "converter": "draftjs"}'
```
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"slate-hyperscript": "^0.66.0"
},
"devDependencies": {
"@commitlint/cli": "^13.2.0",
"@commitlint/config-conventional": "^13.2.0",
"@release-it/conventional-changelog": "^3.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "^2.24.2",
Expand All @@ -48,6 +51,7 @@
"eslint-plugin-promise": "^5.1.0",
"jest": "^27.2.4",
"prettier": "^2.4.1",
"release-it": "^14.11.6",
"supertest": "^6.1.6"
},
"prettier": {
Expand Down
Loading

0 comments on commit 1650e4b

Please sign in to comment.