Skip to content

Commit

Permalink
Merge pull request #24 from thehowl/dev/morgan/stdlib_diff
Browse files Browse the repository at this point in the history
changes to stdlib diff
  • Loading branch information
Villaquiranm authored Dec 17, 2024
2 parents fc800e8 + 55e01aa commit dcad91d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ jobs:
- run: echo "GOROOT=$(go env GOROOT)" >> $GITHUB_ENV
- run: echo $GOROOT
- run: "cd misc/stdlib_diff && make install gen"
- run: "cd misc/gendocs && make install gen"
- run: "cd misc/gendocs && make gen"
- run: |
mkdir -p output/combined
mkdir -p output/combined/stdlib_diff
cp -r misc/gendocs/godoc/* output/combined/
cp -r misc/stdlib_diff/stdlib_diff/* output/combined/stdlib_diff/
mv misc/gendocs/godoc pages_output
mv misc/stdlib_diff/stdlib_diff pages_ouput/stdlib_diff
- uses: actions/configure-pages@v5
id: pages
- uses: actions/upload-pages-artifact@v3
with:
path: ./output/combined
path: ./pages_output

deploy:
if: ${{ github.repository == 'gnolang/gno' }} # Alternatively, validate based on provided tokens and permissions.
Expand Down
5 changes: 1 addition & 4 deletions misc/stdlib_diff/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
all: clean gen

install:
go install .

gen:
stdlib_diff -src $(GOROOT)/src -dst ../../gnovm/stdlibs -out ./stdlib_diff
go run . -src $(GOROOT)/src -dst ../../gnovm/stdlibs -out ./stdlib_diff

clean:
rm -rf stdlib_diff
36 changes: 19 additions & 17 deletions misc/stdlib_diff/templates/package_diff_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{{- range .LineDiffferrences}}
{{- if eq .SrcOperation 2}}
<div style="display: flex; color: red;">
<span style="user-select: none; min-width: 50px;">{{.SrcNumber}} </span><p>{{.SrcLine}}</p>
<span style="user-select: none; min-width: 50px;">{{.SrcNumber}} </span><p>{{.SrcLine}}</p>
</div>

{{- else if eq .SrcOperation 3}}
<div div style="display: flex;">
<span style="user-select: none; min-width: 50px;">{{.SrcNumber}}</span>
Expand All @@ -28,10 +28,10 @@
{{- range .LineDiffferrences}}
{{- if eq .DestOperation 1}}
<div style="display: flex; color: #07ca07;">
<span style="user-select: none; min-width: 50px;">{{.DestNumber}} </span><p>{{.DestLine}}</p>
<span style="user-select: none; min-width: 50px;">{{.DestNumber}} </span><p>{{.DestLine}}</p>
</div>
{{- else if eq .DestOperation 3}}
<div div style="display: flex;">
<div style="display: flex;">
<span style="user-select: none; min-width: 50px;">{{.DestNumber}}</span>
<p style="opacity: 0.75;">{{.DestLine}}</p>
</div>
Expand All @@ -52,8 +52,6 @@
<title>{{ .PackageName }}</title>
<style>
body, html {
height: 100vh;
width: 100%;
font-family: "Roboto Mono","Courier New",sans-serif;
color: #eee;
background-color: #1e1e1e;
Expand All @@ -72,23 +70,27 @@
tab-size: 4;
}

.diffs {
display: flex;
flex-direction: row;
align-items: stretch;
padding-bottom: 2rem;
width: 100%;
}
.file-container {
display: flex;
flex-direction: column;
width: 50%;
max-width: 50%;
min-height: 100%;
}
.file-viewer{
.file-viewer {
border-style: solid;
border-width: 2px;
border-radius: 15px;
border-color: #c7c7c7;
padding: 1rem;
height: 100%;
width: 50%;
overflow-x: auto;
white-space: nowrap;
box-sizing: border-box;
}
</style>
</head>
Expand All @@ -113,21 +115,21 @@ <h3>Number of files</h3>
{{- range .FilesDifferences}}
{{- if eq .Status "files differ"}}
<details open>
<summary>{{.SourceName}} ({{.Status}})</summary>
<summary>~ {{.SourceName}} ({{.Status}})</summary>
{{- else if eq .Status "missing in dst"}}
<details>
<summary style="color: red;">{{.SourceName}} ({{.Status}})</summary>
<summary style="color: red;">- {{.SourceName}} ({{.Status}})</summary>
{{- else if eq .Status "missing in src"}}
<details>
<summary style="color:forestgreen;">{{.SourceName}} ({{.Status}})</summary>
<summary style="color: forestgreen;">+ {{.SourceName}} ({{.Status}})</summary>
{{- else}}
<details>
<summary style="opacity: 45%;">{{.SourceName}} ({{.Status}})</summary>
<summary style="opacity: 45%;">= {{.SourceName}} ({{.Status}})</summary>
{{- end}}
<div style="display: flex; flex-direction: row; align-items: stretch; padding-bottom: 2rem;">
<div class="diffs">
{{template "file-viewer" .}}
</div>
</details>
{{- end}}
</body>
</html>
</html>

0 comments on commit dcad91d

Please sign in to comment.