-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
3,449 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM golang:1.20 AS remote-container | ||
|
||
# golangci-lint | ||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin | ||
RUN golangci-lint --version | ||
|
||
# go-tools | ||
RUN go install golang.org/x/tools/gopls@latest \ | ||
&& go install github.com/cweill/gotests/gotests@latest \ | ||
&& go install github.com/shurcooL/goexec@latest | ||
|
||
WORKDIR /workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/alpine | ||
{ | ||
"name": "toolbox", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
//"image": "mcr.microsoft.com/devcontainers/base:alpine-3.17", | ||
"dockerFile": "Dockerfile", | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "uname -a", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"Gruntfuggly.todo-tree", | ||
"streetsidesoftware.code-spell-checker", | ||
"golang.go" | ||
] | ||
} | ||
} | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GOOS=js | ||
GOARCH=wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
paths-ignore: | ||
- .vscode/** | ||
- .workspace/** | ||
- "*.md" | ||
- "**/.env.development" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Docker Image | ||
run: docker build -t ci-image -f .devcontainer/Dockerfile . | ||
|
||
- name: Build Wasm | ||
run: docker run --rm -v $(pwd):/workspace ci-image make build | ||
|
||
- name: Archive | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: archive | ||
path: ./build | ||
|
||
deploy: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: archive | ||
path: ./build | ||
|
||
- name: Deploy App | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
**/build/ | ||
**/dist/ | ||
**/coverage/ | ||
|
||
**/.DS_Store | ||
**/.env.local | ||
**/.env.*.local | ||
# **/*.wasm | ||
**/*.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
run: | ||
allow-parallel-runners: true | ||
output: | ||
format: code-climate | ||
sort-results: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"version": "0.2", | ||
"language": "en", | ||
"ignorePaths": [ | ||
".git/", | ||
".github/", | ||
".vscode/", | ||
".workspace/", | ||
"go.mod", | ||
"go.sum", | ||
"*_test.*" | ||
], | ||
"words": [ | ||
"awasawa", | ||
"encryptor", | ||
"GOARCH", | ||
"kazuki", | ||
"strcase", | ||
"usecase" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"go.toolsEnvVars": { | ||
"GOOS": "js", | ||
"GOARCH": "wasm", | ||
}, | ||
"go.testEnvVars": { | ||
"GOOS": "linux", | ||
"GOARCH": "amd64" | ||
}, | ||
"go.testFlags": [ | ||
"-cover", | ||
"-v", | ||
// "-race", | ||
"-count=1" | ||
], | ||
"go.lintTool": "golangci-lint", | ||
"go.useLanguageServer": true, | ||
"gopls": { | ||
"formatting.gofumpt": true, | ||
"ui.completion.usePlaceholders": true, | ||
}, | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
export SHELL=/bin/bash | ||
export GO111MODULE=on | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# 定数定義 | ||
# ------------------------------------------------------------------------------ | ||
|
||
# カラーコード | ||
C_RESET := \033[m | ||
C_RED := \033[31m | ||
C_GREEN := \033[32m | ||
C_YELLOW := \033[33m | ||
|
||
# ログレベル | ||
INFO := printf "${C_GREEN}[INFO] ${C_RESET}" && echo -e | ||
WARN := printf "${C_YELLOW}[WARN] ${C_RESET}" && echo -e | ||
ERROR := printf "${C_RED}[ERROR] ${C_RESET}" && echo -e | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# コマンド一覧表示 | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: list | ||
list: | ||
@${INFO} 'select the number of the command.';\ | ||
echo '';\ | ||
select SELECT_VAL in $$(cat Makefile | grep -e '.PHONY:' | grep -v 'list' | sed 's!^\.PHONY\: *!!') 'CANCEL';\ | ||
do\ | ||
echo '';\ | ||
if [ "$${SELECT_VAL}" = 'CANCEL' ]; then\ | ||
${INFO} "'CANCEL' selected. abort the process...";\ | ||
exit 0;\ | ||
fi;\ | ||
if [ -z $${SELECT_VAL} ]; then\ | ||
${WARN} 'that selection does not exist. abort the process...';\ | ||
exit 0;\ | ||
fi;\ | ||
echo -e ">>> make $${SELECT_VAL}${C_RESET}";\ | ||
make --no-print-directory "$${SELECT_VAL}";\ | ||
break;\ | ||
done; | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# モジュール更新 | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: update | ||
update: | ||
@${INFO} 'start go get...' | ||
@cat go.mod | awk '/\t.+ v[0-9]+\.[0-9]+\.[a-z0-9\-\+]+$$/ { print $$1 }' | xargs -I {} go get -u -d {} | ||
@${INFO} 'start go mod tidy...' | ||
@go env GOVERSION | sed -r 's/^go([0-9]+\.[0-9]+).[0-9]+$$/\1/' | go mod tidy -compat=$$(cat) | ||
@${INFO} 'completed.' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# フォーマット | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: format | ||
format: | ||
@${INFO} 'start format...' | ||
@gofmt -l -s -w ./src/ | ||
@${INFO} 'completed.' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# 静的解析 | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: lint | ||
lint: | ||
@${INFO} 'start lint...' | ||
@set -a && source .env && set +a; \ | ||
golangci-lint run --out-format=tab --color=always | ||
@${INFO} 'completed.' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# ユニットテスト | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: test | ||
test: | ||
@${INFO} 'start test...' | ||
@rm -rf ./coverage | ||
@mkdir -p ./coverage | ||
@go clean -testcache | ||
@set -a && source .env && set +a; \ | ||
go test ./... -coverprofile ./coverage/cover.out > ./coverage/test.out 2>&1; \ | ||
EXIT_CODE=$$?; \ | ||
cat ./coverage/test.out; \ | ||
go tool cover -html=./coverage/cover.out -o ./coverage/cover.html; \ | ||
go tool cover -func=./coverage/cover.out | grep total | tr -d '\t' | sed -e 's/(statements)/ /g'; \ | ||
exit $$EXIT_CODE | ||
@${INFO} 'completed.' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# ビルド | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: build | ||
build: | ||
@${INFO} 'start build...' | ||
@rm -rf ./build | ||
@cp -r ./public ./build | ||
@set -a && source .env && set +a && \ | ||
go build -buildvcs=false -o ./build/case/main.wasm ./src/case && \ | ||
go build -buildvcs=false -o ./build/format/main.wasm ./src/format && \ | ||
go build -buildvcs=false -o ./build/url/main.wasm ./src/url && \ | ||
go build -buildvcs=false -o ./build/random/main.wasm ./src/random && \ | ||
go build -buildvcs=false -o ./build/hash/main.wasm ./src/hash && \ | ||
go build -buildvcs=false -o ./build/base/main.wasm ./src/base && \ | ||
go build -buildvcs=false -o ./build/jwt/main.wasm ./src/jwt && \ | ||
go build -buildvcs=false -o ./build/crypto/main.wasm ./src/crypto | ||
@${INFO} 'completed.' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# ローカル実行 | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: start | ||
start: | ||
@make build | ||
@${INFO} 'starting the development server...' | ||
@${INFO} 'you can now view app in the browser. http://localhost:3000' | ||
@goexec 'http.ListenAndServe(`:3000`, http.FileServer(http.Dir(`./build`)))' | ||
|
||
|
||
# ------------------------------------------------------------------------------ | ||
# クリーン | ||
# ------------------------------------------------------------------------------ | ||
|
||
.PHONY: clean | ||
clean: | ||
@${INFO} 'start clean...' | ||
@rm -rf ./coverage | ||
@rm -rf ./build | ||
@${INFO} 'completed.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# toolbox | ||
|
||
## 概要 | ||
|
||
開発者向けの簡易ツールです。文字列のケース変換やハッシュ化、Base変換などに対応しています。すべての処理はブラウザ内で行われ、データは外部に送信されません。 | ||
|
||
![device](./.workspace/mobile.png) | ||
|
||
![pc](./.workspace/pc.jpg) | ||
|
||
## 開発 | ||
|
||
事前に下記をインストールする。 | ||
|
||
- Docker Desktop | ||
- VS Code | ||
- VS Code の拡張機能 Dev Containers | ||
|
||
下記の手順で開発環境を起動する。 | ||
|
||
1. Docker Desktop を起動 | ||
1. VS Code を起動 | ||
1. Reopen in Container を実行 | ||
|
||
開発環境では下記のコマンドを使用する。 | ||
|
||
| | コマンド | 概要 | | ||
| ------------------------------ | ------------- | --------------------------------------------------- | | ||
| アプリケーションのローカル実行 | `make start` | アプリケーションをローカル環境で実行する | | ||
| モジュールの更新 | `make update` | `go get`, `go mod tidy` を実施する | | ||
| フォーマットの実施 | `make format` | `gofmt` を実施する | | ||
| 静的解析の実施 | `make lint` | `golangci-lint run` を実施する | | ||
| 単体テストの実施 | `make test` | `go test` を実施し `coverage/` に実施結果を生成する | | ||
|
||
以上 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module toolbox | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible | ||
github.com/iancoleman/strcase v0.2.0 | ||
github.com/pkg/errors v0.9.1 | ||
go.uber.org/zap v1.24.0 | ||
) | ||
|
||
require ( | ||
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636 // indirect | ||
github.com/shurcooL/go-goon v1.0.0 // indirect | ||
go.uber.org/atomic v1.10.0 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= | ||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= | ||
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= | ||
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= | ||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636 h1:aSISeOcal5irEhJd1M+IrApc0PdcN7e7Aj4yuEnOrfQ= | ||
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= | ||
github.com/shurcooL/go-goon v1.0.0 h1:BCQPvxGkHHJ4WpBO4m/9FXbITVIsvAm/T66cCcCGI7E= | ||
github.com/shurcooL/go-goon v1.0.0/go.mod h1:2wTHMsGo7qnpmqA8ADYZtP4I1DD94JpXGQ3Dxq2YQ5w= | ||
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= | ||
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= | ||
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= | ||
go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= | ||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= | ||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= | ||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= | ||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
Oops, something went wrong.