Skip to content

Commit eb810dc

Browse files
committed
Update docs, example harnesses and e2e tests for the new layout
The example run scripts and the e2e tests now look for generated code in plain_modules/<module>/code. The project-structure docs describe the per-module tree.
1 parent 6412bbf commit eb810dc

7 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎CLAUDE.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,12 @@ Two logging modes:
212212
### Code Generation Process
213213
- Templates in `standard_template_library/` use Liquid2 syntax
214214
- Template search order: (1) `.plain` file dir, (2) `--template-dir`, (3) built-in standard lib
215-
- Generated code written to `build/` (configurable via `--build-folder`)
216-
- Each FRID render produces a git commit in build folder for rollback capability
215+
- Each module renders into its own tree under the build folder (configurable via `--build-folder`, default `plain_modules/`):
216+
- `<build-folder>/<module>/code/` — implementation code (its own git repo)
217+
- `<build-folder>/<module>/tests/` — conformance tests (its own git repo; only created when a conformance tests script is configured)
218+
- `<build-folder>/<module>/.codeplain/` — module metadata (`module_metadata.json`), not tracked in git
219+
- `<build-folder>/<module>/.memory/` — conformance test memory, not tracked in git
220+
- Each FRID render produces a git commit in the `code/` and `tests/` repos for rollback capability
217221

218222
### Configuration
219223
- `config.yaml` can be placed in `.plain` file dir or CWD

‎docs/starting_a_plain_project_from_scratch.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ my-new-project/
2222
├── run_unittests_[language].sh # Unit test script
2323
├── run_conformance_tests_[language].sh # Conformance test script
2424
├── build/ # Generated final code
25-
├── plain_modules/ # Generated modules code
26-
└── conformance_tests/ # Generated conformanece tests code
25+
└── plain_modules/ # Generated modules
26+
└── my_app/ # One folder per module
27+
├── .codeplain/ # Module metadata
28+
├── .memory/ # Conformance test memory
29+
├── code/ # Generated code
30+
└── tests/ # Generated conformance tests
2731
```
2832

33+
The `tests/` folder is only created when a conformance test script is configured.
34+
2935
In this guide we will cover how to create each of these step by step.
3036

3137
## 1. Define Your .plain File

‎examples/example_hello_world_golang/run.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ if [ $? -ne 0 ]; then
2020
exit 1
2121
fi
2222

23-
cd plain_modules/hello_world_golang
23+
cd plain_modules/hello_world_golang/code
2424

2525
# We need to compile the tests so that we can execute them in the current folder
2626
# (https://stackoverflow.com/questions/23847003/golang-tests-and-working-directory/29541248#29541248)
27-
go test -c ../../harness_tests/hello_world_test.go
27+
go test -c ../../../harness_tests/hello_world_test.go
2828

2929
# Check if test compilation has failed for the hello world example
3030
if [ $? -ne 0 ]; then

‎examples/example_hello_world_python/run.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ if [ $? -ne 0 ]; then
77
exit 1
88
fi
99

10-
cd plain_modules/hello_world_python
10+
cd plain_modules/hello_world_python/code
1111

12-
python ../../harness_tests/hello_world_display/test_hello_world.py
12+
python ../../../harness_tests/hello_world_display/test_hello_world.py
1313

1414
# Check if the test harness has failed for the hello world example
1515
if [ $? -ne 0 ]; then

‎examples/example_hello_world_react/run.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ $? -ne 0 ]; then
2020
exit 1
2121
fi
2222

23-
../../test_scripts/run_conformance_tests_cypress.sh plain_modules/hello_world_react harness_tests/hello_world_display ${VERBOSE:+-v}
23+
../../test_scripts/run_conformance_tests_cypress.sh plain_modules/hello_world_react/code harness_tests/hello_world_display ${VERBOSE:+-v}
2424

2525
# Check if the test harness has failed for the hello world example
2626
if [ $? -ne 0 ]; then

‎tests/e2e/test_hello_world_python.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_render_and_run_hello_world_python(e2e_container, exec_in_container, cop
2828
)
2929
assert rc == 0, f"codeplain render failed (rc={rc}):\nstdout:\n{out}\nstderr:\n{err}"
3030

31-
generated = "build/hello_world_python/hello_world.py"
31+
generated = "build/hello_world_python/code/hello_world.py"
3232
rc, _, _ = exec_in_container(e2e_container, f"test -f {generated}")
3333
assert rc == 0, f"expected generated file at {generated} but it was not produced"
3434

‎tests/e2e/test_hello_world_python_windows.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_render_and_run_hello_world_python_windows(codeplain_exe: Path, api_key:
4949
f"codeplain render failed (rc={result.returncode}):\n" f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
5050
)
5151

52-
generated = tmp_path / "build" / "hello_world_python" / "hello_world.py"
52+
generated = tmp_path / "build" / "hello_world_python" / "code" / "hello_world.py"
5353
assert generated.exists(), f"expected generated file at {generated} but it was not produced"
5454

5555
result = subprocess.run(

0 commit comments

Comments
 (0)