Skip to content
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

x/pkgsite: using npm packages for frontend development #43358

Closed
jamalc opened this issue Dec 24, 2020 · 2 comments
Closed

x/pkgsite: using npm packages for frontend development #43358

jamalc opened this issue Dec 24, 2020 · 2 comments
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

Comments

@jamalc
Copy link

jamalc commented Dec 24, 2020

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

@gopherbot
Copy link

Change https://golang.org/cl/280598 mentions this issue: devtools: update frontend development environment config

@gopherbot
Copy link

Change https://golang.org/cl/280599 mentions this issue: root: setup linting config for typescript and css

gopherbot pushed a commit to golang/pkgsite that referenced this issue Dec 29, 2020
Installs dependencies for typescript and stylelint and
adds scripts to package.json for linting code. The linter
will ignore code in content/static for now. A new directory
to be added, content/lib, will contain the typescript and
unprocessed css files.

For golang/go#43358

Change-Id: I6ee74665a99af8938df6f1ee675c8705fcce589c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280599
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
Trust: Jamal Carvalho <jamal@golang.org>
@jamalc jamalc closed this as completed Jan 15, 2021
@golang golang locked and limited conversation to collaborators Jan 15, 2022
@hyangah hyangah added the pkgsite/frontend Issues related to pkgsite HTML/CSS/JavaScript and frontend development label May 20, 2022
@rsc rsc unassigned jamalc Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

3 participants