storyblok / field-plugin

Create and deploy Storyblok Field Plugin
https://www.storyblok.com/docs/plugins/field-plugins/introduction
25 stars 3 forks source link

feat(common): pass manifest json to sandbox #273

Closed demetriusfeijoo closed 11 months ago

demetriusfeijoo commented 12 months ago

What?

It allows the Sandbox/Container to bootstrap options from a manifest file located within a field-plugin root folder.

Why?

JIRA: EXT-1877

see the RFC

When our Vite printDev plugin finds the manifest file: Screenshot 2023-09-18 at 08 49 36

When our Vite printDev plugin doesn't find the manifest file: Screenshot 2023-09-18 at 08 52 17

When our Vite printDev plugin finds the manifest file but it's not valid: Screenshot 2023-09-18 at 08 58 45

How to test? (optional)

From the root folder of this repository, run:

  1. yarn dev:container
  2. yarn dev:react
  3. Open Sandbox

It should load the options automatically (from the manifest file) like below: image

If you want to change the manifest options locally, edit this file here React Manifest

vercel[bot] commented 12 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
plugin-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 22, 2023 10:15am
BibiSebi commented 12 months ago

Side note: just randomly found this library that is even used by prettier https://github.com/cosmiconfig/cosmiconfig that helps loading configurations. Maybe we can check it out

eunjae-lee commented 12 months ago

Side note: just randomly found this library that is even used by prettier https://github.com/cosmiconfig/cosmiconfig that helps loading configurations. Maybe we can check it out

Interesting. It's similar to https://github.com/unjs/c12

I guess those packages are specifically useful when we want to support different types of configs (e.g. an object within package.json, something.json, something.js, something.ts, ...)

demetriusfeijoo commented 12 months ago

Side note: just randomly found this library that is even used by prettier https://github.com/cosmiconfig/cosmiconfig that helps loading configurations. Maybe we can check it out

Thanks for sharing @BibiSebi. I'm going to read about it and make some tests here. 🙌

eunjae-lee commented 11 months ago

ping me here when you're ready for another review :)

demetriusfeijoo commented 11 months ago

It's ready for another review round @eunjae-lee. 🙌

demetriusfeijoo commented 11 months ago

Thanks for the effort in reviewing it @eunjae-lee.

I've created a task for adding the tests, thanks for pointing it out. 🙌