x/pkgsite: using npm packages for frontend development #43358
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
pkgsite/frontend
Issues related to pkgsite HTML/CSS/JavaScript and frontend development
pkgsite
Milestone
We're working to improve frontend development ergonomics for pkgsite. This is the first in a series of issues about our plans. Comment below with any feedback or suggestions related to this issue!
The Go team has taken a philosophical stance against ballooning dependencies (https://research.swtch.com/deps). As a result we’ve tried to minimize our use of npm packages with a general rule of not adding them.
The amount of JavaScript needed to implement interactive pkgsite features and meet our accessibility standards is non-trivial. It's important to prevent regressions and maintain a high standard of quality in this code. Today, JavaScript code on pkgsite is tested manually on an ad-hoc basis. Code format and style issues reduce the speed of code review. Fixing these problems without npm is possible but a lot of really useful tooling in the frontend development ecosystem is written with JavaScript and managed with npm.
To enable the use of industry standard frontend development tools, we’re planning to update the pkgsite process for building and testing web assets (scripts, css, images, html) to depend on a minimal set of npm packages. Our plan is to limit this set to development dependencies and no code from node modules will be imported into the JavaScript we serve on pkgsite.
A script will be added to the devtools directory that will install packages and run npm scripts from a node binary installed within a docker container. Installing and using these tools will be optional for contributors that only make changes to non-frontend code and we'll continue to check the distributable frontend assets into the repository.
Related Issues
The text was updated successfully, but these errors were encountered: