From 54a33010089f0ac38c340377d6eedaad12fc57e5 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Sun, 16 Jan 2022 10:07:17 +0800 Subject: [PATCH] added Taskfile.yml --- backend/.editorconfig | 12 ++++++++++++ backend/Makefile | 32 -------------------------------- backend/Taskfile.yml | 12 ++++++++++++ backend/go.mod.dev | 20 ++++++++++++++++++++ backend/go.mod.local | 20 +++++++++++--------- 5 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 backend/.editorconfig delete mode 100644 backend/Makefile create mode 100644 backend/Taskfile.yml create mode 100644 backend/go.mod.dev diff --git a/backend/.editorconfig b/backend/.editorconfig new file mode 100644 index 00000000..c3c68a6c --- /dev/null +++ b/backend/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[{*.yml, *.yaml, *.json}] +indent_size = 2 diff --git a/backend/Makefile b/backend/Makefile deleted file mode 100644 index a2fb5ef1..00000000 --- a/backend/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -SHELL := /bin/bash -BASEDIR = $(shell pwd) - -# build with verison infos -versionDir = "apiserver/pkg/version" -gitTag = $(shell if [ "`git describe --tags --abbrev=0 2>/dev/null`" != "" ];then git describe --tags --abbrev=0; else git log --pretty=format:'%h' -n 1; fi) -buildDate = $(shell TZ=Asia/Shanghai date +%FT%T%z) -gitCommit = $(shell git log --pretty=format:'%H' -n 1) -gitTreeState = $(shell if git status|grep -q 'clean';then echo clean; else echo dirty; fi) - -ldflags="-w -X ${versionDir}.gitTag=${gitTag} -X ${versionDir}.buildDate=${buildDate} -X ${versionDir}.gitCommit=${gitCommit} -X ${versionDir}.gitTreeState=${gitTreeState}" - -all: gotool - @go build -v -ldflags ${ldflags} . -clean: - rm -f apiserver - find . -name "[._]*.s[a-w][a-z]" | xargs -i rm -f {} -gotool: - gofmt -w . - go tool vet . |& grep -v vendor;true -ca: - openssl req -new -nodes -x509 -out conf/server.crt -keyout conf/server.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=127.0.0.1/emailAddress=xxxxx@qq.com" - -help: - @echo "make - compile the source code" - @echo "make clean - remove binary file and vim swp files" - @echo "make gotool - run go tool 'fmt' and 'vet'" - @echo "make ca - generate ca files" - -.PHONY: clean gotool ca help - - diff --git a/backend/Taskfile.yml b/backend/Taskfile.yml new file mode 100644 index 00000000..5e279c59 --- /dev/null +++ b/backend/Taskfile.yml @@ -0,0 +1,12 @@ +version: '3' + +tasks: + dev: + desc: Switch to dev mode for local development. + cmds: + - cp -f go.mod.dev go.mod + + deploy: + desc: Switch to deploy mode for code publish. + cmds: + - echo 'not implemented' diff --git a/backend/go.mod.dev b/backend/go.mod.dev new file mode 100644 index 00000000..9aa361a4 --- /dev/null +++ b/backend/go.mod.dev @@ -0,0 +1,20 @@ +module crawlab + +go 1.16 + +replace ( + github.com/crawlab-team/crawlab-core => ../../crawlab-core + github.com/crawlab-team/crawlab-vcs => ../../crawlab-vcs + github.com/crawlab-team/crawlab-fs => ../../crawlab-fs + github.com/crawlab-team/crawlab-db => ../../crawlab-db +) + +require ( + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + github.com/crawlab-team/go-trace v0.1.1 + github.com/gin-gonic/gin v1.7.1 + github.com/spf13/cobra v1.1.3 + github.com/spf13/viper v1.7.1 + go.uber.org/dig v1.10.0 +) diff --git a/backend/go.mod.local b/backend/go.mod.local index 4c7116d4..e36ac67c 100644 --- a/backend/go.mod.local +++ b/backend/go.mod.local @@ -3,16 +3,18 @@ module crawlab go 1.16 replace ( - github.com/crawlab-team/crawlab-core => /Users/chenjingyang/dev/my-job/gitee/crawlab-core - github.com/crawlab-team/goseaweedfs => /Users/chenjingyang/dev/my-job/gitee/goseaweedfs + github.com/crawlab-team/crawlab-core => /libs/crawlab-team/crawlab-core + github.com/crawlab-team/crawlab-vcs => /libs/crawlab-team/crawlab-vcs + github.com/crawlab-team/crawlab-fs => /libs/crawlab-team/crawlab-fs + github.com/crawlab-team/crawlab-db => /libs/crawlab-team/crawlab-db ) require ( - github.com/apex/log v1.9.0 - github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 - github.com/crawlab-team/go-trace v0.1.1 - github.com/gin-gonic/gin v1.7.1 - github.com/spf13/cobra v1.1.3 - github.com/spf13/viper v1.7.1 - go.uber.org/dig v1.10.0 + github.com/apex/log v1.9.0 + github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200 + github.com/crawlab-team/go-trace v0.1.1 + github.com/gin-gonic/gin v1.7.1 + github.com/spf13/cobra v1.1.3 + github.com/spf13/viper v1.7.1 + go.uber.org/dig v1.10.0 )