44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
# Poiesis
|
|
|
|
## Overview
|
|
|
|
Go tool that transpiles TypeScript to JavaScript using esbuild API and executes it with goja.
|
|
|
|
## Build & Test
|
|
|
|
```bash
|
|
go build
|
|
go test
|
|
golangci-lint run
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
- `main.go` - Entry point with `executeTypeScript()` function
|
|
- `main_test.go` - Test suite using testify assertions
|
|
- `test_data/` - Test TypeScript files
|
|
- `go.mod` - Dependencies
|
|
|
|
## Testing Patterns
|
|
|
|
- **Test framework**: Go's built-in `testing` package
|
|
- **Assertions**: `github.com/stretchr/testify/assert`
|
|
- **Linting**: `golangci-lint run` - must pass before committing
|
|
- **Test organization**: Test files use `_test.go` suffix, test functions prefixed with `Test`
|
|
|
|
## Dependencies
|
|
|
|
- `github.com/evanw/esbuild/pkg/api` - TypeScript transpilation
|
|
- `github.com/dop251/goja` - JavaScript execution
|
|
- `github.com/stretchr/testify/assert` - Test assertions
|
|
|
|
## Key Functions
|
|
|
|
- `executeTypeScript(filePath string, stdout, stderr io.Writer) error` - Main transpilation and execution logic
|
|
|
|
## Code Conventions
|
|
|
|
- Handle all return values from external functions (enforced by golangci-lint)
|
|
- Use `os` package instead of deprecated `io/ioutil`
|
|
- Error logging uses `_, _ = fmt.Fprintf(stderr, ...)` pattern
|