collective / volto-hydra

A volto addon to let you edit content in realtime when you have many frontends written in any framework
0 stars 2 forks source link

Add "examples" directory for example frontends #73

Closed MAX-786 closed 2 weeks ago

MAX-786 commented 2 weeks ago

updated example frontend readme for instructions.

JeffersonBledsoe commented 2 weeks ago

@MAX-786 You need to remove the @utils/hydra file, add - 'examples/*' to the pnpm-workspace file and update all the imports of @utils/hydra to be import { initBridge, onEditChange } from '@volto-hydra/hydra-js';

JeffersonBledsoe commented 2 weeks ago

One other thing I added in #74 that should also be added here are some simple Makefile commands and an npm script to start the admin UI with the default URL set to the URL of the example frontend and a command to start the example frontend without having to know anything about it. E.g:

## Examples
.PHONY: example-astro-admin
example-astro-admin:
    RAZZLE_DEFAULT_IFRAME_URL=http://localhost:4321 pnpm start

.PHONY: example-astro-frontend
example-astro-frontend: ## Starts Volto, allowing reloading of the add-on during development
    pnpm example:astro

Then in package.json:

"example:astro": "pnpm --filter hydra-astro run dev"
MAX-786 commented 2 weeks ago

@JeffersonBledsoe Updated as per requested and also updated the readme for the instructions!

djay commented 2 weeks ago

@MAX-786 I notice the hydra.js is checked intot he example which is probably shouldn't be right?

MAX-786 commented 2 weeks ago

Oh thanks!! I'll remove it from the example folder, Just a little thing, what might be the better way to do it, a separate PR or just restore this branch add that commit and merge again?