Skip to content

Commit

Permalink
fix: compat with mecha.contrib.json_files when it comes before bolt
Browse files Browse the repository at this point in the history
  • Loading branch information
vberlier committed Dec 31, 2023
1 parent cbb5400 commit 430d488
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bolt/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def __call__(self, stream: TokenStream) -> Any:

self.macro_handler.cache_local_spec(stream)

if isinstance(node, AstRoot) and not isinstance(current, Function):
if type(node) is AstRoot and not isinstance(current, Function):
node = set_location(AstNonFunctionRoot(commands=node.commands), node)

return node
Expand Down
7 changes: 7 additions & 0 deletions examples/bolt_json/beet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require:
- mecha.contrib.json_files
- bolt
data_pack:
load: "src"
pipeline:
- mecha
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = demo:foo

{
"values": [name]
}

function name:
say hello
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include = ["bolt/py.typed"]
[tool.poetry.dependencies]
python = "^3.10"
beet = ">=0.100.0"
mecha = ">=0.85.1"
mecha = ">=0.86.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
Expand Down
34 changes: 34 additions & 0 deletions tests/snapshots/examples__build_bolt_json__0.pack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Lectern snapshot

## Data pack

`@data_pack pack.mcmeta`

```json
{
"pack": {
"pack_format": 26,
"description": ""
}
}
```

### minecraft

`@function_tag minecraft:load`

```json
{
"values": [
"demo:foo"
]
}
```

### demo

`@function demo:foo`

```mcfunction
say hello
```

0 comments on commit 430d488

Please sign in to comment.