-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce esbuild on webpack #14578
Introduce esbuild on webpack #14578
Conversation
esbuild is a native dependency which would break the ability to build offline from the I guess it's no big issue because src tarballs already contain prebuilt frontend files so a working build is still possible, but I think we would need to document that the user would have to run |
I really appreciate this pull, because by now the frontend cannot be built successfully on my cloud server for lack of resource when webpack is running. I have to build the frontend on my computer and then upload the target files to the server, and then to build the backend. If this pull request can be merged. I may build the whole project just using one command. |
Should probably just exclude |
Is this related with this PR? All your previous change requests merged. |
I proposed a solution in lunny#12. Improvements are highly welcome. |
It should be because previously, the shipped
Hmm, I'm not sure it's worth the effort as that method would tightly couple us to esbuild and it'd be prone to future breakage if urls or file structure change in esbuild. I'm still thinking we better exclude |
I agree then. I just had the problem with symlinks under Windows with MSYS2 (cross-compilation works) since |
Yeah stuff like this is gets tricky fast. I think all that's needed here is removal of |
Did you mean: .PHONY: release-sources
release-sources: | $(DIST_DIRS) node_modules
echo $(VERSION) > $(STORED_VERSION_FILE)
+++ tar --exclude=./$(DIST) --exclude=./.git --exclude=./$(MAKE_EVIDENCE_DIR) --exclude=./node_modules --exclude=./$(AIR_TMP_DIR) -czf $(DIST)/release/gitea-src-$(VERSION).tar.gz .
--- 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 . ? |
Yes, and diff --git a/README.md b/README.md
index ea0d83c90..4655629ad 100644
--- a/README.md
+++ b/README.md
@@ -76,9 +76,9 @@ or if sqlite support is required:
The `build` target is split into two sub-targets:
- `make backend` which requires [Go 1.13](https://golang.org/dl/) or greater.
-- `make frontend` which requires [Node.js 10.13](https://nodejs.org/en/download/) or greater.
+- `make frontend` which requires [Node.js 10.13](https://nodejs.org/en/download/) or greater and an Internet connection.
If pre-built frontend files are present it is possible to only build the backend:
TAGS="bindata" make backend |
Also, |
So Gitea will not be compiled without Internet any more? |
I think since the official Gitea tarball is only compilable under *nix, consistency wins here (i. e., if not buildable offline in Windows, then leave out the feature completely). We could still resolve to caching all packages (not just esbuild) in a local npm cache through |
It will because frontend ( I'm not totally opposed to lunny#12 any more to retain offline build on all platforms, but it's unfurtunately quite complex. |
I've update the above PR to reflect latest changes. Including a fix for building Fomantic UI (currently fails on every platform due to recent dependency update to The package cache has been tested to work fine on Mac, Windows and Linux (all on x64, didn't have time to test other archs) for building fomantic, frontend (webpack/esbuild) and go. |
Ship esbuild binaries for all platforms in tarball
Just so nobody wonders why I chose to use The main concern at my side is of course macOS support (I work mostly on Macs): |
Any news on this? Have been using this for over a month now. No issues so far, and webpack became blazingly fast on the workstation I'm using (~35 seconds). I mean some sort of milestone would be nice. Also, though hardly anybody is building Fomantic (I did because I wanted to have bold = 600 but that's just me), it's still a bug fixed by this. |
I think it's ready to review and we need two approvals. |
Fix go-gitea#14578 Signed-off-by: Andrew Thornton <art27@cantab.net>
the backticks in the lines above this are also suspect... |
Indeed, that's also not very make-ish. |
* Fix release expansion issue Fix #14578 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix cache statement too Signed-off-by: Andrew Thornton <art27@cantab.net> * and update the npmrcs Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io>
Sorry my bad... Debian uses |
On the other hand, backticks should be POSIX-compliant AFAIK. The bash syntax would have been |
They work in Makefile but it seems to have the side-effect that the command is evaluated on every variable resolution so that |
Well, it seems this is actually a bug with running
This was completely unexpected. I expected this to not have to run at all until it actually gets called in the final command. To my understanding, expansion of this should happen in one go with backticks evaluation preceding other things (like glob). If this is actually the case, it should be considered as a bug as well... |
|
I think we don't need to run the |
Overall, I think we are better off by not shipping npm_cache or node_modules in the tarballs and just state that a offline UI rebuild is not supported from those tarballs (which already contain the pre-built UI). |
I think these issues are really just minor ones due to me not testing things on Debian/Ubuntu. I'll fix them in the next PR. |
Please check the bsdtar error in #14578 (comment). The version on Ubuntu 18.04 does not support |
Sure. I've pushed a branch in https://github.com/CL-Jeremy/gitea some time ago, but am currently working on a rebase. |
I think we just have to drop the bsdtar route on the .drone.yml. bsdtar --help doesn't give any useful information to determine if the option is supported. we can't rely on man bsdtar being present. and I don't think it really adds much. |
bsdtar on ubuntu 18.04 does not support no-xattrs. This means it is unsuitable for use and is currently breaking release. This PR simply removes the bsdtar use from drone but allows users to set TAR="bsdtar --no-xattrs" in future should they wish to use that. Fix go-gitea#14578 (again) Signed-off-by: Andrew Thornton <art27@cantab.net>
I've already pushed another fix. Please comment on that PR: #15256 |
- 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: go-gitea#14578 Fixes: go-gitea#15256 Fixes: go-gitea#15262
- 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: #14578 Fixes: #15256 Fixes: #15262 Co-authored-by: 6543 <6543@obermui.de>
* Fix release expansion issue Fix go-gitea#14578 Signed-off-by: Andrew Thornton <art27@cantab.net> * fix cache statement too Signed-off-by: Andrew Thornton <art27@cantab.net> * and update the npmrcs Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io>
- 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: go-gitea#14578 Fixes: go-gitea#15256 Fixes: go-gitea#15262 Co-authored-by: 6543 <6543@obermui.de>
make the frontend build faster and use less memory. It's about 2x faster than before on my macOS.