Skip to content

Commit

Permalink
refactor: adopt nuxt v4 recommended folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprobst committed Jun 20, 2024
1 parent 6f8f169 commit fc8b423
Show file tree
Hide file tree
Showing 41 changed files with 21 additions and 25 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion e2e/lib/fixtures/imprint-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Locator, Page } from "@playwright/test";

import { defaultLocale, type Locale } from "@/config/i18n.config";
import type { I18n } from "@/e2e/lib/fixtures/i18n";
import type { I18n } from "~/e2e/lib/fixtures/i18n";

export class ImprintPage {
readonly page: Page;
Expand Down
2 changes: 1 addition & 1 deletion e2e/lib/fixtures/index-page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Locator, Page } from "@playwright/test";

import { defaultLocale, type Locale } from "@/config/i18n.config";
import type { I18n } from "@/e2e/lib/fixtures/i18n";
import type { I18n } from "~/e2e/lib/fixtures/i18n";

export class IndexPage {
readonly page: Page;
Expand Down
8 changes: 4 additions & 4 deletions e2e/lib/test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { test as base } from "@playwright/test";

import { defaultLocale, type Locale } from "@/config/i18n.config";
import { type AccessibilityScanner, createAccessibilityScanner } from "@/e2e/lib/fixtures/a11y";
import { createI18n, type I18n, type WithI18n } from "@/e2e/lib/fixtures/i18n";
import { ImprintPage } from "@/e2e/lib/fixtures/imprint-page";
import { IndexPage } from "@/e2e/lib/fixtures/index-page";
import { type AccessibilityScanner, createAccessibilityScanner } from "~/e2e/lib/fixtures/a11y";
import { createI18n, type I18n, type WithI18n } from "~/e2e/lib/fixtures/i18n";
import { ImprintPage } from "~/e2e/lib/fixtures/imprint-page";
import { IndexPage } from "~/e2e/lib/fixtures/index-page";

interface Fixtures {
createAccessibilityScanner: () => Promise<AccessibilityScanner>;
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/analytics.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createUrl } from "@acdh-oeaw/lib";

import { expect, test } from "@/e2e/lib/test";
import { expect, test } from "~/e2e/lib/test";

if (process.env.NUXT_PUBLIC_MATOMO_BASE_URL && process.env.NUXT_PUBLIC_MATOMO_ID) {
const baseUrl = String(
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createUrl } from "@acdh-oeaw/lib";

import { defaultLocale, locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";
import { expect, test } from "~/e2e/lib/test";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const baseUrl = process.env.NUXT_PUBLIC_APP_BASE_URL!;
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/i18n.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createUrl } from "@acdh-oeaw/lib";

import { locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";
import { expect, test } from "~/e2e/lib/test";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const baseUrl = process.env.NUXT_PUBLIC_APP_BASE_URL!;
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/metadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createUrl } from "@acdh-oeaw/lib";

import { locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";
import { escape } from "@/utils/safe-json-ld-replacer";
import { expect, test } from "~/e2e/lib/test";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const baseUrl = process.env.NUXT_PUBLIC_APP_BASE_URL!;
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/pages/imprint.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";
import { expect, test } from "~/e2e/lib/test";

test.describe("imprint page", () => {
test("should have document title", async ({ createImprintPage }) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/pages/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { locales } from "@/config/i18n.config";
import { expect, test } from "@/e2e/lib/test";
import { expect, test } from "~/e2e/lib/test";

test.describe("index page", () => {
test("should have document title", async ({ createIndexPage }) => {
Expand Down
3 changes: 2 additions & 1 deletion e2e/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"compilerOptions": {
"baseUrl": "..",
"paths": {
"@/*": ["./*"]
"@/*": ["./app/*"],
"~/*": ["./*"]
}
}
}
8 changes: 5 additions & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { fileURLToPath } from "node:url";

import { defaultLocale, localesMap } from "./config/i18n.config";
import { defaultLocale, localesMap } from "./app/config/i18n.config";

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const baseUrl = process.env.NUXT_PUBLIC_APP_BASE_URL!;

export default defineNuxtConfig({
alias: {
"@": fileURLToPath(new URL("./", import.meta.url)),
"@": fileURLToPath(new URL("./app/", import.meta.url)),
"~": fileURLToPath(new URL("./", import.meta.url)),
},
app: {
layoutTransition: false,
Expand Down Expand Up @@ -94,7 +95,8 @@ export default defineNuxtConfig({
compilerOptions: {
baseUrl: ".",
paths: {
"@/*": ["./*"],
"@/*": ["./app/*"],
"~/*": ["./*"],
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion server/routes/sitemap.xml.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { locales } from "@/config/i18n.config";
const baseUrl = v.parse(v.pipe(v.string(), v.url()), process.env.NUXT_PUBLIC_APP_BASE_URL);

// eslint-disable-next-line import/no-named-as-default-member
const paths = fg.globSync("./**/*.vue", { cwd: join(process.cwd(), "pages") });
const paths = fg.globSync("./**/*.vue", { cwd: join(process.cwd(), "app", "pages") });

const routes: Array<string> = [];

Expand Down
9 changes: 1 addition & 8 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@ import type { Config } from "tailwindcss";
const preset = createPreset();

const config = {
content: [
"./app.vue",
"./error.vue",
"./components/**/*.@(css|ts|vue)",
"./content/**/*.md",
"./layouts/**/*.@(css|ts|vue)",
"./pages/**/*.@(css|ts|vue)",
],
content: ["./app/**/*.@(css|ts|vue)", "./content/**/*.md"],
presets: [preset],
} satisfies Config;

Expand Down

0 comments on commit fc8b423

Please sign in to comment.