Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewmueller/joy
A delightful Go to Javascript compiler (ON HOLD)
https://github.com/matthewmueller/joy
Last synced: 5 days ago
JSON representation
A delightful Go to Javascript compiler (ON HOLD)
- Host: GitHub
- URL: https://github.com/matthewmueller/joy
- Owner: matthewmueller
- License: gpl-3.0
- Created: 2017-09-20T07:49:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T14:18:57.000Z (about 4 years ago)
- Last Synced: 2024-04-14T08:06:45.337Z (8 months ago)
- Language: Go
- Homepage: https://mat.tm/joy
- Size: 6.85 MB
- Stars: 1,327
- Watchers: 28
- Forks: 35
- Open Issues: 54
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - matthewmueller/joy - A delightful Go to Javascript compiler (ON HOLD) (Go)
- awesome-npm - joy - Go to Javascript compiler. (6. 其他 / 6.5 Assembly)
README
![joy compiler](https://user-images.githubusercontent.com/170299/33872480-b10be348-df49-11e7-80b1-06736c8298ae.png)
⚠️ Joy development is currently **on hold**. Recent Go -> WASM developments look like a more promising path to Go being a great choice for frontend development. I'm thrilled to see development moving so quickly now and I think our efforts are better spent improving the Go to WASM compiler. As for Joy, there are quite a few interesting nuggets of code in here that I'd encourage you to dig up, polish and open source 😊
Thanks for your interest in this project!
❤️ **Matt**
---
Translate idiomatic Go into concise Javascript that works in every browser. Use Go's type system and world-class tooling to build large web applications with confidence.
Visit [mat.tm/joy](https://mat.tm/joy) to learn more about Joy.
---
[Getting Started](#getting-started)
· [Examples](#examples)
· [Using the CLI](#using-the-cli)[Contributing](#contributing) · [FAQ](#faq) · [More Links](#more-links)
[Joy API](https://godoc.org/github.com/matthewmueller/joy) · *DOM API (coming soon!)* · *Virtual DOM API (coming soon!)*
---
## Getting Started
**1. Install Joy:**
```sh
curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh
```> Note: you can also download from the [releases tab](https://github.com/matthewmueller/joy/releases).
**2. Create a `main.go` file with the following code:**
```go
package mainfunc main() {
println("hi world!")
}
```**3. Run the code in a real browser:**
```sh
joy run main.go
```**4. See the compiled Javascript:**
```sh
joy main.go
```## Examples
Visit https://mat.tm/joy/#examples or peruse the [test suite](https://github.com/matthewmueller/joy/tree/master/testdata).
## Using the CLI
**Compile Go into Javascript:**
```
joy
```**Compile and run the Go code in headless chrome:**
```
joy run
```**Build a development version of the code:**
```
joy build --dev ...
```**Build a production version of the code (coming soon!):**
```
joy build ...
```**Start a development server with livereload:**
```
joy serve ...
```> Run `joy help` for additional details.
## Contributing
So happy to hear you're interested in contributing! Here's a quick rundown of how to get setup:
**Setup**
1. Make sure you have the Go environment setup on your computer. There are quite a few better resources online on how to do that
2. `go get -u -v github.com/matthewmueller/joy/...` to install the compiler from source
3. `go test -v` to run all the tests
**Links and tips:**
- https://astexplorer.net/: I've been using this to figure out how to build the JS tree
- http://goast.yuroyoro.net/ : Simple Go AST viewer
- https://github.com/estree/estree/blob/master/es5.md: Link to the ES3 AST format, this is implemented in [syntax.go](internal/jsast/syntax.go)
- https://golang.org/ref/spec: You may need to refer to this to see what types are possible in Go's AST
- To run all tests: `go test -v`
- To run individual tests: `go test -v -run Test/08`
- `pretty.Println(ast)` will pretty print the JS AST (requires [this package](https://github.com/kr/pretty))
- `ast.Print(nil, node)` will pretty print the Go ASTIf you have any further questions, [open an issue](github.com/matthewmueller/joy/issues) or reach out to me on [twitter](https://twitter.com/mattmueller).
## FAQ
Visit https://mat.tm/joy/#faq to view the FAQ.
## More Links
- Run `joy help` to see what else Joy can do for you
- Visit mat.tm/joy to read more about Joy's origins
- Chat with us in **#joy-compiler** on Slack at gophers.slack.com
- Star github.com/matthewmueller/joy to follow the development
- Follow twitter.com/mattmueller for project updates