Skip to content

Commit 6171183

Browse files
chore: clean up baseUrl (#30)
* chore: clean up baseUrl * fix: add vercel url fallback | mkn, poe * fix: revert port change; move package to devDependencies | mkn
1 parent 007aede commit 6171183

File tree

8 files changed

+20
-17
lines changed

8 files changed

+20
-17
lines changed

.github/workflows/deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- name: Build with Next.js
5858
run: yarn build
5959
env:
60-
BASE_URL: "opensource.porsche.com"
60+
BASE_URL: "https://opensource.porsche.com"
6161
- name: Setup Pages
6262
uses: actions/configure-pages@v3
6363
- name: Upload artifact

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"@types/node": "20.5.7",
4343
"@types/react": "18.2.21",
4444
"@types/react-dom": "18.2.7",
45+
"dotenv": "16.3.1",
4546
"eslint": "8.48.0",
4647
"http-server": "14.1.1",
4748
"js-yaml-loader": "1.2.2",

playwright.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import path from "path";
2+
import dotenv from "dotenv";
13
// eslint-disable-next-line import/no-extraneous-dependencies
24
import { defineConfig, devices } from "@playwright/test";
3-
45
/**
56
* Read environment variables from file.
67
* https://github.com/motdotla/dotenv
78
*/
8-
// require('dotenv').config();
9-
9+
dotenv.config({ path: path.resolve(__dirname, ".env.local") });
1010
/**
1111
* See https://playwright.dev/docs/test-configuration.
1212
*/

src/app/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const siteConfig = {
2121
};
2222

2323
export const metadata: Metadata = {
24-
metadataBase: new URL(`https://${BASE_URL}`),
24+
metadataBase: new URL(`${BASE_URL}`),
2525
title: siteConfig.title,
2626
description: siteConfig.description,
2727
alternates: {

src/app/sitemap.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ import { BASE_URL } from "../config";
55

66
const Sitemap = (): MetadataRoute.Sitemap => {
77
const blogs = allBlogs.map((doc) => ({
8-
url: `https://${BASE_URL}${doc.slug}`,
8+
url: `${BASE_URL}${doc.slug}`,
99
lastModified: format(parseISO(doc.date), "yyyy-MM-dd"),
1010
}));
1111
const docs = allDocs.map((doc) => ({
12-
url: `https://${BASE_URL}${doc.slug}`,
12+
url: `${BASE_URL}${doc.slug}`,
1313
lastModified: format(parseISO(doc.date), "yyyy-MM-dd"),
1414
}));
1515

1616
const staticPaths = [
1717
{
18-
url: `https://${BASE_URL}`,
18+
url: `${BASE_URL}`,
1919
lastModified: "2023-08-25",
2020
},
2121
{
22-
url: `https://${BASE_URL}/legal-notice`,
22+
url: `${BASE_URL}/legal-notice`,
2323
lastModified: "2023-08-25",
2424
},
2525
{
26-
url: `https://${BASE_URL}/privacy`,
26+
url: `${BASE_URL}/privacy`,
2727
lastModified: "2023-08-25",
2828
},
2929
];

src/config.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
const VERCEL_URL = process.env.VERCEL_URL
2+
? `https://${process.env.VERCEL_URL}`
3+
: null;
14
export const BASE_URL =
2-
process.env.BASE_URL ?? process.env.VERCEL_URL ?? "opensource.porsche.com";
5+
process.env.BASE_URL ?? VERCEL_URL ?? "https://opensource.porsche.com";

tests/a11y.spec.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { test, expect, Page } from "@playwright/test";
22
import AxeBuilder from "@axe-core/playwright";
3-
import { BASE_URL as BASE_URL_CONFIG } from "../src/config";
4-
5-
const BASE_URL = `https://${BASE_URL_CONFIG}`;
3+
import { BASE_URL } from "../src/config";
64

75
const runA11yScan = async (page: Page, path: string): Promise<void> => {
86
await page.goto(path);
@@ -14,13 +12,13 @@ const runA11yScan = async (page: Page, path: string): Promise<void> => {
1412
const accessibilityScanResults = await new AxeBuilder({ page })
1513
.withTags(["wcag2a", "wcag21a", "best-practice", "wcag2aa", "wcag21aa"])
1614
.exclude("p-carousel")
17-
.exclude("svg")
15+
.exclude("#sharpBlur")
1816
.analyze();
1917

2018
expect(accessibilityScanResults.violations).toEqual([]);
2119
};
2220

23-
test.describe("Should not find any automatically detectable accessiblity issues", () => {
21+
test.describe("Should not find any automatically detectable accessibility issues", () => {
2422
test(`all pages`, async ({ page }) => {
2523
const request = page.waitForEvent("response");
2624
await page.goto(`${BASE_URL ?? ""}/sitemap.xml`);

yarn.lock

+2-1
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ __metadata:
24012401
languageName: node
24022402
linkType: hard
24032403

2404-
"dotenv@npm:^16.0.3":
2404+
"dotenv@npm:16.3.1, dotenv@npm:^16.0.3":
24052405
version: 16.3.1
24062406
resolution: "dotenv@npm:16.3.1"
24072407
checksum: 15d75e7279018f4bafd0ee9706593dd14455ddb71b3bcba9c52574460b7ccaf67d5cf8b2c08a5af1a9da6db36c956a04a1192b101ee102a3e0cf8817bbcf3dfd
@@ -5825,6 +5825,7 @@ __metadata:
58255825
"@types/react-dom": 18.2.7
58265826
contentlayer: 0.3.4
58275827
date-fns: 2.30.0
5828+
dotenv: 16.3.1
58285829
eslint: 8.48.0
58295830
http-server: 14.1.1
58305831
js-yaml-loader: 1.2.2

0 commit comments

Comments
 (0)