Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add icons.json file#10085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
aslilac merged 4 commits intomainfromicons-json
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletionMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -472,6 +472,7 @@ gen: \
site/.prettierignore \
site/.eslintignore \
site/e2e/provisionerGenerated.ts \
site/src/theme/icons.json \
examples/examples.gen.json
.PHONY: gen

Expand All@@ -495,6 +496,7 @@ gen/mark-fresh:
site/.prettierignore \
site/.eslintignore \
site/e2e/provisionerGenerated.ts \
site/src/theme/icons.json \
examples/examples.gen.json \
"
for file in $$files; do
Expand DownExpand Up@@ -538,7 +540,7 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
./provisionerd/proto/provisionerd.proto

site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
go run./scripts/apitypings/ > site/src/api/typesGenerated.ts
cd site
pnpm run format:types ./src/api/typesGenerated.ts

Expand All@@ -547,6 +549,10 @@ site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisio
../scripts/pnpm_install.sh
pnpm run gen:provisioner

site/src/theme/icons.json: $(wildcard site/static/icon/*)
go run ./scripts/gensite/ -icons $@
pnpm run format:write:only $@

examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go $(shell find ./examples/templates)
go run ./scripts/examplegen/main.go > examples/examples.gen.json

Expand Down
60 changes: 60 additions & 0 deletionsscripts/gensite/generateIconList.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
package main

import (
"encoding/json"
"fmt"
"os"
)

func generateIconList(path string) int {
if path == "" {
return 0 // skip
}

files, err := os.ReadDir("site/static/icon/")
if err != nil {
_, _ = fmt.Println("failed to read site/static/icon/ directory")
_, _ = fmt.Println("err:", err.Error())
return 71 // OSERR
}

icons := make([]string, len(files))
i := 0
for _, file := range files {
if !file.Type().IsRegular() {
continue
}

icons[i] = file.Name()
i++
}
icons = icons[:i]

outputFile, err := os.Create(path)
if err != nil {
_, _ = fmt.Println("failed to create file")
_, _ = fmt.Println("err:", err.Error())
return 73 // CANTCREAT
}
defer outputFile.Close()

iconsJSON, err := json.Marshal(icons)
if err != nil {
_, _ = fmt.Println("failed to serialize JSON")
_, _ = fmt.Println("err:", err.Error())
return 70 // SOFTWARE
}

written, err := outputFile.Write(iconsJSON)
if err != nil || written != len(iconsJSON) {
_, _ = fmt.Println("failed to write JSON")
if err != nil {
_, _ = fmt.Println("err:", err.Error())
}
return 74 // IOERR
}

_, _ = fmt.Println(green.Sprintf("==>"), path)

return 0
}
19 changes: 19 additions & 0 deletionsscripts/gensite/main.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
package main

import (
"flag"
"os"

"github.com/fatih/color"
)

var green = color.New(color.FgGreen).Add(color.Bold)

func main() {
var iconsPath string
flag.StringVar(&iconsPath, "icons", "", "the path to place icons.json at")
flag.Parse()

status := generateIconList(iconsPath)
os.Exit(status)
}
57 changes: 57 additions & 0 deletionssite/src/theme/icons.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
[
"android-studio.svg",
"apache-guacamole.svg",
"aws.png",
"azure-devops.svg",
"azure.png",
"bitbucket.svg",
"centos.svg",
"clion.svg",
"code.svg",
"coder.svg",
"conda.svg",
"database.svg",
"datagrip.svg",
"dataspell.svg",
"debian.svg",
"do.png",
"docker.png",
"dotfiles.svg",
"fedora.svg",
"fly.io.svg",
"folder.svg",
"gateway.svg",
"gcp.png",
"git.svg",
"github.svg",
"gitlab.svg",
"goland.svg",
"image.svg",
"intellij.svg",
"java.svg",
"jax.svg",
"jfrog.svg",
"jupyter.svg",
"k8s.png",
"kasmvnc.svg",
"matlab.svg",
"memory.svg",
"node.svg",
"nomad.svg",
"novnc.svg",
"personalize.svg",
"phpstorm.svg",
"projector.svg",
"pycharm.svg",
"pytorch.svg",
"rider.svg",
"rockylinux.svg",
"rstudio.svg",
"rubymine.svg",
"tensorflow.svg",
"terminal.svg",
"theia.svg",
"ubuntu.svg",
"webstorm.svg",
"widgets.svg"
]

[8]ページ先頭

©2009-2025 Movatter.jp