loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Stop packaging node_modules in release tarballs (#15273)

- Don't package node_modules in tarballs, they are not cross-platform
anymore and npm cache should not be messed with directly. Instead,
require an internet connection to rebuild the UI, which is not necessary
in the general use case because prebuilt UI files are shipped in the
public directory.
- Simplify the fomantic build and make the target phony. We don't need
anything more for something that is rarely ran.
- Use regular tar again to build tarballs and add variable for excludes
- Disable annoying npm update notifications

Fixes: https://github.com/go-gitea/gitea/pull/14578
Fixes: https://github.com/go-gitea/gitea/pull/15256
Fixes: https://github.com/go-gitea/gitea/pull/15262

Co-authored-by: 6543 <6543@obermui.de>

authored by

silverwind
6543
and committed by
GitHub
0991f9aa 7088bcf6

+30 -60
+2 -2
.drone.yml
··· 501 501 pull: always 502 502 image: techknowlogick/xgo:go-1.16.x 503 503 commands: 504 - - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs bsdtar\|libarchive-tools 504 + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs 505 505 - export PATH=$PATH:$GOPATH/bin 506 506 - make release 507 507 environment: ··· 597 597 pull: always 598 598 image: techknowlogick/xgo:go-1.16.x 599 599 commands: 600 - - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs bsdtar\|libarchive-tools 600 + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs 601 601 - export PATH=$PATH:$GOPATH/bin 602 602 - make release 603 603 environment:
-2
.gitignore
··· 81 81 /public/fonts 82 82 /public/img/webpack 83 83 /web_src/fomantic/node_modules 84 - /web_src/fomantic/semantic.json 85 84 /web_src/fomantic/build/* 86 85 !/web_src/fomantic/build/semantic.js 87 86 !/web_src/fomantic/build/semantic.css ··· 95 94 !/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2 96 95 /VERSION 97 96 /.air 98 - /.npm-cache 99 97 100 98 # Snapcraft 101 99 snap/.snapcraft/
+1 -1
.npmrc
··· 1 1 audit=false 2 2 fund=false 3 + update-notifier=false 3 4 package-lock=true 4 5 save-exact=true 5 - cache=.npm-cache
+15 -48
Makefile
··· 14 14 15 15 # This is the "normal" part of the Makefile 16 16 17 - TAR := $(shell hash bsdtar > /dev/null 2>&1 && echo "bsdtar --no-xattrs" || echo "tar" ) 18 - 19 17 DIST := dist 20 18 DIST_DIRS := $(DIST)/binaries $(DIST)/release 21 19 IMPORT := code.gitea.io/gitea ··· 93 91 94 92 GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/models/migrations code.gitea.io/gitea/integrations/migration-test code.gitea.io/gitea/integrations,$(shell $(GO) list -mod=vendor ./... | grep -v /vendor/)) 95 93 96 - FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables 97 - FOMANTIC_DEST := web_src/fomantic/build/semantic.js web_src/fomantic/build/semantic.css 98 94 FOMANTIC_WORK_DIR := web_src/fomantic 99 95 100 96 WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f) ··· 114 110 TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags 115 111 116 112 TEST_TAGS ?= sqlite sqlite_unlock_notify 113 + 114 + TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) 117 115 118 116 GO_DIRS := cmd integrations models modules routers build services vendor tools 119 117 ··· 589 587 build: frontend backend 590 588 591 589 .PHONY: frontend 592 - frontend: node-check $(WEBPACK_DEST) 590 + frontend: $(WEBPACK_DEST) 593 591 594 592 .PHONY: backend 595 593 backend: go-check generate $(EXECUTABLE) ··· 654 652 cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done; 655 653 656 654 .PHONY: release-sources 657 - release-sources: | $(DIST_DIRS) npm-cache 655 + release-sources: | $(DIST_DIRS) 658 656 echo $(VERSION) > $(STORED_VERSION_FILE) 659 - $(eval EXCL := --exclude=$(shell [ ! "$(TAR)" = "tar" ] && echo "^" )./) 660 - $(eval EXCL_RECURSIVE := --exclude=) 661 - $(TAR) $(EXCL)$(DIST) $(EXCL).git $(EXCL)$(MAKE_EVIDENCE_DIR) $(EXCL_RECURSIVE)node_modules $(EXCL)$(AIR_TMP_DIR) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz . 657 + # bsdtar needs a ^ to prevent matching subdirectories 658 + $(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./) 659 + tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz . 662 660 rm -f $(STORED_VERSION_FILE) 663 661 664 662 .PHONY: release-docs 665 663 release-docs: | $(DIST_DIRS) docs 666 - $(TAR) -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public . 664 + tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public . 667 665 668 666 .PHONY: docs 669 667 docs: ··· 676 674 npm install --no-save 677 675 @touch node_modules 678 676 679 - .PHONY: npm-cache 680 - npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui 681 - 682 - .npm-cache: package-lock.json 683 - rm -rf .npm-cache 684 - $(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version")) 685 - npm config --userconfig=.npmrc set cache=.npm-cache 686 - rm -rf node_modules && npm install --no-save 687 - npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc set cache=../../.npm-cache 688 - echo $(foreach build, darwin-64 $(foreach arch,arm arm64 32 64,linux-${arch}) $(foreach arch,32 64,windows-${arch}), esbuild-${build}@$(ESBUILD_VERSION)) | tr " " "\n" | xargs -n 1 -P 4 npm cache add 689 - rm -rf $(FOMANTIC_WORK_DIR)/node_modules 690 - @touch .npm-cache 691 - 692 - .PHONY: npm-uncache 693 - npm-uncache: 694 - rm -rf .npm-cache 695 - npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc rm cache 696 - npm config --userconfig=.npmrc rm cache 697 - 698 677 .PHONY: npm-update 699 678 npm-update: node-check | node_modules 700 679 npx updates -cu ··· 703 682 @touch node_modules 704 683 705 684 .PHONY: fomantic 706 - fomantic: $(FOMANTIC_DEST) 707 - 708 - $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui: 709 - ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR) 710 - cd $(FOMANTIC_WORK_DIR); \ 711 - rm -rf node_modules && mkdir node_modules && \ 712 - npm install fomantic-ui; \ 713 - rm -f semantic.json 714 - @touch $(FOMANTIC_WORK_DIR)/node_modules 715 - 716 - $(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui 717 - ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR) 685 + fomantic: 718 686 rm -rf $(FOMANTIC_WORK_DIR)/build 719 - cd $(FOMANTIC_WORK_DIR); \ 720 - cp -f theme.config.less node_modules/fomantic-ui/src/theme.config; \ 721 - cp -rf _site node_modules/fomantic-ui/src/; \ 722 - npx gulp -f node_modules/fomantic-ui/gulpfile.js build; \ 723 - rm -f semantic.json 724 - @touch $(FOMANTIC_DEST) 687 + cd $(FOMANTIC_WORK_DIR) && npm install --no-save 688 + cp -f $(FOMANTIC_WORK_DIR)/theme.config.less $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/theme.config 689 + cp -rf $(FOMANTIC_WORK_DIR)/_site $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/ 690 + cd $(FOMANTIC_WORK_DIR) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build 725 691 726 692 .PHONY: webpack 727 693 webpack: $(WEBPACK_DEST) 728 694 729 - $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules 695 + $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json 696 + @$(MAKE) -s node-check node_modules 730 697 rm -rf $(WEBPACK_DEST_ENTRIES) 731 698 npx webpack 732 699 @touch $(WEBPACK_DEST)
+3 -5
README.md
··· 77 77 The `build` target is split into two sub-targets: 78 78 79 79 - `make backend` which requires [Go 1.13](https://golang.org/dl/) or greater. 80 - - `make frontend` which requires [Node.js 12.17](https://nodejs.org/en/download/) or greater. 81 - 82 - If pre-built frontend files are present it is possible to only build the backend: 80 + - `make frontend` which requires [Node.js 12.17](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies. 83 81 84 - TAGS="bindata" make backend 82 + When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity. 85 83 86 - Parallelism is not supported for these targets, so please don't include `-j <num>`. 84 + Parallelism (`make -j <num>`) is not supported. 87 85 88 86 More info: https://docs.gitea.io/en-us/install-from-source/ 89 87
semantic.json web_src/fomantic/semantic.json
+4 -2
web_src/fomantic/.npmrc
··· 1 - optional=false 1 + audit=false 2 + fund=false 3 + update-notifier=false 2 4 package-lock=false 3 - cache=../../.npm-cache 5 + optional=false
+5
web_src/fomantic/package.json
··· 1 + { 2 + "dependencies": { 3 + "fomantic-ui": "2.8.7" 4 + } 5 + }