From 2274c9b5999507a96f781ee5d5ba1501b00036e5 Mon Sep 17 00:00:00 2001
From: Anton Lantukh
Date: Thu, 6 Jul 2023 12:22:15 +0200
Subject: [PATCH 1/5] fix(seo): fix seo score
---
public/locales/en/common.json | 1 +
public/locales/en/demo.json | 1 +
public/locales/es/common.json | 1 +
public/locales/es/demo.json | 1 +
src/components/DemoConfigDialog/DemoConfigDialog.tsx | 11 ++++++++++-
.../__snapshots__/DemoConfigDialog.test.tsx.snap | 3 ++-
src/containers/Layout/Layout.tsx | 7 ++++---
7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 62b035bbf..f02640f48 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -12,6 +12,7 @@
"confirm": "Yes"
},
"default_site_name": "My OTT Application",
+ "default_description": "JW OTT Webapp is an open-source, dynamically generated video website.",
"filter_videos_by": "Filter videos by {{name}}",
"filter_videos_by_genre": "Filter videos by genre",
"home": "Home",
diff --git a/public/locales/en/demo.json b/public/locales/en/demo.json
index ba40a298e..2e53ab3cc 100644
--- a/public/locales/en/demo.json
+++ b/public/locales/en/demo.json
@@ -1,5 +1,6 @@
{
"app_config_not_found": "Invalid or Missing App Config",
+ "app_config_learn_more": "Learn more about the App Config creation",
"cancel_config_id": "Cancel",
"click_to_unselect_config": "(click here to unselect this config)",
"currently_previewing_config": "You are currently previewing config: '{{configSource}}'",
diff --git a/public/locales/es/common.json b/public/locales/es/common.json
index b614b872b..79dd8fc24 100644
--- a/public/locales/es/common.json
+++ b/public/locales/es/common.json
@@ -12,6 +12,7 @@
"confirm": "Sí"
},
"default_site_name": "Mi aplicación OTT",
+ "default_description": "",
"filter_videos_by": "Filtrar videos por {{name}}",
"filter_videos_by_genre": "Filtrar videos por género",
"home": "Inicio",
diff --git a/public/locales/es/demo.json b/public/locales/es/demo.json
index a85af0d08..3c364c192 100644
--- a/public/locales/es/demo.json
+++ b/public/locales/es/demo.json
@@ -1,5 +1,6 @@
{
"app_config_not_found": "Configuración de aplicación inválida o no encontrada",
+ "app_config_learn_more": "",
"cancel_config_id": "Cancelar",
"click_to_unselect_config": "(haz clic aquí para deseleccionar esta configuración)",
"currently_previewing_config": "Actualmente estás previsualizando la configuración: '{{configSource}}'",
diff --git a/src/components/DemoConfigDialog/DemoConfigDialog.tsx b/src/components/DemoConfigDialog/DemoConfigDialog.tsx
index 33aa9837d..89931e06a 100644
--- a/src/components/DemoConfigDialog/DemoConfigDialog.tsx
+++ b/src/components/DemoConfigDialog/DemoConfigDialog.tsx
@@ -2,6 +2,7 @@ import React, { ChangeEventHandler, MouseEventHandler, useEffect, useState } fro
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router';
import type { UseQueryResult } from 'react-query';
+import { Helmet } from 'react-helmet';
import styles from './DemoConfigDialog.module.scss';
@@ -136,16 +137,24 @@ const DemoConfigDialog = ({ selectedConfigSource, configQuery }: Props) => {
return (
<>
+ {!configQuery.isSuccess && (
+
+
+
+ )}
{configQuery.isSuccess && (
{t('currently_previewing_config', { configSource: selectedConfigSource })}
-
{t('click_to_unselect_config')}
+
+ {t('click_to_unselect_config')}
+
)}
{!configQuery.isSuccess && (
diff --git a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
index 65169612e..dab7a1af6 100644
--- a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
+++ b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
@@ -10,6 +10,7 @@ exports[` > renders and matches snapshot 1`] = `
click_to_unselect_config
@@ -104,7 +105,7 @@ exports[` > renders and matches snapshot error dialog 1`] = `
rel="noreferrer"
target="_blank"
>
- learn_more
+ app_config_learn_more
diff --git a/src/containers/Layout/Layout.tsx b/src/containers/Layout/Layout.tsx
index 81420583d..ad2621a8c 100644
--- a/src/containers/Layout/Layout.tsx
+++ b/src/containers/Layout/Layout.tsx
@@ -26,6 +26,7 @@ const Layout = () => {
const { t, i18n } = useTranslation('common');
const { config, accessModel } = useConfigStore(({ config, accessModel }) => ({ config, accessModel }), shallow);
const { menu, assets, siteName, description, styling, features } = config;
+ const metaDescription = description || t('default_description');
const { clientId } = useClientIntegration();
const { searchPlaylist } = features || {};
const { footerText } = styling || {};
@@ -105,11 +106,11 @@ const Layout = () => {
{siteName}
-
-
+
+
-
+
Date: Wed, 12 Jul 2023 10:07:58 +0200
Subject: [PATCH 2/5] feat(project): lighthouse check
---
.github/workflows/firebase-live.yml | 4 ++--
.github/workflows/firebase-preview.yml | 8 +++++---
.github/workflows/lhci.yml | 24 +++++++++++-------------
lighthouserc.js | 20 +++++++++++++-------
public/locales/en/demo.json | 2 +-
5 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/.github/workflows/firebase-live.yml b/.github/workflows/firebase-live.yml
index 9464ba0b7..910122865 100644
--- a/.github/workflows/firebase-live.yml
+++ b/.github/workflows/firebase-live.yml
@@ -16,6 +16,6 @@ jobs:
run: yarn && MODE=demo yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
- repoToken: "${{ secrets.GITHUB_TOKEN }}"
- firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
+ repoToken: '${{ secrets.GITHUB_TOKEN }}'
+ firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml
index d88b71cbf..ba203b262 100644
--- a/.github/workflows/firebase-preview.yml
+++ b/.github/workflows/firebase-preview.yml
@@ -2,7 +2,7 @@ name: 'Firebase Preview'
on:
pull_request:
- branches: [ 'develop', 'feat/*', 'feature/*' ]
+ branches: ['develop', 'feat/*', 'feature/*', 'release']
jobs:
build_and_preview:
@@ -15,6 +15,8 @@ jobs:
run: yarn && MODE=preview yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
- repoToken: "${{ secrets.GITHUB_TOKEN }}"
- firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
+ repoToken: '${{ secrets.GITHUB_TOKEN }}'
+ firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 30d
+ - name: Export url
+ run: echo urls ${{steps.firebase_hosting_preview.outputs.url}}
diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml
index 153fe1caf..a9c28fae5 100644
--- a/.github/workflows/lhci.yml
+++ b/.github/workflows/lhci.yml
@@ -1,22 +1,20 @@
name: Lighthouse
-on: [workflow_dispatch]
+
+on:
+ workflow_run:
+ workflows: ['Firebase Preview']
+ types:
+ - completed
+
jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Use Node.js 18.x
- uses: actions/setup-node@v1
- with:
- node-version: 18.x
- - name: yarn install, build
- run: |
- yarn install
- yarn run build
- name: install Lighthouse CI
run: |
- sudo yarn global add @lhci/cli@0.7.x http-server
+ sudo yarn global add @lhci/cli@0.12.x http-server
- name: run Lighthouse CI
- run: |
- lhci autorun
+ with:
+ LHCI_SERVER_BASE_URL: '${{ github.event.client_payload.url }}'
+ run: lhci autorun
diff --git a/lighthouserc.js b/lighthouserc.js
index a2a00469e..1ba4d6373 100644
--- a/lighthouserc.js
+++ b/lighthouserc.js
@@ -1,16 +1,22 @@
module.exports = {
ci: {
- collect: {
- url: ['http://127.0.0.1:4000'],
- startServerCommand: 'http-server ./build -p 4000 -g',
- startServerReadyPattern: 'Available on',
- numberOfRuns: 1,
- },
+ // collect: {
+ // url: ['http://127.0.0.1:4000'],
+ // startServerCommand: 'http-server ./build/public -p 4000 -g',
+ // startServerReadyPattern: 'Available on',
+ // numberOfRuns: 1,
+ // },
upload: {
target: 'temporary-public-storage',
},
assert: {
- preset: 'lighthouse:no-pwa',
+ assertions: {
+ 'categories:performance': ['warn', { minScore: 0.9 }],
+ 'categories:seo': ['error', { minScore: 0.9 }],
+ 'categories:accessibility': ['warn', { minScore: 0.9 }],
+ 'categories:best-practices': ['warn', { minScore: 0.9 }],
+ 'categories:pwa': ['warn', { minScore: 0.9 }],
+ },
},
},
};
diff --git a/public/locales/en/demo.json b/public/locales/en/demo.json
index 2e53ab3cc..77338558e 100644
--- a/public/locales/en/demo.json
+++ b/public/locales/en/demo.json
@@ -1,6 +1,6 @@
{
"app_config_not_found": "Invalid or Missing App Config",
- "app_config_learn_more": "Learn more about the App Config creation",
+ "app_config_learn_more": "Learn more about App Configs",
"cancel_config_id": "Cancel",
"click_to_unselect_config": "(click here to unselect this config)",
"currently_previewing_config": "You are currently previewing config: '{{configSource}}'",
From 0d004eb216c4dec331be93e0c35d3e369861b11a Mon Sep 17 00:00:00 2001
From: Anton Lantukh
Date: Wed, 12 Jul 2023 11:50:34 +0200
Subject: [PATCH 3/5] feat(project): lighthouse actions triggering
---
.github/workflows/firebase-preview.yml | 10 +++++++---
.github/workflows/lhci.yml | 20 +++++++++-----------
.gitignore | 1 +
lighthouserc.js | 9 +++------
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml
index ba203b262..25f6b4dea 100644
--- a/.github/workflows/firebase-preview.yml
+++ b/.github/workflows/firebase-preview.yml
@@ -1,4 +1,4 @@
-name: 'Firebase Preview'
+name: Firebase Preview
on:
pull_request:
@@ -14,9 +14,13 @@ jobs:
APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }}
run: yarn && MODE=preview yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
+ id: firebase_hosting_preview
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 30d
- - name: Export url
- run: echo urls ${{steps.firebase_hosting_preview.outputs.url}}
+ - name: Dispatch init event to run Lighthouse
+ env:
+ GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
+ run: |
+ gh workflow run 'Lighthouse' --ref '${{ github.event.pull_request.head.ref }}' -f url='${{ steps.firebase_hosting_preview.outputs.details_url }}'
diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml
index a9c28fae5..34fefbda7 100644
--- a/.github/workflows/lhci.yml
+++ b/.github/workflows/lhci.yml
@@ -1,20 +1,18 @@
name: Lighthouse
on:
- workflow_run:
- workflows: ['Firebase Preview']
- types:
- - completed
+ workflow_dispatch:
+ inputs:
+ url:
+ description: 'Fill preview link'
jobs:
lhci:
name: Lighthouse
runs-on: ubuntu-latest
steps:
- - name: install Lighthouse CI
- run: |
- sudo yarn global add @lhci/cli@0.12.x http-server
- - name: run Lighthouse CI
- with:
- LHCI_SERVER_BASE_URL: '${{ github.event.client_payload.url }}'
- run: lhci autorun
+ - uses: actions/checkout@v1
+ - name: Install Lighthouse CI
+ run: sudo yarn global add @lhci/cli@0.12.x http-server
+ - name: Run Lighthouse CI
+ run: lhci autorun --collect.url=${{ github.event.inputs.url }}?app-config=gnnuzabk --config=./lighthouserc.js
diff --git a/.gitignore b/.gitignore
index 5f4fbbc82..1e466dee5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ yarn-error.log
.firebase
firebase-debug.log
.stylelintcache
+.lighthouseci
# os or editor
.idea
diff --git a/lighthouserc.js b/lighthouserc.js
index 1ba4d6373..c53baf810 100644
--- a/lighthouserc.js
+++ b/lighthouserc.js
@@ -1,11 +1,8 @@
module.exports = {
ci: {
- // collect: {
- // url: ['http://127.0.0.1:4000'],
- // startServerCommand: 'http-server ./build/public -p 4000 -g',
- // startServerReadyPattern: 'Available on',
- // numberOfRuns: 1,
- // },
+ collect: {
+ numberOfRuns: 3,
+ },
upload: {
target: 'temporary-public-storage',
},
From 6b8973effa00f5f4d58cf57f318a791dd2753e5a Mon Sep 17 00:00:00 2001
From: Anton Lantukh
Date: Thu, 13 Jul 2023 11:00:38 +0200
Subject: [PATCH 4/5] chore(project): fix 'unselect config' button
---
src/components/Button/Button.tsx | 2 ++
src/components/DemoConfigDialog/DemoConfigDialog.tsx | 5 +----
.../__snapshots__/DemoConfigDialog.test.tsx.snap | 11 ++++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx
index 59e0f5eb1..46c1c1340 100644
--- a/src/components/Button/Button.tsx
+++ b/src/components/Button/Button.tsx
@@ -28,6 +28,7 @@ type Props = {
disabled?: boolean;
busy?: boolean;
id?: string;
+ as?: 'button' | 'a';
} & React.AriaAttributes;
const Button: React.FC = ({
@@ -43,6 +44,7 @@ const Button: React.FC = ({
busy,
type,
to,
+ as = 'button',
onClick,
className,
...rest
diff --git a/src/components/DemoConfigDialog/DemoConfigDialog.tsx b/src/components/DemoConfigDialog/DemoConfigDialog.tsx
index 89931e06a..78f4da019 100644
--- a/src/components/DemoConfigDialog/DemoConfigDialog.tsx
+++ b/src/components/DemoConfigDialog/DemoConfigDialog.tsx
@@ -10,7 +10,6 @@ import ErrorPage from '#components/ErrorPage/ErrorPage';
import TextField from '#components/TextField/TextField';
import Button from '#components/Button/Button';
import { getConfigNavigateCallback } from '#src/utils/configOverride';
-import Link from '#components/Link/Link';
import ConfirmationDialog from '#components/ConfirmationDialog/ConfirmationDialog';
import LoadingOverlay from '#components/LoadingOverlay/LoadingOverlay';
import type { Config } from '#types/Config';
@@ -145,9 +144,7 @@ const DemoConfigDialog = ({ selectedConfigSource, configQuery }: Props) => {
{configQuery.isSuccess && (
{t('currently_previewing_config', { configSource: selectedConfigSource })}
-
- {t('click_to_unselect_config')}
-
+
)}
{!configQuery.isSuccess && (
diff --git a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
index dab7a1af6..2251711a7 100644
--- a/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
+++ b/src/components/DemoConfigDialog/__snapshots__/DemoConfigDialog.test.tsx.snap
@@ -8,12 +8,13 @@ exports[` > renders and matches snapshot 1`] = `
currently_previewing_config
-
- click_to_unselect_config
-
+
+ click_to_unselect_config
+
+
`;
From 466e8e3650d769bdcf324539d7c27e1fb6d8df11 Mon Sep 17 00:00:00 2001
From: Anton Lantukh
Date: Thu, 13 Jul 2023 11:20:05 +0200
Subject: [PATCH 5/5] feat(project): fix lhci workflow
---
.github/workflows/firebase-preview.yml | 23 ++++++++++++++++-------
.github/workflows/lhci.yml | 18 ------------------
2 files changed, 16 insertions(+), 25 deletions(-)
delete mode 100644 .github/workflows/lhci.yml
diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml
index 25f6b4dea..7939f4ba8 100644
--- a/.github/workflows/firebase-preview.yml
+++ b/.github/workflows/firebase-preview.yml
@@ -1,4 +1,4 @@
-name: Firebase Preview
+name: Preview and Lighthouse
on:
pull_request:
@@ -6,10 +6,13 @@ on:
jobs:
build_and_preview:
+ name: Build and preview
runs-on: ubuntu-latest
+ outputs:
+ output1: ${{ steps.firebase_hosting_preview.outputs.details_url }}
steps:
- uses: actions/checkout@v2
- - name: Build
+ - name: Build Preview Link
env:
APP_PLAYER_LICENSE_KEY: ${{ secrets.PLAYER_LICENSE_KEY }}
run: yarn && MODE=preview yarn build
@@ -19,8 +22,14 @@ jobs:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 30d
- - name: Dispatch init event to run Lighthouse
- env:
- GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- run: |
- gh workflow run 'Lighthouse' --ref '${{ github.event.pull_request.head.ref }}' -f url='${{ steps.firebase_hosting_preview.outputs.details_url }}'
+
+ lhci:
+ name: Lighthouse
+ runs-on: ubuntu-latest
+ needs: build_and_preview
+ steps:
+ - uses: actions/checkout@v2
+ - name: Install Lighthouse CI
+ run: sudo yarn global add @lhci/cli@0.12.x
+ - name: Run Lighthouse CI
+ run: lhci autorun --collect.url=${{ needs.build_and_preview.outputs.output1 }}?app-config=gnnuzabk --config=./lighthouserc.js
diff --git a/.github/workflows/lhci.yml b/.github/workflows/lhci.yml
deleted file mode 100644
index 34fefbda7..000000000
--- a/.github/workflows/lhci.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Lighthouse
-
-on:
- workflow_dispatch:
- inputs:
- url:
- description: 'Fill preview link'
-
-jobs:
- lhci:
- name: Lighthouse
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v1
- - name: Install Lighthouse CI
- run: sudo yarn global add @lhci/cli@0.12.x http-server
- - name: Run Lighthouse CI
- run: lhci autorun --collect.url=${{ github.event.inputs.url }}?app-config=gnnuzabk --config=./lighthouserc.js