Drop build dependency on nodejs #4958

Closed
opened 2025-11-02 06:09:05 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @strk on GitHub (Feb 27, 2020).

Is JS transpilation and lazy-loading, CSS preprocessing and SVG bundling not something a Go module can do? Like https://news.ycombinator.com/item?id=22335707 maybe ?

Introducing a new dependency on nodejs really reduced the appeal of Gitea for me, attracted here by the elegant single-tool compiler (Go)

Originally created by @strk on GitHub (Feb 27, 2020). Is `JS transpilation and lazy-loading, CSS preprocessing and SVG bundling` not something a Go module can do? Like https://news.ycombinator.com/item?id=22335707 maybe ? Introducing a new dependency on nodejs really reduced the appeal of Gitea for me, attracted here by the elegant single-tool compiler (Go)
GiteaMirror added the issue/stale label 2025-11-02 06:09:05 -06:00
Author
Owner

@jolheiser commented on GitHub (Feb 27, 2020):

To be fair, Gitea (and Gogs) have used things like less etc. for an incredibly long time.
However, compiled assets were stored in Git so that they weren't needed for those building from source.

We have some work being done so that we can included pre-compiled assets for releases (https://github.com/go-gitea/gitea/pull/10325), but removing them from Git makes new requests that change these resources much easier.

There are many other benefits of using the existing JS ecosystem for building assets.

@jolheiser commented on GitHub (Feb 27, 2020): To be fair, Gitea (and Gogs) have used things like less etc. for an incredibly long time. However, compiled assets were stored in Git so that they weren't needed for those building from source. We have some work being done so that we can included pre-compiled assets for releases (https://github.com/go-gitea/gitea/pull/10325), but removing them from Git makes new requests that change these resources _much_ easier. There are many other benefits of using the existing JS ecosystem for building assets.
Author
Owner

@strk commented on GitHub (Feb 27, 2020):

I'm only asking if we can have Go, instead of javascript, fetch the required js dependencies, from git repositories, as it's done with Go dependencies

@strk commented on GitHub (Feb 27, 2020): I'm only asking if we can have Go, instead of javascript, fetch the required js dependencies, from git repositories, as it's done with Go dependencies
Author
Owner

@strk commented on GitHub (Feb 27, 2020):

The new backend target doesn't completely help. I'm still left with unusable Gitea unless I somehow fetch those assets from somewhere, and right now fetching assets is still only possible via the frontend rule, which depends on npm/nodejs once again (and not even the version available on my Ubuntu 18.04 system...).

@strk commented on GitHub (Feb 27, 2020): The new `backend` target doesn't completely help. I'm still left with unusable Gitea unless I somehow fetch those assets from somewhere, and right now fetching assets is still only possible via the `frontend` rule, which depends on npm/nodejs once again (and not even the version available on my Ubuntu 18.04 system...).
Author
Owner

@jolheiser commented on GitHub (Feb 27, 2020):

This was the original PR for sources (https://github.com/go-gitea/gitea/pull/10295)

Downloads at https://dl.gitea.io/gitea/ (starting with 1.11.1) now include fully built sources as well.

e.g. https://dl.gitea.io/gitea/1.11.1/gitea-src-1.11.1.tar.gz has the Gitea source, including pre-built assets.

@jolheiser commented on GitHub (Feb 27, 2020): This was the original PR for sources (https://github.com/go-gitea/gitea/pull/10295) Downloads at https://dl.gitea.io/gitea/ (starting with 1.11.1) now include fully built sources as well. e.g. https://dl.gitea.io/gitea/1.11.1/gitea-src-1.11.1.tar.gz has the Gitea source, including pre-built assets.
Author
Owner

@silverwind commented on GitHub (Feb 27, 2020):

IMHO, there is no way around Node.js (and increasingly, webpack) for frontend development.

I took a look at ESbuild but it seems rather limited in what it can bundle (only JS) in comparison to webpack (can do everything) and it's a one-man-show that will likely get eventually abandoned soon. The author even states he's not willing to accept contributions (wtf).

Node.js is not needed for src tarball downloads, only for git builds. make should skip over it so once frontend assets are built, they will not rebuild unless their sources have changes.

@silverwind commented on GitHub (Feb 27, 2020): IMHO, there is no way around Node.js (and increasingly, webpack) for frontend development. I took a look at ESbuild but it seems rather limited in what it can bundle (only JS) in comparison to webpack (can do everything) and it's a one-man-show that will likely get eventually abandoned soon. The author even states he's not willing to accept contributions (wtf). Node.js is not needed for `src` tarball downloads, only for git builds. `make` should skip over it so once frontend assets are built, they will not rebuild unless their sources have changes.
Author
Owner

@stale[bot] commented on GitHub (Apr 28, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 28, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@techknowlogick commented on GitHub (Apr 28, 2020):

Compiled assists are provided as above, and so having nodejs is only required as in the past if you need to make changes to CSS. Removing compiled assets from git itself was because we end up with many PRs that authors disappear from that we are then required to resolve conflicts, or even when we go to merge many PRs we get blocked because each PR would then require the author to recompile the CSS/JS (when we have very powerful CI servers that should be doing repetitive resource consuming tasks like that).

@techknowlogick commented on GitHub (Apr 28, 2020): Compiled assists are provided as above, and so having nodejs is only required as in the past if you need to make changes to CSS. Removing compiled assets from git itself was because we end up with many PRs that authors disappear from that we are then required to resolve conflicts, or even when we go to merge many PRs we get blocked because each PR would then require the author to recompile the CSS/JS (when we have very powerful CI servers that should be doing repetitive resource consuming tasks like that).
Author
Owner

@holgersson32644 commented on GitHub (May 1, 2020):

Hi, gitea 1.11.4 still complains if nodejs is not installed on the building system:
"Gitea requires Node.js 10.0.0 or greater and npm to build. You can get it at https://nodejs.org/en/download/" using the snapshot named gitea-src-1.11.4.tar.gz.

@holgersson32644 commented on GitHub (May 1, 2020): Hi, gitea 1.11.4 still complains if nodejs is not installed on the building system: "Gitea requires Node.js 10.0.0 or greater and npm to build. You can get it at https://nodejs.org/en/download/" using the snapshot named gitea-src-1.11.4.tar.gz.
Author
Owner

@silverwind commented on GitHub (May 1, 2020):

It should work if you run make backend (which only requires go) instead of make build (which required both go and node).

@silverwind commented on GitHub (May 1, 2020): It should work if you run `make backend` (which only requires go) instead of `make build` (which required both go and node).
Author
Owner

@holgersson32644 commented on GitHub (May 1, 2020):

Right, layer8 bug. Thanks a lot for your quick response!

@holgersson32644 commented on GitHub (May 1, 2020): Right, layer8 bug. Thanks a lot for your quick response!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4958