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

Commit71ad590

Browse files
authored
chore: add icons.json file (#10085)
1 parent36f3151 commit71ad590

File tree

4 files changed

+143
-1
lines changed

4 files changed

+143
-1
lines changed

‎Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ gen: \
472472
site/.prettierignore\
473473
site/.eslintignore\
474474
site/e2e/provisionerGenerated.ts\
475+
site/src/theme/icons.json\
475476
examples/examples.gen.json
476477
.PHONY: gen
477478

@@ -495,6 +496,7 @@ gen/mark-fresh:
495496
site/.prettierignore\
496497
site/.eslintignore\
497498
site/e2e/provisionerGenerated.ts\
499+
site/src/theme/icons.json\
498500
examples/examples.gen.json\
499501
"
500502
forfilein$$files;do
@@ -538,7 +540,7 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
538540
./provisionerd/proto/provisionerd.proto
539541

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

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

552+
site/src/theme/icons.json:$(wildcard site/static/icon/*)
553+
go run ./scripts/gensite/ -icons$@
554+
pnpm run format:write:only$@
555+
550556
examples/examples.gen.json: scripts/examplegen/main.go examples/examples.go$(shell find ./examples/templates)
551557
go run ./scripts/examplegen/main.go> examples/examples.gen.json
552558

‎scripts/gensite/generateIconList.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"os"
7+
)
8+
9+
funcgenerateIconList(pathstring)int {
10+
ifpath=="" {
11+
return0// skip
12+
}
13+
14+
files,err:=os.ReadDir("site/static/icon/")
15+
iferr!=nil {
16+
_,_=fmt.Println("failed to read site/static/icon/ directory")
17+
_,_=fmt.Println("err:",err.Error())
18+
return71// OSERR
19+
}
20+
21+
icons:=make([]string,len(files))
22+
i:=0
23+
for_,file:=rangefiles {
24+
if!file.Type().IsRegular() {
25+
continue
26+
}
27+
28+
icons[i]=file.Name()
29+
i++
30+
}
31+
icons=icons[:i]
32+
33+
outputFile,err:=os.Create(path)
34+
iferr!=nil {
35+
_,_=fmt.Println("failed to create file")
36+
_,_=fmt.Println("err:",err.Error())
37+
return73// CANTCREAT
38+
}
39+
deferoutputFile.Close()
40+
41+
iconsJSON,err:=json.Marshal(icons)
42+
iferr!=nil {
43+
_,_=fmt.Println("failed to serialize JSON")
44+
_,_=fmt.Println("err:",err.Error())
45+
return70// SOFTWARE
46+
}
47+
48+
written,err:=outputFile.Write(iconsJSON)
49+
iferr!=nil||written!=len(iconsJSON) {
50+
_,_=fmt.Println("failed to write JSON")
51+
iferr!=nil {
52+
_,_=fmt.Println("err:",err.Error())
53+
}
54+
return74// IOERR
55+
}
56+
57+
_,_=fmt.Println(green.Sprintf("==>"),path)
58+
59+
return0
60+
}

‎scripts/gensite/main.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"os"
6+
7+
"github.com/fatih/color"
8+
)
9+
10+
vargreen=color.New(color.FgGreen).Add(color.Bold)
11+
12+
funcmain() {
13+
variconsPathstring
14+
flag.StringVar(&iconsPath,"icons","","the path to place icons.json at")
15+
flag.Parse()
16+
17+
status:=generateIconList(iconsPath)
18+
os.Exit(status)
19+
}

‎site/src/theme/icons.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[
2+
"android-studio.svg",
3+
"apache-guacamole.svg",
4+
"aws.png",
5+
"azure-devops.svg",
6+
"azure.png",
7+
"bitbucket.svg",
8+
"centos.svg",
9+
"clion.svg",
10+
"code.svg",
11+
"coder.svg",
12+
"conda.svg",
13+
"database.svg",
14+
"datagrip.svg",
15+
"dataspell.svg",
16+
"debian.svg",
17+
"do.png",
18+
"docker.png",
19+
"dotfiles.svg",
20+
"fedora.svg",
21+
"fly.io.svg",
22+
"folder.svg",
23+
"gateway.svg",
24+
"gcp.png",
25+
"git.svg",
26+
"github.svg",
27+
"gitlab.svg",
28+
"goland.svg",
29+
"image.svg",
30+
"intellij.svg",
31+
"java.svg",
32+
"jax.svg",
33+
"jfrog.svg",
34+
"jupyter.svg",
35+
"k8s.png",
36+
"kasmvnc.svg",
37+
"matlab.svg",
38+
"memory.svg",
39+
"node.svg",
40+
"nomad.svg",
41+
"novnc.svg",
42+
"personalize.svg",
43+
"phpstorm.svg",
44+
"projector.svg",
45+
"pycharm.svg",
46+
"pytorch.svg",
47+
"rider.svg",
48+
"rockylinux.svg",
49+
"rstudio.svg",
50+
"rubymine.svg",
51+
"tensorflow.svg",
52+
"terminal.svg",
53+
"theia.svg",
54+
"ubuntu.svg",
55+
"webstorm.svg",
56+
"widgets.svg"
57+
]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp