Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Nuxt 3 #3646

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
85738fc
Update tests
obulat Jan 15, 2024
c836166
Make audio tapes smaller
obulat Jan 15, 2024
afcc564
Update tests
obulat Jan 15, 2024
2ef58b8
Remove everything but the homepage and content pages
obulat Jan 6, 2024
d0f54b8
Vendor in SVG sprites
obulat Jan 11, 2024
314e557
Remove patch
obulat Jan 11, 2024
684f7f5
Add search, media and related-media stores
obulat Jan 7, 2024
12f0e11
Add search pages with search functionality
obulat Jan 7, 2024
6f1fd2e
Add single result pages
obulat Jan 9, 2024
8892139
Re-add tests; fix unit tests; disable buttons until hydrated
obulat Jan 9, 2024
d5dfb62
Fix invalid locale keys
obulat Jan 9, 2024
2a31ec0
Refactor search page and fetching
obulat Jan 10, 2024
066bb6a
Fix localePath warning
obulat Jan 10, 2024
03b7a2d
Add additional search views
obulat Jan 11, 2024
b2773f2
Get localePath from useNuxtApp
obulat Jan 15, 2024
4059e6e
Add healthcheck and robots server routes
obulat Jan 11, 2024
cf392f2
Add photos redirect
obulat Jan 11, 2024
d063af8
Add sitemap
obulat Jan 12, 2024
d14f96a
Add simple sentry integration
obulat Jan 12, 2024
0a7f47f
Proxy API calls
obulat Jan 18, 2024
645ef09
Tests
obulat Jan 18, 2024
6505c4d
Add a missing tapes and add peaks=true to related audio tapes
obulat Jan 18, 2024
c064ac4
Reuse the same audio for seo
obulat Jan 18, 2024
f5d1809
Add server-prepare for initial provider loading
obulat Jan 19, 2024
7edfb39
Fix e2e route mocking
obulat Jan 19, 2024
3b1259b
Fix collection test
obulat Jan 19, 2024
1408deb
Fix provider unit test
obulat Jan 19, 2024
c16ecf4
Handle case when there are no providers
obulat Jan 19, 2024
5b3edae
Fix ui cookie overwriting
obulat Jan 20, 2024
db27d7a
Fix Tab border when focused
obulat Jan 20, 2024
3481d88
Fix Waveform on box layout
obulat Jan 20, 2024
3a29226
Fix Sources table sorting
obulat Jan 20, 2024
c5a38fa
Fix content report POST request
obulat Jan 20, 2024
25bab10
Fix global audio player on navigation
obulat Jan 20, 2024
e248b99
Add link to source page to the sources table
obulat Jan 22, 2024
e012058
Update nuxt prepare script and add logging
obulat Jan 22, 2024
f9f7b0b
Remove aria-pressed from buttons when not set
obulat Jan 23, 2024
59d228c
Refactor media store to make easier to test
obulat Jan 23, 2024
a49facd
Add coverage to unit tests
obulat Jan 23, 2024
32bfc93
Add more media store unit tests
obulat Jan 23, 2024
f4fe4dc
Extract api-token from the api route
obulat Jan 24, 2024
2cc6390
Add api token tests
obulat Jan 24, 2024
3e7b31b
Remove duplicate tags
obulat Jan 24, 2024
595b955
Use script setup for pages fetching data
obulat Jan 24, 2024
bee8863
Improve VSkipToContentButton and add it to VCollectionPage
obulat Jan 24, 2024
72e80ac
Error component: add modal target and script setup
obulat Jan 24, 2024
9ba5e8f
Unify error handling
obulat Jan 24, 2024
7edd0e5
Update sentry and env settings
obulat Jan 24, 2024
3a80bf0
Remove unnecessary await from VSvg
obulat Jan 24, 2024
3752da1
Remove provider-init plugin
obulat Jan 25, 2024
87ff226
Set lazy to true in useAsyncData
obulat Jan 25, 2024
f2cc4c9
Remove error watch from index pages
obulat Jan 25, 2024
f5483ea
Remove VFetchingError
obulat Jan 25, 2024
4415bf6
Use script setup and remove useHead from pages
obulat Jan 25, 2024
3b18b1e
Remove head and localeHead from app, error and single result
obulat Jan 25, 2024
4ed3b83
Remove sentry
obulat Jan 25, 2024
d29464c
Use script setup; simplify VLoadMore; remove fetchState
obulat Jan 25, 2024
d85aa61
Remove async from watchers
obulat Jan 25, 2024
716fa6f
Convert headers to script setup
obulat Jan 25, 2024
43d82ae
Replace store getters with actions
obulat Jan 25, 2024
b1bb461
Remove page title
obulat Jan 25, 2024
6354259
Update @nuxtjs/i18n to edge version
obulat Jan 25, 2024
5b67f82
Update dependencies
obulat Feb 3, 2024
c820e22
Move search handling to search.vue
obulat Feb 3, 2024
f9e4d49
Remove single-result middleware
obulat Feb 3, 2024
d3bcfd4
Use script setup and t from useNuxtApp.$i18n
obulat Feb 3, 2024
2cd94a6
Replace axios with ofetch
obulat Feb 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
coverage

frontend/test/unit/test-utils/render-suspended.ts

frontend/test/tapes
frontend/nuxt-template-overrides
frontend/storybook-static
Expand Down
11 changes: 0 additions & 11 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,8 @@ runs:
# Pass -W to fail CI if warnings exist
just documentation/build -W

- name: Install translations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just comment these out if they're going to come back, or are they gone for good?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#3664 is open to re-add Storybook so I suppose this is coming back. Also applies to similar steps related to Storybook in the CI + CD workflow.

shell: bash
run: |
just frontend/run i18n

- name: Build Storybook
shell: bash
run: |
just frontend/run storybook:build-for-docs

# Storybook will be available at `/storybook`
- name: Merge all docs
shell: bash
run: |
mv documentation/_build /tmp/docs
mv frontend/storybook-static /tmp/docs/storybook
5 changes: 1 addition & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ jobs:
if: matrix.image == 'frontend'
run: |
just frontend/run i18n
just frontend/run prepare-nuxt

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -648,14 +649,11 @@ jobs:
name:
- playwright_vr
- playwright_e2e
- storybook
include:
- name: playwright_vr
script: "test:playwright visual-regression"
- name: playwright_e2e
script: "test:playwright e2e"
- name: storybook
script: "test:storybook"

steps:
- name: Checkout repository
Expand Down Expand Up @@ -692,7 +690,6 @@ jobs:
name:
- playwright_vr
- playwright_e2e
- storybook

steps:
- name: Pass
Expand Down
16 changes: 13 additions & 3 deletions frontend/.env.template
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These will need to be added to the ECS template for the frontend before we deploy, right? Or some subset of them?

Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#API_URL=http://127.17.0.1:8000/
#API_CLIENT_ID=""
#API_CLIENT_SECRET=""
#NUXT_PUBLIC_API_URL=http://127.17.0.1:8000/ # local dev API
#NUXT_PUBLIC_API_URL=http://localhost:49153/ # talkback proxy
#NUXT_PUBLIC_API_URL=https://api.openverse.engineering/ # prod API
#NUXT_API_CLIENT_ID=""
#NUXT_API_CLIENT_SECRET=""
NUXT_PUBLIC_SAVED_SEARCH_COUNT=4
NUXT_PUBLIC_PROVIDER_UPDATE_FREQUENCY=3600000# 1 hour
NUXT_PUBLIC_PLAUSIBLE_DOMAIN="openverse.org" #localhost
NUXT_PUBLIC_PLAUSIBLE_API_HOST="https://openverse.org" #http://localhost:50290
NUXT_PUBLIC_SENTRY_DSN="https://[email protected]/5799642"
NUXT_PUBLIC_SENTRY_ENVIRONMENT="local"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safe to expose/use publicly as the default?

NUXT_PUBLIC_SENTRY_RELEASE=""
PORT=8443
2 changes: 2 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Nuxt
.nuxt
.output

# Storybook
.nuxt-storybook
Expand All @@ -11,6 +12,7 @@ test/Default

# Coverage
test/unit/coverage/
coverage

# Generated translation files
*.pot
Expand Down
37 changes: 0 additions & 37 deletions frontend/.storybook/decorators/with-rtl.js

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/.storybook/decorators/with-screenshot-area.js

This file was deleted.

18 changes: 0 additions & 18 deletions frontend/.storybook/decorators/with-ui-store.js

This file was deleted.

23 changes: 0 additions & 23 deletions frontend/.storybook/main.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/.storybook/middleware.js

This file was deleted.

30 changes: 0 additions & 30 deletions frontend/.storybook/preview.js

This file was deleted.

11 changes: 7 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ WORKDIR /home/node/

# Copy monorepo mocking files into `/home/node`, which pretends to be the monorepo root.
# Note: these files must be manually un-ignored in the root .dockerignore
COPY --from=repo_root --chown=node:node .npmrc .pnpmfile.cjs pnpm-lock.yaml tsconfig.base.json ./
COPY --from=repo_root --chown=node:node .npmrc .pnpmfile.cjs pnpm-lock.yaml ./
RUN echo '{"packages":["frontend/"]}' > pnpm-workspace.yaml

# Copy the `frontend/` directory into `/home/node/frontend`, as a package in the monorepo.
Expand All @@ -41,9 +41,10 @@ RUN pnpm install
# disable telemetry when building the app
ENV NUXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
ENV SENTRY_DSN=https://[email protected]/5799642
ENV NUXT_PUBLIC_SENTRY_DSN=https://[email protected]/5799642

ARG API_URL
ARG API_URL=https://api.openverse.engineering/
ENV NUXT_PUBLIC_API_URL=$API_URL

RUN pnpm build:only

Expand All @@ -68,7 +69,9 @@ COPY --from=builder --chown=node:node /home/node/frontend ./frontend/
WORKDIR /home/node/frontend/

ARG SEMANTIC_VERSION
ENV SENTRY_RELEASE=$SEMANTIC_VERSION
ARG DEPLOYMENT_ENV=production
ENV NUXT_PUBLIC_SENTRY_RELEASE=$SEMANTIC_VERSION
ENV NUXT_PUBLIC_SENTRY_ENVIRONMENT=$DEPLOYMENT_ENV

# set app serving to permissive / assigned
ENV NUXT_HOST=0.0.0.0
Expand Down
7 changes: 7 additions & 0 deletions frontend/Dockerfile.playwright
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ FROM mcr.microsoft.com/playwright:v${PLAYWRIGHT_VERSION}-jammy

ARG PACKAGE_MANAGER

WORKDIR /frontend

COPY package.json .

# Requires `packageManager` field to be present in `frontend/package.json`.
RUN npm install -g $PACKAGE_MANAGER

# DO NOT actually run `pnpm install` here. Doing so requires us to copy the the source into the container.
# However, that's a waste of time because we mount the source in the compose file anyway.
# Instead, we run `pnpm install` in the entrypoint script defined in the compose file.
# ENTRYPOINT ["pnpm", "install", "&&"]
11 changes: 7 additions & 4 deletions frontend/docker-compose.playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ services:
- PACKAGE_MANAGER=${PACKAGE_MANAGER}
- PLAYWRIGHT_VERSION=${PLAYWRIGHT_VERSION}
volumes:
- ../node_modules:/node_modules
- .:/frontend
- ${PWD}/../tsconfig.base.json:/tsconfig.base.json
- ../node_modules:/node_modules:rw,Z
- .:/frontend:rw,Z
user: ${USER_ID}
working_dir: /frontend
command: pnpm ${TEST_COMMAND} ${PLAYWRIGHT_ARGS:-}
entrypoint: >
/bin/sh -c '
pnpm install;
pnpm ${TEST_COMMAND} ${PLAYWRIGHT_ARGS:-};
'
environment:
# This makes the webserver that Playwright runs show the build
- DEBUG=pw:webserver
Expand Down
Loading
Loading