new crafter.build structure

This commit is contained in:
Jorijn van der Graaf 2025-11-09 20:11:22 +01:00
commit e35b7302cb
22 changed files with 83 additions and 109 deletions

View file

@ -0,0 +1,12 @@
![alt text](https://github.com/Catcrafts/Crafter.Web/blob/master/samples/HelloWorld/HelloWorld.png?raw=true)
This sample demonstrates how to use the element class
```bash
crafter-build build executable
run.sh
```
and go to `http://localhost:8080/`
if caddy is not installed you can use your favorite static file server instead

View file

@ -0,0 +1,8 @@
import Crafter.CppDOM;
using namespace Crafter::CppDOM;
int main(){
HtmlElement body("body");
body.SetInnerHTML("Hello World!");
//No need to call FreeJs, this is done in the destructor of HtmlElement.
}

View file

@ -0,0 +1,17 @@
{
"name": "main",
"configurations": [
{
"name": "executable",
"implementations": ["main"],
"target": "wasm32-wasi",
"debug" : true,
"dependencies": [
{
"path":"../../project.json",
"configuration":"lib-debug"
}
]
}
]
}

1
examples/HelloElement/run.sh Executable file
View file

@ -0,0 +1 @@
caddy file-server --listen :8080 --root bin/executable

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -0,0 +1,12 @@
![alt text](https://github.com/Catcrafts/Crafter.Web/blob/master/samples/HelloWorld/HelloWorld.png?raw=true)
This sample demonstrates a simple hello world.
```bash
crafter-build build executable
run.sh
```
and go to `http://localhost:8080/`
if caddy is not installed you can use your favorite static file server instead

View file

@ -0,0 +1,8 @@
import Crafter.CppDOM;
using namespace Crafter::CppDOM::Bindings;
int main(){
void* body = GetElementById("body");
SetInnerHTML(body, "Hello World!");
FreeJs(body);
}

View file

@ -0,0 +1,17 @@
{
"name": "main",
"configurations": [
{
"name": "example",
"implementations": ["main"],
"target": "wasm32-wasi",
"debug" : true,
"dependencies": [
{
"path":"../../project.json",
"configuration":"lib-debug"
}
]
}
]
}

View file

@ -0,0 +1 @@
caddy file-server --listen :8080 --root bin/executable