Просмотр исходного кода

Maintenance: Relocate vite build files and fonts.css for better caching from reverse proxy.

Martin Gruner 1 год назад
Родитель
Сommit
0003d3c66d

+ 1 - 1
.cypress/support/component-index.html

@@ -4,7 +4,7 @@
     <meta charset="utf-8" />
     <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     <meta name="viewport" content="width=device-width,initial-scale=1.0" />
-    <link rel="stylesheet" href="/fonts.css">
+    <link rel="stylesheet" href="/assets/mobile/fonts.css">
     <title>Zammad</title>
   </head>
   <body class="bg-black font-sans text-sm text-white antialiased">

+ 2 - 2
.eslintignore

@@ -8,5 +8,5 @@ app/frontend/shared/graphql/types.ts
 public/assets/tests/**/*.js
 public/assets/form/**/*.js
 
-public/vite/**/*.js
-public/vite-dev/**/*.js
+public/assets/mobile/vite/**/*.js
+public/assets/mobile/vite-dev/**/*.js

+ 2 - 4
.gitignore

@@ -47,6 +47,8 @@
 # logfiles and tempfiles
 /log
 /public/assets/*.*
+/public/assets/mobile/vite
+/public/assets/mobile/vite-dev
 /public/assets/addons
 /public/assets/app
 /public/assets/custom
@@ -91,10 +93,6 @@
 # Backup files
 *~
 
-# Vite Ruby
-/public/vite
-/public/vite-dev
-
 # Vite PWA
 /app/frontend/dev-dist
 

+ 4 - 0
.gitlab/ci/review-app.yml

@@ -115,6 +115,10 @@
             "name": "product_name",
             "value": "Zammad Review App ${APP_NAME}"
           },
+          {
+            "name": "http_type",
+            "value": "http"
+          },
           {
             "name": "fqdn",
             "value": "${APP_FQDN}"

+ 1 - 1
.gitlab/ci/test/browser_build.yml

@@ -9,7 +9,7 @@ browser:build:
       - public/assets/application-*
       - public/assets/knowledge_base*
       - public/assets/print-*
-      - public/vite
+      - public/assets/mobile/vite
   cache: !reference [.cache, read_only_full]
   variables:
     RAILS_ENV: 'production'

+ 2 - 2
.stylelintrc.json

@@ -44,8 +44,8 @@
     "public/assets/*.css",
     "public/assets/chat/chat.css",
     "public/assets/doorkeeper/**",
-    "public/vite-dev/**",
-    "public/vite/**",
+    "public/assets/mobile/vite-dev/**",
+    "public/assets/mobile/vite/**",
     "**/reset*.css",
     "**/bootstrap*.css",
     "**/codemirror.css",

+ 3 - 3
app/controllers/mobile_controller.rb

@@ -27,9 +27,9 @@ class MobileController < ApplicationController
         display:          'standalone',
         start_url:        '/mobile/',
         icons:            [
-          # files a relative to manifest.webmanifest and are stored in public/
-          { src: '../app-icon-512.png', sizes: '512x512', type: 'image/png' },
-          { src: '../app-icon-192.png', sizes: '192x192', type: 'image/png' },
+          # files are relative to manifest.webmanifest and are stored in public/assets/mobile
+          { src: '../assets/mobile/app-icon-512.png', sizes: '512x512', type: 'image/png' },
+          { src: '../assets/mobile/app-icon-192.png', sizes: '192x192', type: 'image/png' },
         ]
       },
       content_type: 'application/manifest+json'

+ 1 - 1
app/frontend/shared/sw/register.ts

@@ -29,7 +29,7 @@ export const registerSW = (options: RegisterSWOptions) => {
       onNeedRefresh?.()
     }
     // you can disable service worker in development mode by running in console: pwa.enable()
-    // you can enable service worker, it will point to /public/vite-dev/sw.js
+    // you can enable service worker, it will point to /public/assets/mobile/vite-dev/sw.js
     // don't forget to unregister service worker, when you are done in console: pwa.disable()
     if (!sw.isEnabled()) {
       return () => {

+ 1 - 1
app/graphql/gql/queries/application_build_checksum.rb

@@ -15,7 +15,7 @@ module Gql::Queries
       # Use a stable identifier for the development environment, as we use hot reloading there instead.
       return 'development-auto-build' if Rails.env.development?
 
-      filename = Rails.public_path.join('vite/manifest.json')
+      filename = Rails.public_path.join('assets/mobile/vite/manifest.json')
       Digest::MD5.hexdigest(File.read(filename))
     end
 

+ 1 - 1
app/views/layouts/mobile.html.erb

@@ -8,7 +8,7 @@
     <link rel="manifest" href="/mobile/manifest.webmanifest" />
     <link rel="shortcut icon" href="/favicon.ico">
     <link rel="apple-touch-icon" href="/apple-touch-icon.png">
-    <%= stylesheet_link_tag '/fonts.css', nonce: true %>
+    <%= stylesheet_link_tag '/assets/mobile/fonts.css', nonce: true %>
     <%= csrf_meta_tags %>
     <%= csp_meta_tag %>
     <%= action_cable_meta_tag %>

Некоторые файлы не были показаны из-за большого количества измененных файлов