Skip to content

Commit 28479bb

Browse files
authored
Merge pull request go-gitea#12 from CL-Jeremy/esbuild
Ship esbuild binaries for all platforms in tarball
2 parents b938e47 + 113c2d4 commit 28479bb

File tree

5 files changed

+51
-18
lines changed

5 files changed

+51
-18
lines changed

Diff for: .drone.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ steps:
524524
pull: always
525525
image: techknowlogick/xgo:go-1.15.x
526526
commands:
527-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs
527+
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs bsdtar\|libarchive-tools
528528
- export PATH=$PATH:$GOPATH/bin
529529
- make release
530530
environment:
@@ -620,7 +620,7 @@ steps:
620620
pull: always
621621
image: techknowlogick/xgo:go-1.15.x
622622
commands:
623-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs
623+
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs bsdtar\|libarchive-tools
624624
- export PATH=$PATH:$GOPATH/bin
625625
- make release
626626
environment:

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ coverage.all
8080
/public/css
8181
/public/fonts
8282
/public/img/webpack
83+
/web_src/fomantic/node_modules
84+
/web_src/fomantic/.npmrc
85+
/web_src/fomantic/semantic.json
8386
/web_src/fomantic/build/*
8487
!/web_src/fomantic/build/semantic.js
8588
!/web_src/fomantic/build/semantic.css
@@ -93,6 +96,7 @@ coverage.all
9396
!/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2
9497
/VERSION
9598
/.air
99+
/.npm-cache
96100

97101
# Snapcraft
98102
snap/.snapcraft/

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ audit=false
22
fund=false
33
package-lock=true
44
save-exact=true
5+
cache=.npm-cache

Diff for: Makefile

+39-11
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ GO_PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(fi
9191

9292
FOMANTIC_CONFIGS := semantic.json web_src/fomantic/theme.config.less web_src/fomantic/_site/globals/site.variables
9393
FOMANTIC_DEST := web_src/fomantic/build/semantic.js web_src/fomantic/build/semantic.css
94-
FOMANTIC_DEST_DIR := web_src/fomantic/build
94+
FOMANTIC_WORK_DIR := web_src/fomantic
9595

9696
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
9797
WEBPACK_CONFIGS := webpack.config.js
@@ -615,9 +615,9 @@ release-compress: | $(DIST_DIRS)
615615
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
616616

617617
.PHONY: release-sources
618-
release-sources: | $(DIST_DIRS) node_modules
618+
release-sources: | $(DIST_DIRS) npm-cache
619619
echo $(VERSION) > $(STORED_VERSION_FILE)
620-
tar --exclude=./$(DIST) --exclude=./.git --exclude=./$(MAKE_EVIDENCE_DIR) --exclude=./node_modules/.cache --exclude=./$(AIR_TMP_DIR) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
620+
bsdtar --exclude=^./$(DIST) --exclude=^./.git --exclude=^./$(MAKE_EVIDENCE_DIR) --exclude=node_modules --exclude=^./$(AIR_TMP_DIR) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
621621
rm -f $(STORED_VERSION_FILE)
622622

623623
.PHONY: release-docs
@@ -635,6 +635,26 @@ node_modules: package-lock.json
635635
npm install --no-save
636636
@touch node_modules
637637

638+
.PHONY: npm-cache
639+
npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui
640+
641+
.npm-cache: package-lock.json
642+
rm -rf .npm-cache
643+
$(eval ESBUILD_VERSION := `node -p "require('./package-lock.json').dependencies.esbuild.version"`)
644+
$(eval ESBUILD_PKGS := esbuild-{darwin-64,linux-{arm,arm64,32,64},windows-{32,64}}@$(ESBUILD_VERSION))
645+
npm config --userconfig=.npmrc set cache=.npm-cache
646+
rm -rf node_modules && npm install --no-save
647+
npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc set cache=../../.npm-cache
648+
echo $(ESBUILD_PKGS) fsevents@1 fsevents@2 | tr " " "\n" | xargs -n 1 -P 4 npm cache add
649+
rm -rf $(FOMANTIC_WORK_DIR)/node_modules
650+
@touch .npm-cache
651+
652+
.PHONY: npm-uncache
653+
npm-uncache:
654+
rm -rf .npm-cache
655+
rm -f $(FOMANTIC_WORK_DIR)/.npmrc
656+
npm config --userconfig=.npmrc rm cache
657+
638658
.PHONY: npm-update
639659
npm-update: node-check | node_modules
640660
npx updates -cu
@@ -645,14 +665,22 @@ npm-update: node-check | node_modules
645665
.PHONY: fomantic
646666
fomantic: $(FOMANTIC_DEST)
647667

648-
$(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) | node_modules
649-
@if [ ! -d node_modules/fomantic-ui ]; then \
650-
npm install --no-save --no-package-lock fomantic-ui@2.8.7; \
651-
fi
652-
rm -rf $(FOMANTIC_DEST_DIR)
653-
cp -f web_src/fomantic/theme.config.less node_modules/fomantic-ui/src/theme.config
654-
cp -rf web_src/fomantic/_site/* node_modules/fomantic-ui/src/_site/
655-
npx gulp -f node_modules/fomantic-ui/gulpfile.js build
668+
$(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui:
669+
ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR)
670+
cd $(FOMANTIC_WORK_DIR); \
671+
rm -rf node_modules && mkdir node_modules && \
672+
npm install less@3 fomantic-ui --no-package-lock; \
673+
rm -f semantic.json
674+
@touch $(FOMANTIC_WORK_DIR)/node_modules
675+
676+
$(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui
677+
ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR)
678+
rm -rf $(FOMANTIC_WORK_DIR)/build
679+
cd $(FOMANTIC_WORK_DIR); \
680+
cp -f theme.config.less node_modules/fomantic-ui/src/theme.config; \
681+
cp -rf _site node_modules/fomantic-ui/src/; \
682+
npx gulp -f node_modules/fomantic-ui/gulpfile.js build; \
683+
rm -f semantic.json
656684
@touch $(FOMANTIC_DEST)
657685

658686
.PHONY: webpack

Diff for: semantic.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
"themes": "src/themes/"
1010
},
1111
"output": {
12-
"packaged": "../../web_src/fomantic/build/",
13-
"uncompressed": "../../web_src/fomantic/build/components/",
14-
"compressed": "../../web_src/fomantic/build/components/",
15-
"themes": "../../web_src/fomantic/build/themes/"
12+
"packaged": "../../build/",
13+
"uncompressed": "../../build/components/",
14+
"compressed": "../../build/components/",
15+
"themes": "../../build/themes/"
1616
},
17-
"clean": "../../web_src/fomantic/build/"
17+
"clean": "../../build/"
1818
},
1919
"permission": false,
2020
"autoInstall": false,

0 commit comments

Comments
 (0)