github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/Makefile (about) 1 # # Some interesting links on Makefiles: 2 # https://danishpraka.sh/2019/12/07/using-makefiles-for-go.html 3 # https://tech.davis-hansson.com/p/make/ 4 5 MAKEFLAGS += --warn-undefined-variables 6 MAKEFLAGS += --no-builtin-rules 7 SHELL := bash 8 9 ## install: compile the code and installs in binary in $GOPATH/bin 10 install: 11 @go install 12 .PHONY: install 13 14 ## run: start the cozy-stack for local development 15 run: 16 @go run . serve --mailhog --fs-url=file://localhost${PWD}/storage --konnectors-cmd ${PWD}/scripts/konnector-dev-run.sh 17 .PHONY: run 18 19 ## instance: create an instance for local development 20 instance: 21 @cozy-stack instances add cozy.localhost:8080 --passphrase cozy --apps home,store,drive,photos,settings,contacts,notes,passwords --email claude@cozy.localhost --locale fr --public-name Claude --context-name dev 22 23 ## lint: enforce a consistent code style and detect code smells 24 lint: scripts/golangci-lint 25 @scripts/golangci-lint run --verbose 26 .PHONY: lint 27 28 scripts/golangci-lint: Makefile 29 @curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./scripts v1.58.1 30 31 ## jslint: enforce a consistent code style for Js code 32 jslint: scripts/node_modules 33 @scripts/node_modules/.bin/eslint -c scripts/eslint.config.js "assets/scripts/**" tests/system/konnector/*.js 34 .PHONY: jslint 35 36 ## pretty: make the assets prettier 37 pretty: scripts/node_modules 38 @scripts/node_modules/.bin/prettier --write --no-semi --single-quote assets/*/*.js 39 @scripts/node_modules/.bin/prettier --write assets/*/*.css 40 .PHONY: pretty 41 42 ## svgo: optimize the SVG 43 svgo: scripts/node_modules 44 @scripts/node_modules/.bin/svgo -r -f assets/icons 45 @scripts/node_modules/.bin/svgo -r -f assets/images --exclude relocation-animated.svg 46 47 scripts/node_modules: Makefile scripts/package.json scripts/package-lock.json 48 @cd scripts && npm install 49 50 ## assets: package the assets as go code 51 assets: web/statik/statik.go 52 @if ! [ -x "$$(command -v statik)" ]; then go install github.com/cozy/cozy-stack/pkg/statik; fi 53 @scripts/build.sh assets 54 .PHONY: assets 55 56 ## assets-fast: package the assets with the fastest level of compression 57 assets-fast: 58 @env BROTLI_LEVEL=0 ./scripts/build.sh assets 59 .PHONY: assets-fast 60 61 ## cli: builds the CLI documentation and shell completions 62 cli: 63 @if ! [ -x "$$(command -v cozy-stack)" ]; then make install; fi 64 @scripts/build.sh assets 65 @rm -rf docs/cli/* 66 @cozy-stack doc markdown docs/cli 67 @cozy-stack completion bash > scripts/completion/cozy-stack.bash 68 @cozy-stack completion zsh > scripts/completion/cozy-stack.zsh 69 @cozy-stack completion fish > scripts/completion/cozy-stack.fish 70 .PHONY: cli 71 72 ## unit-tests: run the tests 73 unit-tests: 74 @go test -p 1 -timeout 2m -short ./... 75 .PHONY: unit-tests 76 77 ## system-tests: run the tests 78 system-tests: 79 @scripts/system-test.sh 80 .PHONY: system-tests 81 82 ## clean: clean the generated files and directories 83 clean: 84 @rm -rf bin scripts/node_modules 85 @go clean 86 .PHONY: clean 87 88 ## help: print this help message 89 help: 90 @echo "Usage:" 91 @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' 92 .PHONY: help