Skip to content

Commit 538e8a9

Browse files
authored
Rebase the frontend using Vite (#10)
* Docs & Helm * Vite migration done * Fix tests in makefile
1 parent 3764129 commit 538e8a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3574
-15388
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
branches: [main]
1313

1414
env:
15-
VERSION: 0.8.4
15+
VERSION: 0.8.5
1616
BUILD_INFO: "Build:development / Workflow:${{ github.workflow }} / RunId:${{ github.run_id }} / Ref:${{ github.ref }} / SHA:${{ github.sha }} / ImageTag:${{ github.run_id }}"
1717
IMAGE_REG: ghcr.io
1818
IMAGE_TAG: ${{ github.run_id }}

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SERVICE_DIR := cmd
22
FRONTEND_DIR := web/frontend
33
OUTPUT_DIR := ./output
4-
VERSION ?= 0.8.4
4+
VERSION ?= 0.8.5
55
BUILD_INFO ?= "Local makefile build"
66
DAPR_RUN_LOGLEVEL := warn
77

@@ -28,7 +28,7 @@ lint-fix: $(FRONTEND_DIR)/node_modules ## 📝 Lint & format, fixes errors and
2828

2929
test: ## 🎯 Unit tests for services and snapshot tests for SPA frontend
3030
go test -v -count=1 ./$(SERVICE_DIR)/...
31-
@cd $(FRONTEND_DIR); NODE_ENV=test npm run test -- --ci
31+
@cd $(FRONTEND_DIR); npm run test:unit
3232

3333
frontend: $(FRONTEND_DIR)/node_modules ## 💻 Build and bundle the frontend Vue SPA
3434
cd $(FRONTEND_DIR); npm run build
@@ -46,7 +46,7 @@ clean: ## 🧹 Clean the project, remove modules, binaries and outputs
4646
rm -rf $(SERVICE_DIR)/frontend-host/frontend-host
4747

4848
run: ## 🚀 Start & run everything locally as processes
49-
cd $(FRONTEND_DIR); npm run serve &
49+
cd $(FRONTEND_DIR); npm run dev &
5050
dapr run --app-id cart --app-port 9001 --log-level $(DAPR_RUN_LOGLEVEL) go run github.com/azure-samples/dapr-store/cmd/cart &
5151
dapr run --app-id products --app-port 9002 --log-level $(DAPR_RUN_LOGLEVEL) go run github.com/azure-samples/dapr-store/cmd/products ./cmd/products/sqlite.db &
5252
dapr run --app-id users --app-port 9003 --log-level $(DAPR_RUN_LOGLEVEL) go run github.com/azure-samples/dapr-store/cmd/users &

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ See `scripts/local-gateway` for details on how this is done, the `scripts/local-
180180

181181
# Running in Kubernetes - Quick guide
182182

183-
#### [📃 SUB-SECTION: Deployment guide for Kubernetes](./deploy/)
183+
#### [📃 Extra Doc: Deployment guide for Kubernetes](./deploy/)
184184

185185
# Running Locally - Quick guide
186186

@@ -262,7 +262,7 @@ The default mode of operation for the Dapr Store is in "demo mode" where there i
262262

263263
Optionally Dapr store can be configured utilise the [Microsoft identity platform](https://docs.microsoft.com/en-us/azure/active-directory/develop/) (aka Microsoft Entra ID) as an identity provider. This then supports real user sign-in, and securing of the APIs.
264264

265-
#### [📃 SECTION: Full details on security, identity & authentication](./docs/auth-identity/)
265+
#### [📃 Extra Doc: Security, identity & authentication](./docs/auth-identity/)
266266

267267
# Configuration
268268

@@ -300,7 +300,7 @@ Frontend host config:
300300

301301
## Dapr Components
302302

303-
#### [📃 SECTION: Details of the Dapr components used by the application and how to configure them.](components/)
303+
#### [📃 Extra Doc: Dapr components used and how to configure them.](components/)
304304

305305
# Concepts and Terms
306306

build/frontend.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ FROM node:20-alpine as frontend-build
2828
ARG VERSION="0.0.1"
2929
ARG BUILD_INFO="Not provided"
3030

31-
ENV VUE_APP_BUILD_INFO=${BUILD_INFO}
31+
ENV VITE_BUILD_INFO=${BUILD_INFO}
3232
WORKDIR /build
3333

3434
# Install all the Vue.js dev tools & CLI, and our app dependencies
@@ -38,11 +38,13 @@ RUN npm version $VERSION --allow-same-version
3838
RUN npm install --silent
3939

4040
# Copy in the Vue.js app source
41-
COPY web/frontend/.eslintrc.js .
41+
COPY web/frontend/.eslintrc.cjs .
42+
COPY web/frontend/vite.config.js .
43+
COPY web/frontend/index.html .
4244
COPY web/frontend/public ./public
4345
COPY web/frontend/src ./src
4446

45-
# Now main Vue CLI build & bundle, this will output to ./dist
47+
# Now build & bundle, this will output to ./dist
4648
RUN npm run build
4749

4850
# ================================================================================================

deploy/helm/daprstore/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: A reference application showcasing the use of Dapr
55
type: application
66

77
# This is the chart version.
8-
version: 0.8.4
8+
version: 0.8.5
99

1010
# This is the version number of the application being deployed.
11-
appVersion: 0.8.4
11+
appVersion: 0.8.5

deploy/helm/daprstore/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A reference application showcasing the use of Dapr
2020
| frontendHost.replicas | int | `1` | Dapr store frontend host replica count |
2121
| image.pullSecrets | list | `[]` | Any pullsecrets that are required to pull the image |
2222
| image.registry | string | `"ghcr.io"` | Image registry, only change if you're using your own images |
23-
| image.repo | string | `"benc-uk/azure-samples"` | Image repository |
23+
| image.repo | string | `"azure-samples/dapr-store"` | Image repository |
2424
| image.tag | string | `"latest"` | Image tag |
2525
| ingress.certIssuer | string | `nil` | Cert manager issuer, leave unset to run in insecure mode |
2626
| ingress.certName | string | `nil` | Set this to enable TLS, leave unset to run in insecure mode |

deploy/helm/daprstore/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ image:
66
# -- Image registry, only change if you're using your own images
77
registry: ghcr.io
88
# -- Image repository
9-
repo: benc-uk/azure-samples
9+
repo: azure-samples/dapr-store
1010
# -- Image tag
1111
tag: latest
1212
# -- Any pullsecrets that are required to pull the image

deploy/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a brief guide to deploying Dapr Store to Kubernetes.
55
Assumptions:
66

77
- kubectl is installed, and configured to access your Kubernetes cluster
8-
- dapr CLI is installed - https://docs.dapr.io/getting-started/install-dapr-cli/
8+
- Dapr CLI is installed - https://docs.dapr.io/getting-started/install-dapr-cli/
99
- helm is installed - https://helm.sh/docs/intro/install/
1010

1111
This guide does not cover more advanced deployment scenarios such as deploying behind a DNS name, or with HTTPS enabled or with used identity enabled.

docs/auth-identity/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Note. If running a services directly from their own directory i.e. `cmd/cart/` t
5151

5252
[MSAL.js for browser](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser) is used to provide authentication to the web app frontend
5353

54-
To enable auth, when working locally - create the following file `web/frontend/.env.development.local` and set `VUE_APP_AUTH_CLIENT_ID` with your client id. Note the `VUE_APP_` prefix, this is important.
54+
To enable auth, when working locally - create the following file `web/frontend/.env.development.local` and set `VITE_AUTH_CLIENT_ID` with your client id. Note the `VITE_` prefix, this is important.
5555

5656
When served from the frontend-host, the frontend will try to fetch it's configuration from the `/config` endpoint and try to get `AUTH_CLIENT_ID` this way. This allows dynamic configuration of the auth feature at runtime.
5757

@@ -60,7 +60,7 @@ When `AUTH_CLIENT_ID` is set the application behavior changes as follows:
6060
- Login page allows users to register, and sign-in with real user accounts in Azure AD.
6161
- If a user is signed-in, an access token is acquired via the auth service, and used for all API calls made by the frontend to the backend Dapr Store APIs. This token is requested for the scope `store-api`. The fetched access token is then added to the Authorization header of all API calls.
6262

63-
In both cases if `AUTH_CLIENT_ID` is not found at `/config` or if `VUE_APP_AUTH_CLIENT_ID` is not set locally - then the app falls back into "demo user mode" with a fake user account in the frontend.
63+
In both cases if `AUTH_CLIENT_ID` is not found at `/config` or if `VITE_AUTH_CLIENT_ID` is not set locally - then the app falls back into "demo user mode" with a fake user account in the frontend.
6464

6565
# Services & Token Validation
6666

testing/mock-data/products.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
{
33
"id": "prd1",
4-
"name": "Top Hat (6″)",
4+
"name": "Top Hat (6″)",
55
"cost": 39.95,
66
"description": "Made from 100% wool and quite nice",
77
"image": "/img/catalog/1.jpg",
@@ -23,4 +23,4 @@
2323
"image": "/img/catalog/3.jpg",
2424
"onOffer": false
2525
}
26-
]
26+
]

0 commit comments

Comments
 (0)