feat(frontend) :: upgrade to typescript - #1382
Open
81reap wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
there is a lot more optimisations and type safety we can do here but i tried to keep it 1:1 ish so that its easy to review |
This was referenced Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(frontend) :: upgrade to typescript
Motivation
build.rsreads.jsand.cssfiles for top level comments to create a custom installer for 3rd party deps./* !include https://cdn.jsdelivr.net/npm/@tabler/core@1.4.0/dist/js/tabler.min.js */This resulted in a few issues ::
cargo buildrequires a network to finish successfully. This also requires pulling in deps likeawc,rustls, andactix-rt.cargo build.sqlpage.jsto be a global.DOCS_RSwas set,build.rswould return early and ship broken assets.What changed
sqlpage/sqlpage.jsfrontend/src/sqlpage.tssqlpage/apexcharts.jsfrontend/src/apexcharts.ts+frontend/src/chart_series.tssqlpage/tomselect.jsfrontend/src/tomselect.tssqlpage/sqlpage.cssfrontend/src/sqlpage.csssqlpage/favicon.svgfrontend/src/favicon.svgsqlpage/globals.d.tsfrontend/types/globals.d.tssqlpage/tabler-icons.svgThe frontend is now built through
frontend/build.mjs, an esbuild script, which builds with proper attribution and outputs tofrontend/dist.build.rsnow only compresses and hashes the output files.Benefits
cargo buildno longer touches the network. npm handles installing frontend deps.docs.rs gets assets because
frontend/distships in the crate. Verified withcargo package --list.The browser code is type-checked as against published 3rd party types (eg ::
apexchartsandtom-select).Frontend can now be updated via
npm updaterather than manual comment updates. 3rd party packages are still pinned at the current versions.The served bundles are slightly smaller, because esbuild:
sqlpage.jsapexcharts.jssqlpage.csstomselect.jstomselect.jsgrew because we now bundle@orchidjs/sifterfrom source rather than taking tom-select's prebuilt file.Downsides & How to avoid them
npm ci && npm run buildbefore runningcargo build. There is no easy path to hot reload the entire app.frontend/distfolder but then we would run the risk of committing outdated files if folks don't build before committing.flake.nixfixes this and I would be happy to make a follow up PR to add one.build.mjssqlpage_table()or reached forwindow.tabler.Testing