x/pkgsite: migrating to typescript #43359
Open
Comments
This was referenced Dec 24, 2020
This was referenced Dec 24, 2020
Change https://golang.org/cl/280705 mentions this issue: |
gopherbot
pushed a commit
to golang/pkgsite
that referenced
this issue
Dec 30, 2020
Adds dependencies for PostCSS and TypeScript with build and develop scripts that use them in package.json. Removes tsconfig parser option from eslintrc because it interferes with a change in the tsconfig to exclude test files. We want eslint to still lint test files. This is okay for now because none of our lint rules depend on type information. If we add rules that require type info we can create a separate tsconfig for eslint. This change adds TypeScript but not esbuild. It is not clear that we need minification so we will start with just the TypeScript compiler for now. Looking at some of the sources we currently minify with the closure compiler typical savings in a file is less than 1kb. Once we have some TypeScript code to compare minified and unminified performance with we can consider adding esbuild or some other minifier. For golang/go#43359 For golang/go#43360 Change-Id: I1a181952f546b0a0eb9b755128b2b83481e8ed92 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280705 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Jamal Carvalho <jamal@golang.org>
Change https://golang.org/cl/280893 mentions this issue: |
gopherbot
pushed a commit
to golang/pkgsite
that referenced
this issue
Jan 5, 2021
Migrates CopyToClipboardController to TypeScript and adds a unit test. For golang/go#43359 For golang/go#43361 Change-Id: I2e1179aa7cecb0e280a57d420ee2f885c4d6db3c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280893 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Jamal Carvalho <jamal@golang.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We're working to improve frontend development ergonomics for pkgsite. This is the second in a series of issues about our plans. Comment below with any feedback or suggestions related to this issue!
Summary
New frontend code for pkgsite will be written in TypeScript and existing code will be ported over piecemeal. TypeScript code will be compiled and minified with esbuild and the Closure Compiler will be removed from our build process.
Details
As a command line tool esbuild can compile our TypeScript into JavaScript with no additional configuration. A one line command is all that’s needed to compile the code, minify it, and create source maps.
esbuild content/static/ts --minify --sourcemap --outdir=content/static/js.
In development mode esbuild will start a web server that serves compiled assets from the provided port. Requests for frontend assets will be proxied to this server during development.
esbuild content/static/ts --sourcemap=inline --serve=localhost:5000
Given our browser support matrix and the user agents visiting us, we plan to migrate fully to JavaScript Modules (<script type="module">) and serve JavaScript assets unbundled.
Related Issues
The text was updated successfully, but these errors were encountered: