Skip to content

Latest commit

 

History

History
129 lines (89 loc) · 3.24 KB

README.md

File metadata and controls

129 lines (89 loc) · 3.24 KB

Public Library Wifi Estimator

This template should help get you started developing with Vue 3 in Vite.

Recommended IDE Setup

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

You should add a .env file for local development, which will provide the app with the URL to the backend server for API requests.

imls-frontend/.env.local:

VITE_BACKEND_BASEURL=http://localhost:3000

If have loaded the sample data via the "setup-for-tests.sh" script in your backend docker container (see the "Optional: Loading test data" section), you may provide a default date override via env variable so that the Library page loads at the most recent date where we have sample data. For now, we have sample data for the month of May 2022:

VITE_DEFAULT_DATE_OVERRIDE=2022-05-31

Compile and Hot-Reload for Development

npm run dev

Compile and Minify for Production

npm run build

If you'd like to run and host the production build locally, install http-server and then host the /imls-frontend/dist folder:

npm install http-server -g
cd dist
http-server

Lint with ESLint

ESLint is available from eslint.org

npm run lint

Kindly lint your branches before opening a PR or merging to main.

Test with Vitest and Vue Test Utils

npm run test

Vitest docs: https://vitest.dev/ Testing Vue components: https://test-utils.vuejs.org/guide/

You can debug using the beta version of the Vue Devtools chrome extension. Set __VUE_PROD_DEVTOOLS__=true in a .env file to enable testing.

Working with Docker

Developing the Application

If you're working in a development environment and you want hot reloads (i.e., when you save a file in your editor, you want the change reflected immediately and without having to rebuild the image), use this:

docker-compose up --build

or

docker build -t pispots . \
&& docker run \
 --rm \
 -p 4000:4000 \
 -v "$(pwd):/app" \
 pispots

The log output will provide the address you may visit to interact with the application on your local system.

Publishing the Application

If you want to publish the application to a Docker image registry, it will need to be built first:

IMAGE_REGISTRY="hostname.of.registry.tld:5000"
IMAGE_ORG="organization-for-image"
IMAGE_NAME="name-of-image"
IMAGE_TAG="latest"

# build the image
docker build -t "${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" .

# login to the registry, if applicable
docker login "${IMAGE_REGISTRY}"

# push the image
docker image push "${IMAGE_REGISTRY}/${IMAGE_ORG}/${IMAGE_NAME}:${IMAGE_TAG}"

The image built in this process will have everything needed to run the application from the container hosting service of your choice.