Skip to content

Commit

Permalink
Merge c7fcb2d into 8fcacd3
Browse files Browse the repository at this point in the history
  • Loading branch information
d4l3k authored Sep 21, 2018
2 parents 8fcacd3 + c7fcb2d commit 9c6df6f
Show file tree
Hide file tree
Showing 8 changed files with 544 additions and 458 deletions.
468 changes: 468 additions & 0 deletions generate/generate.go

Large diffs are not rendered by default.

490 changes: 35 additions & 455 deletions main.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions playground/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
*.gopry
main.go
stdlib.go
server
16 changes: 16 additions & 0 deletions playground/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:alpine as base

WORKDIR /go/src/app
COPY . .

RUN go get -d -v ./...
RUN go install -v ./...

RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o server ./server

FROM scratch
COPY --from=base /go/src/app/ /

EXPOSE 8080
CMD ["/server"]

5 changes: 5 additions & 0 deletions playground/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ build: wasm_exec.js
go-pry -generate="stdlib.go" -i="$(shell tr '\n' ',' < packages.txt)" -e='log.Println("Hello world!")'
GOOS=js GOARCH=wasm go build -v -ldflags "-s -w" -o stdlib.wasm stdlib.go

.PHONY: run
run:
RUN CGO_ENABLED=0 go build -ldflags "-s -w" -o server ./server
./server

wasm_exec.js: $(shell go env GOROOT)/misc/wasm/wasm_exec.js
cp $< .

Expand Down
17 changes: 14 additions & 3 deletions playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Source+Sans+Pro:400,700" rel="stylesheet">
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<link rel="stylesheet" href="node_modules/nprogress/nprogress.css"/>

<style>
body {
color: white;
Expand All @@ -17,6 +19,7 @@
}
#terminal {
display: inline-block;
max-width: 100%;
}
pre, h2 {
font-family: 'Source Code Pro';
Expand Down Expand Up @@ -45,8 +48,13 @@ <h1>go-pry: web</h1>
<h2>hello!<b> </b>👋</h2>
<p>This is a version of <a href="https://github.com/d4l3k/go-pry">go-pry</a>
that runs in your browser using WebAssembly! It's missing a few features
like advanced auto complete since the browser doesn't have filesystem
access.</p>
but works pretty well for the most part.</p>

<p>This sometimes takes quite a while to load in Chrome, but it's almost
instant in Firefox.</p>

<p>I'm pretty excited to try using this to demo popular client
libraries.</p>

<h2>go-pry import bundles</h2>
<ul>
Expand All @@ -61,7 +69,9 @@ <h2>go-pry import bundles</h2>
<p>Created by <a href="https://fn.lc">Tristan Rice</a>.</p>


<script src="node_modules/xterm/dist/xterm.js"></script><Paste>
<script src="node_modules/nprogress/nprogress.js"></script>
<script>NProgress.start()</script>
<script src="node_modules/xterm/dist/xterm.js"></script>
<script src="wasm_exec.js"></script>
<script>

Expand All @@ -88,6 +98,7 @@ <h2>go-pry import bundles</h2>

const go = new Go();
WebAssembly.instantiateStreaming(wasm, go.importObject).then((result) => {
NProgress.done()
go.run(result.instance);
});
})
Expand Down
1 change: 1 addition & 0 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"nprogress": "^0.2.0",
"xterm": "^3.7.0"
}
}
4 changes: 4 additions & 0 deletions playground/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# yarn lockfile v1


nprogress@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"

xterm@^3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.7.0.tgz#b3eb1335dc04b92abe361711731d3b661e13db17"

0 comments on commit 9c6df6f

Please sign in to comment.