forked from filebrowser/filebrowser
-
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.
build: use make for building the project (filebrowser#1304)
- Loading branch information
Showing
23 changed files
with
218 additions
and
194 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
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 |
---|---|---|
|
@@ -28,3 +28,5 @@ yarn-error.log* | |
*.njsproj | ||
*.sln | ||
*.sw* | ||
bin/ | ||
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 |
---|---|---|
|
@@ -63,7 +63,6 @@ linters: | |
- goconst | ||
- gocritic | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- golint | ||
- gomnd | ||
|
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,14 @@ | ||
{ | ||
"types": [ | ||
{ "type": "feat", "section": "Features" }, | ||
{ "type": "fix", "section": "Bug Fixes" }, | ||
{ "type": "perf", "section": "Performance improvements" }, | ||
{ "type": "revert", "section": "Reverts" }, | ||
{ "type": "refactor", "section": "Refactorings" }, | ||
{ "type": "build", "section": "Build" }, | ||
{ "type": "ci", "hidden": true }, | ||
{ "type": "test", "hidden": true }, | ||
{ "type": "chore", "hidden": true }, | ||
{ "type": "docs", "hidden": 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,98 @@ | ||
SHELL := /bin/bash | ||
BASE_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \ | ||
cat $(CURDIR)/.version 2> /dev/null || echo v0) | ||
VERSION_HASH = $(shell git rev-parse HEAD) | ||
|
||
BIN = $(BASE_PATH)/bin | ||
PATH := $(BIN):$(PATH) | ||
export PATH | ||
|
||
# printing | ||
V = 0 | ||
Q = $(if $(filter 1,$V),,@) | ||
M = $(shell printf "\033[34;1m▶\033[0m") | ||
|
||
GO = GOGC=off go | ||
# go module | ||
MODULE = $(shell env GO111MODULE=on $(GO) list -m) | ||
|
||
DATE ?= $(shell date +%FT%T%z) | ||
VERSION ?= $(shell git describe --tags --always --match=v* 2> /dev/null || \ | ||
cat $(CURDIR)/.version 2> /dev/null || echo v0) | ||
VERSION_HASH = $(shell git rev-parse HEAD) | ||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD) | ||
|
||
LDFLAGS += -X "$(MODULE)/varsion.Version=$(VERSION)" -X "$(MODULE)/varsion.CommitSHA=$(VERSION_HASH)" | ||
|
||
# tools | ||
$(BIN): | ||
@mkdir -p $@ | ||
$(BIN)/%: | $(BIN) ; $(info $(M) installing $(PACKAGE)…) | ||
$Q env GOBIN=$(BIN) $(GO) install $(PACKAGE) | ||
|
||
GOLANGCI_LINT = $(BIN)/golangci-lint | ||
$(BIN)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
GOIMPORTS = $(BIN)/goimports | ||
$(BIN)/goimports: PACKAGE=golang.org/x/tools/cmd/[email protected] | ||
|
||
RICE = $(BIN)/rice | ||
$(BIN)/rice: PACKAGE=github.com/GeertJohan/go.rice/[email protected] | ||
|
||
## build: Build | ||
.PHONY: build | ||
build: | build-frontend build-backend ; $(info $(M) building…) | ||
|
||
## build-frontend: Build frontend | ||
.PHONY: build-frontend | ||
build-frontend: | ; $(info $(M) building frontend…) | ||
$Q cd frontend && npm ci && npm run build | ||
|
||
## build-backend: Build backend | ||
.PHONY: build-backend | ||
build-backend: | $(RICE) ; $(info $(M) building backend…) | ||
$Q cd ./http && rm -rf rice-box.go && $(RICE) embed-go | ||
$Q $(GO) build -ldflags '$(LDFLAGS)' -o filebrowser | ||
|
||
## test: Run all tests | ||
.PHONY: test | ||
test: | test-frontend test-backend ; $(info $(M) running tests…) | ||
|
||
## test-frontend: Run frontend tests | ||
.PHONY: test-frontend | ||
test-frontend: | ; $(info $(M) running frontend tests…) | ||
|
||
## test-backend: Run backend tests | ||
.PHONY: test-backend | ||
test-backend: | $(RICE) ; $(info $(M) running backend tests…) | ||
$Q $(GO) test -v ./... | ||
|
||
## lint: Lint | ||
.PHONY: lint | ||
lint: lint-frontend lint-backend lint-commits | ; $(info $(M) running all linters…) | ||
|
||
## lint-frontend: Lint frontend | ||
.PHONY: lint-frontend | ||
lint-frontend: | ; $(info $(M) running frontend linters…) | ||
$Q cd frontend && npm ci && npm run lint | ||
|
||
## lint-backend: Lint backend | ||
.PHONY: lint-backend | ||
lint-backend: | $(GOLANGCI_LINT) ; $(info $(M) running backend linters…) | ||
$Q $(GOLANGCI_LINT) run | ||
|
||
## lint-commits: Lint commits | ||
.PHONY: lint-commits | ||
lint-commits: | ; $(info $(M) running commitlint…) | ||
$Q ./scripts/commitlint.sh | ||
|
||
## bump-version: Bump app version | ||
.PHONY: bump-version | ||
bump-version: | ; $(info $(M) creating a new release…) | ||
$Q ./scripts/bump_version.sh | ||
|
||
## help: Show this help | ||
.PHONY: help | ||
help: | ||
@sed -n 's/^## //p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /' | sort |
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
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
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
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
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
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
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
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
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,34 @@ | ||
module.exports = { | ||
rules: { | ||
'body-leading-blank': [1, 'always'], | ||
'body-max-line-length': [2, 'always', 100], | ||
'footer-leading-blank': [1, 'always'], | ||
'footer-max-line-length': [2, 'always', 100], | ||
'header-max-length': [2, 'always', 100], | ||
'scope-case': [2, 'always', 'lower-case'], | ||
'subject-case': [ | ||
2, | ||
'never', | ||
['sentence-case', 'start-case', 'pascal-case', 'upper-case'], | ||
], | ||
'subject-full-stop': [2, 'never', '.'], | ||
'type-case': [2, 'always', 'lower-case'], | ||
'type-empty': [2, 'never'], | ||
'type-enum': [ | ||
2, | ||
'always', | ||
[ | ||
'feat', | ||
'fix', | ||
'perf', | ||
'revert', | ||
'refactor', | ||
'build', | ||
'ci', | ||
'test', | ||
'chore', | ||
'docs', | ||
], | ||
], | ||
}, | ||
}; |
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
Oops, something went wrong.