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
Assignees
Labels

Comments

@jamalc
Copy link
Member

@jamalc 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

  • #43359: migrating to typescript with esbuild
  • #43360: transforming styles with PostCSS
  • #43361: frontend testing strategy
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 28, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 28, 2020

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 Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.