Setup HTML test environment
Closed this issue · 0 comments
TimDaub commented
Scope
- To preview the functionality of our preact component, we have to render it in e.g. a browser
- But since preact-nominal-allocator is supposed to be later installable with
npm install preact-nominal-allocator
, we don't want to ship this testing environment in the npm package - Hence, we set it aside in a folder called
scripts
and allow the component maintainer to call it using an npm script calleddev
Deliverables
- Create a folder
scripts
and add a valid index.html file - When calling
npm run dev
, output the bundled file from esbuild todist
, then load it as a<script>
in index.html and also start to run an HTTP server that serves the./scripts/index.html
file on e.g. port 5000 - Make sure that for preact to execute, when you go to localhost:5000, that it's instantiated and takes over a DOM node
render(html
<${NominalAllocator} name="World" />, document.body);
But keep this logic separated from the component logic in source.
Time estimate
2 - 4h