1.2 KiB
1.2 KiB
Poiesis
Overview
Go tool that transpiles TypeScript to JavaScript using esbuild API and executes it with goja.
Build & Test
go build
go test
golangci-lint run
Project Structure
main.go- Entry point withexecuteTypeScript()functionmain_test.go- Test suite using testify assertionstest_data/- Test TypeScript filesgo.mod- Dependencies
Testing Patterns
- Test framework: Go's built-in
testingpackage - Assertions:
github.com/stretchr/testify/assert - Linting:
golangci-lint run- must pass before committing - Test organization: Test files use
_test.gosuffix, test functions prefixed withTest
Dependencies
github.com/evanw/esbuild/pkg/api- TypeScript transpilationgithub.com/dop251/goja- JavaScript executiongithub.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
ospackage instead of deprecatedio/ioutil - Error logging uses
_, _ = fmt.Fprintf(stderr, ...)pattern