This repo contains several packages:
@uatp/components
: A library providing a set of Svelte components for building Urban Analytics web applications@uatp/template
: A template which can be used as a starting point for new web apps
@uatp/create-web
: A script which generates a new web app for you using the templateIf you're reading this because you want to use the web template, i.e. make a new app according to what's here, this section is for you.
Firstly, make sure you have both npm
and pnpm
installed.
(You will need it to work on your web app anyway.)
npm create @uatp/web@latest
TODO
If you are looking to develop the UA web template, i.e. make changes to the components, the app template, or the template generation script, this section is for you.
packages/components
: reusable Svelte components for Urban Analytics apps
routes
(the demo site associated with the library) is currently unused, but could be used to demonstrate the componentspackages/create-web
: a script which generates a new web app in a user-specified location from the templatepackages/create-web/template/web
: the template itself
rust_backend
and python_backend
, which are two "backends" that are compiled to WASM and run locally in the browser. The WASM code runs in a web worker (off the main browser thread), and all interaction is done through async calls using Comlink.To get started, you'll need:
The first time you clone this repository, run from the top-level directory:
pnpm install
pnpm --filter @uatp/components build
pnpm --filter uatp_template wasm
pnpm --filter uatp_template build
The --filter ...
flag is used to run a command in a specific package.
This allows you to run the pnpm commands from anywhere inside the repository.
If you are already in the same directory as the package you want to run a command in, you can omit the --filter ...
flag.
In each of the subsequent sections, it is assumed that you are in the directory of the corresponding packages.
If you are not, you can always run the command with the --filter
flag.
@uatp/components
libraryIf the dependencies change: pnpm install
If the library changes: pnpm build
Note that you have to build the library before you can see changes in the template app.
@uatp/template
template appIf the dependencies change: pnpm install
If any code in the Rust backend is changed: pnpm rust
.
(You will have to restart your dev server if it's running.)
If any code in the Python backend is changed: pnpm python
.
To run the template app locally (which'll auto-reload any Svelte/TS changes within, but not Rust changes): pnpm dev
@uatp/create-web
scriptIf the dependencies change: pnpm install
To run the script: npm exec .
(There's no build step for this script.)