rink-rs/web
Tiffany Bennett b921d7a68d
Context refactor (#124)
Yet another giant refactor PR. I'm trying to clean up the Context internals. I moved a lot of the fields into a new Registry object with the hopes of making future refactors to it easier.

A lot of things are poorly named, and I've been going through and updating those. Some of these fields I didn't even know what they did until I studied them carefully, since I'd forgotten over time.

This makes some breaking changes to the Defs serialization format, but I didn't touch Unit or Substance which are the only ones that are used by the backend currently.

Some other refactors I did:
- Updated quantities to no longer reference units, only base units and other quantities.
- Added a debug dump option to the CLI for showing the contents of the Context.
- Merged Def::BaseUnit & Canonicalization.
- Merged Def::Prefix & SPrefix. I don't actually know what SPrefix stood for originally (standalone? definitely not short).
- Prefixes are now required to be dimensionless.
- Added missing tests for the Def serialization format.

I'm not entirely done yet though. There's still one dependency on Context from the loader, which is on the eval() method, used by units and substances. I'm still thinking about how I can reduce that coupling.
2022-04-10 10:37:56 -07:00
..
src Context refactor (#124) 2022-04-10 10:37:56 -07:00
static Change PWA type to standalone 2020-08-29 18:13:25 -07:00
.editorconfig Re-add currency units to rink-web 2020-08-07 20:10:02 -07:00
package-lock.json Quick fix for ECB API no longer including Ruble 2022-03-08 21:19:06 -08:00
package.json Release v0.6.3 2022-03-24 19:35:06 -07:00
README.md Add readme to rink-web 2020-08-06 18:27:59 -07:00
rollup.config.js Quick fix for ECB API no longer including Ruble 2022-03-08 21:19:06 -08:00
svelte.config.js Rink Web 2 (#62) 2020-08-06 16:25:12 -07:00
tsconfig.json Quick fix for ECB API no longer including Ruble 2022-03-08 21:19:06 -08:00

Rink Web

This is a web interface to Rink that works by compiling Rink to WebAssembly. The frontend is written in TypeScript using Svelte + Sapper.

This is a progressive web app, and also supports server side rendering.

Development

Make sure you have Rustup and the latest Stable Rust toolchain.

All the dependencies need to be installed by running:

npm install

Once that's done, you can start the dev server by running:

npm run dev

This will automatically compile Rink to wasm for you. It will detect changes made to rink-js and recompile, but changes to rink-core will require restarting the dev server.

Deployment

To deploy rink-web, there's a couple of steps you'll need to do:

  1. Run npx sapper build build. This will compile the app and put it into build/.
  2. Move your node_modules out of the way and run npm install --production to get just the production dependencies.
  3. Copy build/, node_modules/ and static/ to your web server.
  4. Run node build/ to start the server. It will respect the PORT and NODE_ENV environment variables, which default to 3000 and production respectively.

The following directories can be served statically, as long as there's still a fallback that reverse proxies the node server:

  • static/ is mounted on /.
  • build/client/ is mounted on /client/.