From 228b5203a8b0ccbf1851c11988801244d950868e Mon Sep 17 00:00:00 2001 From: Aram Becker Date: Thu, 4 May 2023 23:52:36 +0200 Subject: [PATCH] Feature: use nuxt bridge to bundle client --- .dockerignore | 1 + .gitignore | 1 + Dockerfile | 6 +- client/components/app/ConfigSideNav.vue | 10 +- client/components/app/SideRail.vue | 10 +- client/components/covers/AuthorImage.vue | 2 +- .../components/modals/player/QueueItemRow.vue | 2 +- .../modals/rssfeed/OpenCloseModal.vue | 2 +- client/components/readers/EpubReader.vue | 28 +- client/layouts/default.vue | 2 +- client/nitro.entry.js | 17 + client/nitro.preset.js | 7 + client/nuxt.config.js | 69 +- client/package-lock.json | 28061 +++++----------- client/package.json | 23 +- client/pages/audiobook/_id/chapters.vue | 2 +- client/plugins/axios.js | 4 +- client/plugins/favicon.js | 2 +- client/plugins/init.client.js | 2 +- package-lock.json | 1 + package.json | 3 +- server/Server.js | 2 +- server/routers/ClientRouter.js | 10 +- 23 files changed, 8484 insertions(+), 19783 deletions(-) create mode 100644 client/nitro.entry.js create mode 100644 client/nitro.preset.js diff --git a/.dockerignore b/.dockerignore index b1c626aaf..cbc18c6ce 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,6 +14,7 @@ npm-debug.log dev.js test/ /client/.nuxt/ +/client/.output/ /client/dist/ /dist/ /build/ diff --git a/.gitignore b/.gitignore index 25a8a7746..239b9544b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ /metadata/ test/ /client/.nuxt/ +/client/.output/ /client/dist/ /dist/ /deploy/ diff --git a/Dockerfile b/Dockerfile index 55a17f39b..ad3716776 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,16 +23,12 @@ RUN apk update && \ COPY --from=tone /usr/local/bin/tone /usr/local/bin/ COPY package* ./ -COPY --from=build /client/package*.json client/ RUN npm ci --omit=dev -RUN cd client && npm ci --omit=dev && cd .. COPY index.js package* ./ COPY server server -COPY --from=build /client/nuxt.config.js* client/ -COPY --from=build /client/.nuxt client/.nuxt -COPY --from=build /client/modules client/modules +COPY --from=build /client/.output ./client/.output EXPOSE 80 HEALTHCHECK \ diff --git a/client/components/app/ConfigSideNav.vue b/client/components/app/ConfigSideNav.vue index af4645f4b..52565060b 100644 --- a/client/components/app/ConfigSideNav.vue +++ b/client/components/app/ConfigSideNav.vue @@ -10,12 +10,12 @@
- -
+ + -
-
-

v{{ $config.version }}

+
+
+

v{{ $config.public.version }}

{{ Source }}

diff --git a/client/components/app/SideRail.vue b/client/components/app/SideRail.vue index 995f4c232..b11e0357b 100644 --- a/client/components/app/SideRail.vue +++ b/client/components/app/SideRail.vue @@ -114,12 +114,12 @@
-

v{{ $config.version }}

- Update -

{{ Source }}

-
+

v{{ $config.public.version }}

+ Update +

{{ Source }}

+
- +
diff --git a/client/components/covers/AuthorImage.vue b/client/components/covers/AuthorImage.vue index c3cafaea0..311efb314 100644 --- a/client/components/covers/AuthorImage.vue +++ b/client/components/covers/AuthorImage.vue @@ -58,7 +58,7 @@ export default { if (!this.imagePath) return null if (process.env.NODE_ENV !== 'production') { // Testing - return `http://localhost:3333${this.$config.routerBasePath}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` + return `http://localhost:3333${this.$config.public.routerBasePath}/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` } return `/api/authors/${this.authorId}/image?token=${this.userToken}&ts=${this.updatedAt}` } diff --git a/client/components/modals/player/QueueItemRow.vue b/client/components/modals/player/QueueItemRow.vue index 2acc4a635..ccf4222fd 100644 --- a/client/components/modals/player/QueueItemRow.vue +++ b/client/components/modals/player/QueueItemRow.vue @@ -55,7 +55,7 @@ export default { return this.item.coverPath }, coverUrl() { - if (!this.coverPath) return `${this.$config.routerBasePath}/book_placeholder.jpg` + if (!this.coverPath) return `${this.$config.public.routerBasePath}/book_placeholder.jpg` return this.$store.getters['globals/getLibraryItemCoverSrcById'](this.libraryItemId) }, bookCoverAspectRatio() { diff --git a/client/components/modals/rssfeed/OpenCloseModal.vue b/client/components/modals/rssfeed/OpenCloseModal.vue index f5fe647ca..5c22e8c8b 100644 --- a/client/components/modals/rssfeed/OpenCloseModal.vue +++ b/client/components/modals/rssfeed/OpenCloseModal.vue @@ -137,7 +137,7 @@ export default { slug: this.newFeedSlug, metadataDetails: this.metadataDetails } - if (this.$isDev) payload.serverAddress = `http://localhost:3333${this.$config.routerBasePath}` + if (this.$isDev) payload.serverAddress = `http://localhost:3333${this.$config.public.routerBasePath}` console.log('Payload', payload) this.$axios diff --git a/client/components/readers/EpubReader.vue b/client/components/readers/EpubReader.vue index 20b8f203c..eab8644f2 100644 --- a/client/components/readers/EpubReader.vue +++ b/client/components/readers/EpubReader.vue @@ -1,26 +1,26 @@