Add integration tests & misc improvements
This PR is huge (wayy to big - I should have split it). It adds several improvements to Sandstone.
## New formatter
I removed ESLint + Prettier in favor of [BiomeJS](https://biomejs.dev/). It's much faster, handles all rules gracefully, and sorts imports.
## Integration tests
This PR adds a new integration tests framework for Sandstone, that allows us to compare the actual & expected results of Sandstone commands.
The following tests are currently implemented:
* All commands are tested, as well as most of their subcommands - it's likely some have been missed
* If/Else If/Else commands are tested
* Score operations are tested
## Relative MCFunction names
MCFunctions can now have a "relative" name, if their name starts with `./`:
```ts
MCFunction('test', () => {
// ⬇️ will be named default:test/foo
MCFunction('./foo', () => ...)
// especially useful in execute.run
execute.as('@a').run('./callback', () => ...)
// ⬆️ will be named default:test/callback
})
```
## _.if conditions
This re-implements the previously existing `_.` conditions: `_.block`, `_.blocks`, `_.biome`, `_.dimension`...
## Improved commands JSDoc with examples
This PR adds documentation with real-life examples for all commands. This should hopefully help people get the hang of how all commands work.
## More exports
This adds several missing exports to the top `sandstone` export (missing commands, some useful arguments)
## Lazy MCMetaCache & Smithed
`MCMetaCache` & `Smithed` properties of `SandstoneCore` were doing HTTP calls, which should not IMO happen on a pure build process. The previous getters have been transformed to cached functions - the HTTP calls will only happen if the user explicitly calls them.
## Removed: namespaced objectives
Objectives were forcefully namespaced, a decision I understand but disagree with. IMO we should add a 3d argument to `Objective.create` (& a 2nd to `Objective.get`) to enable/disable namespacing.
In the meantime, I removed this feature.
## Bug fixes
This PR fixes a lot of bugs:
* within some subcommands (discovered with the tests)
* nested ifs not working
* `_.or` did not work when created outside a MCFunction => this was solved by introducing a dedicated `Visitor`
合并状态:已合并 合并于 2025-08-17 关闭于 2025-08-17 0 条评论