Browse Source

fix webpack

tags/V1.22.3.1^2
lewis 3 years ago
parent
commit
b872b278ac
1 changed files with 18 additions and 8 deletions
  1. +18
    -8
      Makefile

+ 18
- 8
Makefile View File

@@ -87,6 +87,8 @@ GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(fi

WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
WEBPACK_CONFIGS := webpack.config.js
WEBPACK_CONFIGS_TMP := webpack_temp.config.js
WEBPACK_CONFIGS_PRO := webpack_pro.config.js
WEBPACK_DEST := public/js/index.js public/css/index.css
WEBPACK_DEST_DIRS := public/js public/css public/fonts

@@ -102,7 +104,7 @@ GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)

ifeq ($(filter $(TAGS_SPLIT),bindata),bindata)
GO_SOURCES += $(BINDATA_DEST)
GO_SOURCES += $(BINDATA_DEST);
endif

GO_SOURCES_OWN := $(filter-out vendor/% %/bindata.go, $(GO_SOURCES))
@@ -290,10 +292,7 @@ lint-backend: golangci-lint revive vet swagger-check swagger-validate test-vendo

.PHONY: lint-frontend
lint-frontend: node_modules
npx eslint web_src/js webpack_pro.config.js
@echo "1";
@echo $(WEBPACK_CONFIGS)
#npx eslint web_src/js $(WEBPACK_CONFIGS)
npx eslint web_src/js $(WEBPACK_CONFIGS)
npx stylelint web_src/less

.PHONY: watch-frontend
@@ -507,7 +506,7 @@ install: $(wildcard *.go)
build: frontend backend

.PHONY: frontend
frontend: node-check $(FOMANTIC_DEST) $(WEBPACK_DEST)
frontend: node-check webpack_prepare $(FOMANTIC_DEST) $(WEBPACK_DEST) webpack_end

.PHONY: backend
backend: go-check generate $(EXECUTABLE)
@@ -517,8 +516,6 @@ generate: $(TAGS_PREREQ)
CC= GOOS= GOARCH= $(GO) generate -mod=vendor -tags '$(TAGS)' $(GO_PACKAGES)

$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
@echo "2"
@echo $(WEBPACK_CONFIGS)
$(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@

.PHONY: release
@@ -601,6 +598,19 @@ $(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) package-lock.json | node_modules

.PHONY: webpack
webpack: $(WEBPACK_DEST)
webpack_prepare:
if [ $(filter bindata,$(TAGS_SPLIT))x = "bindata"x ]; then \
echo "prepare"; \
cp $(WEBPACK_CONFIGS) $(WEBPACK_CONFIGS_TMP); \
cp $(WEBPACK_CONFIGS_PRO) $(WEBPACK_CONFIGS); \
fi

webpack_end:
if [ $(filter bindata,$(TAGS_SPLIT))x = "bindata"x ]; then \
echo "end"; \
mv $(WEBPACK_CONFIGS_TMP) $(WEBPACK_CONFIGS); \
fi

$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules
rm -rf $(WEBPACK_DEST_DIRS)


Loading…
Cancel
Save