* Added helper functions `load_definitions()` and `load_currency()` on
Context to deduplicate code every frontend had to write out
* Added ToSpans impl for `Result<QueryReply, QueryError>` to avoid a
pointless looking match statement
* Added more examples to the API docs
* Fleshed out the API docs a bit more
Kind of silly that I'm already on the third iteration of the website.
But the previous one was a bit over-engineered and hard to maintain. I
actually can't even get it to compile anymore, it errors out while
trying to build the wasm binary.
So it was either migrate from sapper (which is deprecated and broken) to
svelte-kit (the successor to sapper), or to simplify. I simplified.
The new tech jenga tower is:
- Soupault for building the website
- AsciiDoctor for the pages
- cmark-gfm for processing the markdown in the github releases
- Several plugins and scripts copied from my personal website
- Vite for compiling the javascript
- wasm-pack for building the wasm binary
Rink's website will now be completely static, so operating it is easier.
The javascript and wasm is quarantined to the index page where a rink
repl is active, the other pages are plain html.
The currency fetching is now a totally separate piece of code from the
website. It makes it simpler and requires less code to be loaded during
the regular cron job.
The javascript is way simpler now. It only manipulates the part of the
page that need to be dynamic. It also uses the token format machinery
instead of directly converting rink's output AST to html.
Pros:
- Way lighter, faster page load times.
- Easier to maintain.
- Site contains more information now. An about page, the manual, and a
releases tab with DL links.
- No more URL spam that makes search engines think the site is a content
farm.
- Actually acts as a REPL now so you can run multiple queries, use
`ans`, up/down arrows to re-run previous queries.
- Proper sandboxing - queries that timeout cause the worker to be killed
and restarted.
- Now has a progress indicator on downloading the wasm blob, which is
good on slow connections.
Cons:
- Even more of a custom setup than before.
- It doesn't work offline anymore. At least not until I add a new
service worker, which will be a real pain to debug.
- The interactive parts (the rink REPL) require javascript to work now.
- A lot of the old URLs like `/query/abc` and `/units/meter` are broken.
I think this is fine though. I can add redirects in nginx that point
them to `/?q=abc` and `/?q=meter`.
## Screenshots
### REPL
![image](https://github.com/tiffany352/rink-rs/assets/1254344/7e43fe58-134f-425c-b975-997797fc1af4)
### About page
![image](https://github.com/tiffany352/rink-rs/assets/1254344/d6a34ce5-a357-434c-b7e9-9ddee3884223)
- Set `default-features=false` where applicable
- Use specific num libraries instead of the top-level crate, as some
parts like complex numbers are not used.
- Replace reqwest with curl, which links the system libcurl and libssl
when possible.
- Add `opt-level="z"` and enable LTO for release builds.
All these changes combined, the CLI binary goes from 10.7 megabytes (or
8.7 manually stripped) to 5.4 megabytes.
The wasm binary is unaffected, still around 2.3 megabytes.
I want rink to adhere slightly better to conventions on Linux.
- Adds man pages for the CLI and for the config file format, using
asciidoc.
- Updates the bundling functionality. It doesn't make sense to bundle
these files when building a distro package, they should go in
`/usr/share`.
- Adds a makefile with good defaults for distro packages.
The asciidoc files will likely become the new source of truth for rink's
documentation. There is no way to make PRs to github wikis, so this
might be for the best anyway.
Currently rink is packaged on arch, nix, and void linux.
Much of the code organization and architecture of Rink has been the same since I hacked this project together in 2016. In this PR, I spent about a day moving files around and refactoring code.
I'm hoping that cleaning up the codebase like this will help make it easier to change going forwards. There's a lot of duplicated code, few abstractions are used.
In order to make this not break everything I did it in tiny steps, verifying the test suite each time. The original branch has >30 commits in it as a result.
Most users probably want to manipulate time relative to the present in
their local timezone. This brings rink's functionality closer to similar
tools.
In date(1):
> date -d 'now + 1 hour'
Fri 23 Jul 09:54:02 CEST 2021
Before:
> now
2021-07-23 06:54:05.699222874 +00:00 (now)
> now + 1 hour
2021-07-23 07:54:10.940110380 +00:00 (in an hour)
After:
> now
2021-07-23 08:54:13.219044877 +02:00 (now)
> now + 1 hour
2021-07-23 09:54:15.555096329 +02:00 (in an hour)
* Start over with the web interface
* Add initial stuff
* Extract file+network IO out of rink-core
* Fix cargo warning
* Add tests for rink-web
* Add Serialize to AST types
* Refactor AST
* Split up ast module
* BinOp -> BinOpExpr
* Split out UnaryOpExpr
* Remove Deserialize bound from AST
* Clean up Serialize impl for Numeric
* Convert Expr::Const to struct variant
* Make datetime handling deterministic
* Changes to js API
* Rename rink-web to rink-js
* Add initial npm project
* Add lit-element
* Parse textbox inputs
* Make Expr::Error a variant struct
* Convert Expr::Unit to struct variant
* Don't cache when running npm start
* Convert Expr::Mul to struct variant
* Convert Expr::Date to struct variant
* Convert Expr::Quote to struct variant
* Pretty print json
* Fix warnings
* Switch to svelte
* Remove web components polyfill
* Switch to sapper
* Only load wasm once
* Result component
* Update chrono
* `Utc::now` panics on wasm builds
* Hook up eval
* Disable humanize since it panics in wasm
* SSR test page
* Factor out wasm code into new file
* Make json output better
* Improve json output
* Better json for QueryError
* Add TS definitions for QueryReply
* Render some reply types
* Add proper font
* Add PWA manifest
* Add basic favicon
* Initial styling pass
* Include AST in replies
* Expr component
* Make Numeric json repr more useful
* Indicate approximate values
* Remove duplicate information in definitions
* Split up Result into smaller components
* Search reply
* Add UnitsForReply
* Add UnitListReply
* Add SubstanceReply
* Show dates
* Add DurationReply
* Hook up basic routing
* UI polishing
* Add links to unit pages
* Quantity links
* Split ExprNode and fix whitespace issues
* Fix whitespace issues in NumberParts
* Fix Binop component
* Precedence fixes
* Fix imports
* NumberParts.svelte -> Number.svelte
* Remove App + debug prints
* Fix whitespace in parentheses
* Allow division slash for fractions
* Add home button
* Add aria info
* Improve units for page
* Add links to errors
* Remove rink-irc from workspace
So that cargo test --workspace will work.
* Run all workspace tests in CI
* Remove legacy argument