From 59e5d87884a429b57c22892b1f420eb4ae19cd0e Mon Sep 17 00:00:00 2001
From: Rotzbua
Date: Tue, 8 Aug 2023 10:57:09 +0200
Subject: [PATCH 1/4] feat(webapp): migrate to `vite`
Vite is faster than the old `vue-cli`. For new `vue` projects it is the default build system.
https://vitejs.dev/
---
docker: change env vars to `vite` schema
* Replace prefix `VUE_` by `VITE_`.
* Update option to not delete output dir.
* Remove unused environment variables
---
docker-compose.dev.yml | 14 +++++------
www/Dockerfile | 12 +++++-----
www/webapp/.eslintrc.js | 1 -
www/webapp/README.md | 4 ++--
www/webapp/babel.config.js | 5 ----
www/webapp/{public => }/index.html | 5 ++--
www/webapp/package.json | 21 +++++++---------
www/webapp/postcss.config.js | 5 ----
www/webapp/src/App.vue | 2 +-
.../ActivateAccountActionHandler.vue | 2 +-
.../src/components/DonateDirectDebitForm.vue | 4 ++--
www/webapp/src/router/index.js | 2 +-
www/webapp/src/views/DomainSetup.vue | 4 ++--
www/webapp/src/views/DynSetup.vue | 2 +-
www/webapp/src/views/HomePage.vue | 2 +-
www/webapp/src/views/ImpressumPage.vue | 2 +-
www/webapp/src/views/PrivacyPolicy.vue | 2 +-
www/webapp/src/views/SignUp.vue | 2 +-
www/webapp/vite.config.js | 24 +++++++++++++++++++
www/webapp/vue.config.js | 17 -------------
20 files changed, 62 insertions(+), 70 deletions(-)
delete mode 100644 www/webapp/babel.config.js
rename www/webapp/{public => }/index.html (87%)
delete mode 100644 www/webapp/postcss.config.js
create mode 100644 www/webapp/vite.config.js
delete mode 100644 www/webapp/vue.config.js
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index 37c901a82..1c43d5312 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -70,15 +70,13 @@ services:
volumes:
- ./www/webapp/:/usr/src/app/
working_dir: /usr/src/app/
- command: bash -c "npm install && npm run serve --fix"
+ command: bash -c "npm install && npm run dev -- --host"
environment:
- - CODESANDBOX_SSE=1 # so that ws: protocol ends up as auto: in node_modules/@vue/cli-service/lib/commands/serve.js
- - CYPRESS_CACHE_FOLDER=/tmp/.cache # https://github.com/cypress-io/cypress/issues/1281#issuecomment-404823001
- - VUE_APP_DESECSTACK_NS=${DESECSTACK_NS}
- - VUE_APP_DESECSTACK_API_SEPA_CREDITOR_ID=${DESECSTACK_API_SEPA_CREDITOR_ID}
- - VUE_APP_DESECSTACK_API_SEPA_CREDITOR_NAME=${DESECSTACK_API_SEPA_CREDITOR_NAME}
- - VUE_APP_LOCAL_PUBLIC_SUFFIXES=dedyn.${DESECSTACK_DOMAIN}
- - VUE_APP_EMAIL=support@desec.${DESECSTACK_DOMAIN}
+ - VITE_APP_DESECSTACK_NS=${DESECSTACK_NS}
+ - VITE_APP_DESECSTACK_API_SEPA_CREDITOR_ID=${DESECSTACK_API_SEPA_CREDITOR_ID}
+ - VITE_APP_DESECSTACK_API_SEPA_CREDITOR_NAME=${DESECSTACK_API_SEPA_CREDITOR_NAME}
+ - VITE_APP_LOCAL_PUBLIC_SUFFIXES=dedyn.${DESECSTACK_DOMAIN}
+ - VITE_APP_EMAIL=support@desec.${DESECSTACK_DOMAIN}
networks:
- rearwebapp
logging:
diff --git a/www/Dockerfile b/www/Dockerfile
index 0472208ac..bd7dac91f 100644
--- a/www/Dockerfile
+++ b/www/Dockerfile
@@ -14,14 +14,14 @@ ARG DESECSTACK_API_SEPA_CREDITOR_ID
ARG DESECSTACK_API_SEPA_CREDITOR_NAME
ARG DESECSTACK_DOMAIN
ARG DESECSTACK_NS
-ENV VUE_APP_DESECSTACK_NS=${DESECSTACK_NS} \
- VUE_APP_DESECSTACK_API_SEPA_CREDITOR_ID=${DESECSTACK_API_SEPA_CREDITOR_ID} \
- VUE_APP_DESECSTACK_API_SEPA_CREDITOR_NAME=${DESECSTACK_API_SEPA_CREDITOR_NAME} \
- VUE_APP_LOCAL_PUBLIC_SUFFIXES=dedyn.${DESECSTACK_DOMAIN} \
- VUE_APP_EMAIL=support@desec.${DESECSTACK_DOMAIN}
+ENV VITE_APP_DESECSTACK_NS=${DESECSTACK_NS} \
+ VITE_APP_DESECSTACK_API_SEPA_CREDITOR_ID=${DESECSTACK_API_SEPA_CREDITOR_ID} \
+ VITE_APP_DESECSTACK_API_SEPA_CREDITOR_NAME=${DESECSTACK_API_SEPA_CREDITOR_NAME} \
+ VITE_APP_LOCAL_PUBLIC_SUFFIXES=dedyn.${DESECSTACK_DOMAIN} \
+ VITE_APP_EMAIL=support@desec.${DESECSTACK_DOMAIN}
COPY webapp/ /usr/src/app/
-RUN npm run build -- --no-clean
+RUN npm run build -- --emptyOutDir false
FROM nginx:mainline-alpine
diff --git a/www/webapp/.eslintrc.js b/www/webapp/.eslintrc.js
index 60da170fe..a3e7cb51f 100644
--- a/www/webapp/.eslintrc.js
+++ b/www/webapp/.eslintrc.js
@@ -5,7 +5,6 @@ module.exports = {
root: true,
env: {
browser: true,
- node: true, // Can be removed after migration to vite.
es2024: true,
},
parserOptions: {
diff --git a/www/webapp/README.md b/www/webapp/README.md
index fca5fd285..491f62baf 100644
--- a/www/webapp/README.md
+++ b/www/webapp/README.md
@@ -7,7 +7,7 @@ npm install
### Compiles and hot-reloads for development
```
-npm run serve
+npm run dev
```
### Compiles and minifies for production
@@ -21,4 +21,4 @@ npm run lint
```
### Customize configuration
-See [Configuration Reference](https://cli.vuejs.org/config/).
+See [Configuration Reference](https://vitejs.dev/config/).
diff --git a/www/webapp/babel.config.js b/www/webapp/babel.config.js
deleted file mode 100644
index e9558405f..000000000
--- a/www/webapp/babel.config.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = {
- presets: [
- '@vue/cli-plugin-babel/preset'
- ]
-}
diff --git a/www/webapp/public/index.html b/www/webapp/index.html
similarity index 87%
rename from www/webapp/public/index.html
rename to www/webapp/index.html
index 185d6721a..fb509da35 100644
--- a/www/webapp/public/index.html
+++ b/www/webapp/index.html
@@ -3,8 +3,8 @@
-
-
+
+
deSEC – Free Secure DNS
@@ -26,6 +26,7 @@ 🛑 Warning
+