feat: Replace eslint => oxlint + oxfmt
All checks were successful
Deployment / wordpress (push) Successful in 6s
Deployment / nuxt (push) Successful in 58s

This commit is contained in:
2026-02-01 21:53:40 -05:00
parent 58dbcdd25a
commit 9bb09b89d9
60 changed files with 14948 additions and 5941 deletions

5
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"recommendations": [
"oxc.oxc-vscode"
]
}

28
.vscode/settings.json vendored
View File

@@ -1,11 +1,39 @@
{
"[css]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[postcss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[scss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"[vue]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "always"
},
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.quickSuggestions": {
"strings": "on"
},
"eslint.enable": false,
"files.associations": {
"*.css": "tailwindcss"
},
"graphql-config.load.rootDir": "wp-content/themes/moonshine",
"oxc.fmt.configPath": "wp-content/themes/moonshine/.oxfmtrc.json",
"oxc.path.oxfmt": "wp-content/themes/moonshine/node_modules/.bin/oxfmt",
"oxc.path.oxlint": "wp-content/themes/moonshine/node_modules/.bin/oxlint",
"oxc.typeAware": true,
"tailwindCSS.classAttributes": [
"class",
"ui"

View File

@@ -0,0 +1,25 @@
{
"arrowParens": "always",
"indentStyle": "space",
"indentWidth": 2,
"quoteStyle": "double",
"semi": true,
"trailingComma": "es5",
"experimentalSortImports": {
"groups": [
["side-effect"],
["builtin"],
["external", "type-external"],
["internal", "type-internal"],
["parent", "type-parent"],
["sibling", "type-sibling"],
["index", "type-index"]
]
},
"experimentalTailwindcss": {
"stylesheet": "./app/assets/css/_main.css",
"attributes": ["class", "className"],
"functions": ["clsx", "cn"],
"preserveWhitespace": true
}
}

View File

@@ -0,0 +1,17 @@
{
"extends": ["recommended"],
"plugins": ["vue"],
"env": {
"browser": true,
"node": true
},
"settings": {
"vue": {
"version": 3
}
},
"rules": {
"vue/max-attributes-per-line": "off",
"vue/no-v-html": "off"
}
}

View File

@@ -190,7 +190,6 @@
## v0.1.1
### 🚀 Enhancements
- Initial Moonshine theme - Headless WordPress theme based on Nuxt (b3134fe)

View File

@@ -5,7 +5,7 @@ Thème WordPress en headless basé sur Nuxt.
## Variables d'environnement
| Nom | Description | Exemple | Requise |
|-----|-------------|---------|---------|
| --------------- | ------------------------ | ----------------------- | ------- |
| `NUXT_SITE_ENV` | Environnement | staging \| production | |
| `NUXT_SITE_URL` | URL du frontend Nuxt | https://www.example.com | |
| `NUXT_WP_URL` | URL du backend WordPress | https://wp.exemple.com | ✅ |

View File

@@ -24,11 +24,7 @@
"acfe_flexible_layouts_placeholder": 0,
"acfe_flexible_layouts_thumbnails": 0,
"acfe_flexible_async": [],
"acfe_flexible_add_actions": [
"copy",
"title",
"toggle"
],
"acfe_flexible_add_actions": ["copy", "title", "toggle"],
"acfe_flexible_remove_button": [],
"acfe_flexible_remove_top_actions": [],
"acfe_flexible_modal_edit": {
@@ -100,9 +96,7 @@
"min": "",
"max": "",
"acfe_flexible_modal_edit_size": "",
"acfe_flexible_settings": [
"group_layout_contained"
],
"acfe_flexible_settings": ["group_layout_contained"],
"acfe_flexible_settings_size": "large",
"acfe_flexible_render_template": false,
"acfe_flexible_render_style": false,
@@ -156,9 +150,7 @@
"id": ""
},
"graphql_field_name": "media",
"clone": [
"group_abstract_media"
],
"clone": ["group_abstract_media"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
@@ -231,16 +223,12 @@
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"the_content"
],
"hide_on_screen": ["the_content"],
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractBuilder",

View File

@@ -109,9 +109,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractMedia",

View File

@@ -72,9 +72,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupAbstractSocial",

View File

@@ -135,9 +135,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupLayoutContained",

View File

@@ -63,9 +63,7 @@
"id": ""
},
"graphql_field_name": "social",
"clone": [
"group_abstract_social"
],
"clone": ["group_abstract_social"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
@@ -144,9 +142,7 @@
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupSiteOptions",

View File

@@ -17,9 +17,7 @@
"id": ""
},
"graphql_field_name": "builder",
"clone": [
"group_abstract_builder"
],
"clone": ["group_abstract_builder"],
"display": "seamless",
"layout": "block",
"prefix_label": 0,
@@ -45,16 +43,12 @@
"style": "seamless",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": [
"the_content"
],
"hide_on_screen": ["the_content"],
"active": true,
"description": "",
"show_in_rest": 0,
"display_title": "",
"acfe_autosync": [
"json"
],
"acfe_autosync": ["json"],
"acfe_form": 0,
"show_in_graphql": 1,
"graphql_field_name": "GroupPostPage",

View File

@@ -8,13 +8,27 @@
}
/* Container sizes */
@utility container { @apply mx-auto px-container max-w-(--breakpoint-2xl); }
@utility container-xl { @apply container max-w-(--breakpoint-xl); }
@utility container-lg { @apply container max-w-(--breakpoint-lg); }
@utility container-md { @apply container max-w-(--breakpoint-md); }
@utility container-sm { @apply container max-w-(--breakpoint-sm); }
@utility container-fluid { @apply container max-w-screen; }
@utility container-none { @apply w-full max-w-screen; }
@utility container {
@apply mx-auto px-container max-w-(--breakpoint-2xl);
}
@utility container-xl {
@apply container max-w-(--breakpoint-xl);
}
@utility container-lg {
@apply container max-w-(--breakpoint-lg);
}
@utility container-md {
@apply container max-w-(--breakpoint-md);
}
@utility container-sm {
@apply container max-w-(--breakpoint-sm);
}
@utility container-fluid {
@apply container max-w-screen;
}
@utility container-none {
@apply w-full max-w-screen;
}
/* Split containers */
:root {
@@ -42,6 +56,12 @@
}
}
@utility container-left { @apply ml-(--container-outside-margin) px-container;}
@utility container-right { @apply mr-(--container-outside-margin) px-container;}
@utility container-half { width: calc(var(--container-width) / 2);}
@utility container-left {
@apply ml-(--container-outside-margin) px-container;
}
@utility container-right {
@apply mr-(--container-outside-margin) px-container;
}
@utility container-half {
width: calc(var(--container-width) / 2);
}

View File

@@ -2,6 +2,12 @@
@custom-variant links (& a:not([class*='link-']):not([class*='button-']));
/* Link styles */
@utility link-base { @apply cursor-pointer disabled-default transition; }
@utility link-underline { @apply link-base underline hover:decoration-primary; }
@utility link-opacity { @apply link-base hover:opacity-80; }
@utility link-base {
@apply cursor-pointer disabled-default transition;
}
@utility link-underline {
@apply link-base underline hover:decoration-primary;
}
@utility link-opacity {
@apply link-base hover:opacity-80;
}

View File

@@ -1,15 +1,25 @@
@utility prose {
/* Headings (allow class overrides) */
h1:not([class*="heading-"]) { @apply heading-1; }
h2:not([class*="heading-"]) { @apply heading-2; }
h3:not([class*="heading-"]) { @apply heading-3; }
h4:not([class*="heading-"]) { @apply heading-4; }
h1:not([class*="heading-"]) {
@apply heading-1;
}
h2:not([class*="heading-"]) {
@apply heading-2;
}
h3:not([class*="heading-"]) {
@apply heading-3;
}
h4:not([class*="heading-"]) {
@apply heading-4;
}
/* Links */
@apply links:link-underline;
/* Paragraphs */
p:not([class*="paragraph-"]) { @apply paragraph-base; }
p:not([class*="paragraph-"]) {
@apply paragraph-base;
}
/* Spacing */
@apply space-y-2;

View File

@@ -1,10 +1,24 @@
/* Heading styles */
@utility heading-base { @apply font-bold tracking-tight };
@utility heading-1 { @apply heading-base text-4xl; }
@utility heading-2 { @apply heading-base text-3xl; }
@utility heading-3 { @apply heading-base text-2xl; }
@utility heading-4 { @apply heading-base text-xl; }
@utility heading-base {
@apply font-bold tracking-tight;
}
@utility heading-1 {
@apply heading-base text-4xl;
}
@utility heading-2 {
@apply heading-base text-3xl;
}
@utility heading-3 {
@apply heading-base text-2xl;
}
@utility heading-4 {
@apply heading-base text-xl;
}
/* Paragraph styles */
@utility paragraph-base { @apply font-sans; }
@utility paragraph-lead { @apply paragraph-base text-2xl; }
@utility paragraph-base {
@apply font-sans;
}
@utility paragraph-lead {
@apply paragraph-base text-2xl;
}

View File

@@ -2,7 +2,7 @@
import type { AcfLinkFragment } from "#graphql/operations";
import type { ButtonProps } from "@nuxt/ui";
type AcfLinkButtonProps = & Omit<ButtonProps, "to" | "target" | "href"> & {
type AcfLinkButtonProps = Omit<ButtonProps, "to" | "target" | "href"> & {
link?: AcfLinkFragment;
showLabel?: boolean;
};

View File

@@ -1,5 +1,9 @@
fragment AcfMedia on GroupAbstractMedia_Fields {
image { node { ... AcfImage } }
image {
node {
...AcfImage
}
}
aspectRatio
objectFit
}

View File

@@ -4,7 +4,14 @@ defineProps<{ social?: AcfSocialOutput }>();
<template>
<div v-if="social?.profiles" class="flex gap-1.5">
<a v-for="({ url, icon }, key) in social.profiles" :key="key" :href="url" target="_blank" rel="noopener noreferrer" class="flex">
<a
v-for="({ url, icon }, key) in social.profiles"
:key="key"
:href="url"
target="_blank"
rel="noopener noreferrer"
class="flex"
>
<UIcon :name="icon" />
</a>
</div>

View File

@@ -7,7 +7,8 @@ const fields = [
label: "Courriel",
placeholder: "Entrez votre courriel",
required: true,
}, {
},
{
name: "password",
label: "Mot de passe",
type: "password" as const,

View File

@@ -5,12 +5,8 @@ const { logout } = useAuthConnexion();
<template>
<div class="w-full space-y-6">
<div class="flex flex-col text-center">
<div class="text-xl text-pretty font-semibold text-highlighted">
Déconnexion
</div>
<div class="mt-1 text-base text-pretty text-muted">
Veuillez confirmer la déconnexion.
</div>
<div class="text-xl font-semibold text-pretty text-highlighted">Déconnexion</div>
<div class="mt-1 text-base text-pretty text-muted">Veuillez confirmer la déconnexion.</div>
</div>
<UButton
icon="i-lucide-log-out"

View File

@@ -1,12 +1,8 @@
<template>
<div class="w-full space-y-6">
<div class="flex flex-col text-center">
<div class="text-xl text-pretty font-semibold text-highlighted">
Redirection en cours
</div>
<div class="mt-1 text-base text-pretty text-muted">
Veuillez patienter...
</div>
<div class="text-xl font-semibold text-pretty text-highlighted">Redirection en cours</div>
<div class="mt-1 text-base text-pretty text-muted">Veuillez patienter...</div>
</div>
</div>
</template>

View File

@@ -1,7 +1,11 @@
fragment BuilderSections on GroupAbstractBuilder_Fields {
sections {
__typename
... on GroupAbstractBuilderSectionsHeroSplitLayout { ... SectionHeroSplit }
... on GroupAbstractBuilderSectionsTextBlockLayout { ... SectionTextBlock }
... on GroupAbstractBuilderSectionsHeroSplitLayout {
...SectionHeroSplit
}
... on GroupAbstractBuilderSectionsTextBlockLayout {
...SectionTextBlock
}
}
}

View File

@@ -6,7 +6,7 @@ defineProps<NodePageFragment>();
<template>
<div id="node-page">
<h1 v-if="!isFrontPage" class="font-bold text-4xl">
<h1 v-if="!isFrontPage" class="text-4xl font-bold">
{{ title }}
</h1>
<BuilderSections :sections="groupPostPage?.sections || []" />

View File

@@ -3,4 +3,3 @@ fragment SectionHeroSplit on GroupAbstractBuilderSectionsHeroSplitLayout {
reverse
...AcfMedia
}

View File

@@ -3,7 +3,7 @@ const { data: siteOptions } = await useSiteOptions();
</script>
<template>
<footer class="bg-accented links:link-prose">
<footer class="links:link-prose bg-accented">
<div class="container py-6">
<AcfSocial :social="parseAcfSocial(siteOptions)" />
</div>

View File

@@ -3,8 +3,8 @@ const { connexionButton } = useAuthConnexion();
</script>
<template>
<div class="bg-inverted text-inverted py-1.5">
<div class="container flex flex-col sm:flex-row items-center gap-3">
<div class="bg-inverted py-1.5 text-inverted">
<div class="container flex flex-col items-center gap-3 sm:flex-row">
<SiteFooterCopyright class="sm:mr-auto" />
<UButton v-bind="connexionButton" color="neutral" variant="link" />
<SiteFooterCredits />

View File

@@ -1,6 +1,12 @@
<template>
<div class="flex items-center gap-1">
Fait avec <UIcon name="i-lucide-heart" /> par
<ULink href="https://websimple.com" target="_blank" external title="Site web développé par Websimple">Websimple</ULink>
<ULink
href="https://websimple.com"
target="_blank"
external
title="Site web développé par Websimple"
>Websimple</ULink
>
</div>
</template>

View File

@@ -1,6 +1,3 @@
<script setup lang="ts">
</script>
<template>
<UHeader mode="slideover">
<template #left>

View File

@@ -6,7 +6,7 @@ export function useAuthConnexion() {
const { isLoggedIn } = useAuth();
const toast = useToast();
const { fetch: refreshUserSession } = useUserSession();
const routeRedirect = useRoute().query.redirect as string || undefined;
const routeRedirect = (useRoute().query.redirect as string) || undefined;
// Helper: Redirect after login / logout
async function redirectTo(to: string | undefined) {
@@ -30,13 +30,13 @@ export function useAuthConnexion() {
duration: 3000,
});
await redirectTo(redirect);
}
catch (error) {
} catch (error) {
console.log(error);
toast.add({
title: "Erreur de connexion",
color: "error",
description: error instanceof Error ? error.message : "Une erreur est survenue lors de la connexion.",
description:
error instanceof Error ? error.message : "Une erreur est survenue lors de la connexion.",
duration: 5000,
});
}
@@ -56,13 +56,15 @@ export function useAuthConnexion() {
duration: 3000,
});
await redirectTo(redirect);
}
catch (error) {
} catch (error) {
console.log(error);
toast.add({
title: "Erreur de déconnexion",
color: "error",
description: error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.",
description:
error instanceof Error
? error.message
: "Une erreur est survenue lors de la déconnexion.",
duration: 5000,
});
}

View File

@@ -1,3 +1,8 @@
export const useGeneralSettings = () => useAsyncGraphQLQuery("GeneralSettings", {}, {
export const useGeneralSettings = () =>
useAsyncGraphQLQuery(
"GeneralSettings",
{},
{
transform: ({ generalSettings }) => generalSettings,
});
}
);

View File

@@ -11,8 +11,7 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
try {
const hrefUrl = new URL(href);
return hrefUrl.hostname === siteUrl.hostname;
}
catch {
} catch {
return false;
}
};
@@ -25,8 +24,7 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
if (hrefUrl.hostname === siteUrl.hostname) {
return hrefUrl.pathname + hrefUrl.search + hrefUrl.hash;
}
}
catch {
} catch {
// Invalid URL
}
return href;
@@ -39,7 +37,14 @@ export function useProseLinks(refContent: Ref<HTMLElement | null>) {
if (!link) return;
const href = link.getAttribute("href");
if (!href) return;
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || link.target === "_blank" || link.hasAttribute("download")) {
if (
e.metaKey ||
e.ctrlKey ||
e.shiftKey ||
e.altKey ||
link.target === "_blank" ||
link.hasAttribute("download")
) {
return;
}
if (isInternal(href)) {

View File

@@ -2,7 +2,9 @@ import { breakpointsTailwind, useBreakpoints } from "@vueuse/core";
export function useResponsive() {
const { isMobileOrTablet } = useDevice();
const breakpoints = useBreakpoints(breakpointsTailwind, { ssrWidth: isMobileOrTablet ? 375 : 1024 });
const breakpoints = useBreakpoints(breakpointsTailwind, {
ssrWidth: isMobileOrTablet ? 375 : 1024,
});
const isDesktop = breakpoints.greaterOrEqual("lg");
return { breakpoints, isDesktop };

View File

@@ -1,3 +1,8 @@
export const useSiteOptions = () => useAsyncGraphQLQuery("SiteOptions", {}, {
export const useSiteOptions = () =>
useAsyncGraphQLQuery(
"SiteOptions",
{},
{
transform: ({ siteOptions }) => siteOptions?.groupSiteOptions,
});
}
);

View File

@@ -1,9 +1,13 @@
fragment SiteOptions on GroupSiteOptions {
email
phoneNumber { ... AcfPhone }
phoneNumber {
...AcfPhone
}
...AcfSocial
links {
contact { ... AcfLink}
contact {
...AcfLink
}
}
}

View File

@@ -4,13 +4,21 @@ const { path: uri } = useRoute();
const { data, error } = await useAsyncGraphQLQuery("NodeByUri", { uri });
if (!data.value?.nodeByUri) {
console.error("NodeByUri query error:", error.value);
throw createError({ statusCode: 404, message: `La page demandée est introuvable: ${uri}`, fatal: true });
throw createError({
statusCode: 404,
message: `La page demandée est introuvable: ${uri}`,
fatal: true,
});
}
// Dynamically resolve component based on node type
const componentName = `Node${data.value.nodeByUri.__typename}`;
if (!useNuxtApp().vueApp.component(componentName)) {
throw createError({ statusCode: 404, message: `La page demandée ne peut pas être affichée correctement: ${componentName}`, fatal: true });
throw createError({
statusCode: 404,
message: `La page demandée ne peut pas être affichée correctement: ${componentName}`,
fatal: true,
});
}
useNodeSeo(data.value.nodeByUri);

View File

@@ -1,5 +1,5 @@
import * as z from "zod";
import type { AcfLinkFragment } from "#graphql/operations";
import * as z from "zod";
const acfLinkSchema = z.object({
title: z.string(),
@@ -11,8 +11,7 @@ export type AcfLinkOutput = z.infer<typeof acfLinkSchema>;
export function parseAcfLink(data?: Partial<AcfLinkFragment>) {
try {
return acfLinkSchema.parse(data);
}
catch {
} catch {
return undefined;
}
}

View File

@@ -22,8 +22,7 @@ export const acfMediaSchema = z.object({
export function parseAcfMedia(data?: Partial<AcfMediaFragment>) {
try {
return acfMediaSchema.parse(data);
}
catch {
} catch {
return undefined;
}
}

View File

@@ -1,7 +1,9 @@
import * as z from "zod";
import type { AcfSocialFragment } from "#graphql/operations";
import * as z from "zod";
const socialProfile = z.object({ url: z.url() }).transform(({ url }) => ({ url, icon: getSocialIcon(url) }));
const socialProfile = z
.object({ url: z.url() })
.transform(({ url }) => ({ url, icon: getSocialIcon(url) }));
const acfSocialSchema = z.object({
profiles: z.array(socialProfile),
});
@@ -10,8 +12,7 @@ export type AcfSocialOutput = z.infer<typeof acfSocialSchema>;
export function parseAcfSocial(data?: AcfSocialFragment) {
try {
return acfSocialSchema.parse(data);
}
catch {
} catch {
return undefined;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +0,0 @@
// @ts-check
import withNuxt from "./.nuxt/eslint.config.mjs";
export default withNuxt({ rules: {
"vue/max-attributes-per-line": "off",
"vue/no-v-html": "off",
} },
);

View File

@@ -2,12 +2,16 @@ import { version } from "./package.json";
const siteUrl = process.env.NUXT_SITE_URL;
if (!siteUrl) {
throw new Error(`NUXT_SITE_URL is not defined. Make sure to set it in your build environment variables.`);
throw new Error(
`NUXT_SITE_URL is not defined. Make sure to set it in your build environment variables.`
);
}
const wpUrl = process.env.NUXT_WP_URL;
if (!wpUrl) {
throw new Error(`NUXT_WP_URL is not defined. Make sure to set it in your build environment variables.`);
throw new Error(
`NUXT_WP_URL is not defined. Make sure to set it in your build environment variables.`
);
}
const wpDomain = new URL(wpUrl).hostname;
@@ -15,10 +19,8 @@ const enableCloudflareImages = Boolean(process.env.ENABLE_CLOUDFLARE_IMAGES);
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
"@lewebsimple/nuxt-graphql",
"@nuxt/eslint",
"@nuxt/image",
"@nuxt/ui",
"@nuxtjs/device",
@@ -28,9 +30,7 @@ export default defineNuxtConfig({
],
components: {
dirs: [
{ path: "~/components", pathPrefix: false },
],
dirs: [{ path: "~/components", pathPrefix: false }],
},
devtools: { enabled: true },
@@ -68,18 +68,6 @@ export default defineNuxtConfig({
},
},
eslint: {
config: {
stylistic: {
arrowParens: true,
commaDangle: "always-multiline",
indent: 2,
quotes: "double",
semi: true,
},
},
},
graphql: {
client: {
cache: {
@@ -112,5 +100,4 @@ export default defineNuxtConfig({
componentPrefix: "Svg",
defaultImport: "component",
},
});

View File

@@ -1,15 +1,16 @@
{
"name": "@lewebsimple/moonshine",
"description": "Headless WordPress theme based on Nuxt.",
"version": "0.1.13",
"type": "module",
"private": true,
"description": "Headless WordPress theme based on Nuxt.",
"type": "module",
"scripts": {
"build": "pnpm --sequential /build:.*/",
"build:nuxt": "nuxt build",
"dev": "nuxt dev",
"editor-style": "pnpx @tailwindcss/cli -i ./app/assets/css/_main.css -o ./editor-style.css --minify",
"lint": "eslint . --fix",
"format": "oxfmt .",
"lint": "oxlint . --fix",
"postinstall": "pnpm --sequential /postinstall:.*/",
"postinstall:wrangler-types": "wrangler types ./server/types/cloudflare.d.ts",
"postinstall:nuxt": "nuxt prepare",
@@ -17,7 +18,7 @@
"preview:build": "pnpm run build",
"preview:wrangler-dev": "wrangler dev --port 3000",
"release": "pnpm --sequential /release:.*/",
"release:lint": "eslint .",
"release:lint": "oxlint .",
"release:typecheck": "nuxt typecheck",
"release:changelogen": "changelogen --noAuthors --release --push"
},
@@ -39,9 +40,9 @@
"zod": "^4.3.6"
},
"devDependencies": {
"@nuxt/eslint": "^1.13.0",
"changelogen": "^0.6.2",
"eslint": "^9.39.2",
"oxfmt": "^0.27.0",
"oxlint": "^1.42.0",
"typescript": "^5.9.3",
"vue-tsc": "^3.2.4",
"wrangler": "^4.61.1"

File diff suppressed because it is too large Load Diff

View File

@@ -5,17 +5,17 @@ export default defineEventHandler(async (event) => {
if (!data?.login) {
throw new Error("INVALID_LOGIN");
}
if (!await handleLogin(event, data)) {
if (!(await handleLogin(event, data))) {
throw new Error("LOGIN_FAILED");
}
return { success: true, message: "Connexion réussie" };
}
catch (error) {
} catch (error) {
const messages = {
INVALID_LOGIN: "Identifiants invalides. Veuillez réessayer.",
LOGIN_FAILED: "Une erreur est survenue lors de la connexion. Veuillez réessayer plus tard.",
};
const message = (error instanceof Error && error.message in messages) ? error.message : "LOGIN_FAILED";
const message =
error instanceof Error && error.message in messages ? error.message : "LOGIN_FAILED";
return { success: false, message: messages[message as keyof typeof messages] };
}
});

View File

@@ -4,9 +4,9 @@ export default defineEventHandler(async (event) => {
try {
await handleLogout(event);
return { success: true, message: "Déconnexion réussie" };
}
catch (error) {
const message = error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.";
} catch (error) {
const message =
error instanceof Error ? error.message : "Une erreur est survenue lors de la déconnexion.";
return { success: false, message };
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,9 @@ export default defineRemoteExecutorHooks({
onRequest(request) {
// Attach the Authorization header if an authToken is present in the context
if (request.context?.authToken) {
request.extensions = defu(request.extensions, { headers: { Authorization: `Bearer ${request.context.authToken}` } });
request.extensions = defu(request.extensions, {
headers: { Authorization: `Bearer ${request.context.authToken}` },
});
}
},
});

View File

@@ -1,9 +1,9 @@
import type { H3Event } from "h3";
import { jwtDecode } from "jwt-decode";
import type { User } from "#auth-utils";
import type { AuthUserFragment, AuthLoginMutationResult } from "#graphql/operations";
import { AuthRefreshTokenDocument } from "#graphql/operations";
import type { ResultOf } from "#graphql/registry";
import type { H3Event } from "h3";
import { jwtDecode } from "jwt-decode";
// Handle login result and store user session
export async function handleLogin(event: H3Event, loginResult: AuthLoginMutationResult) {
@@ -54,10 +54,13 @@ export async function refreshAuthToken(refreshToken: string): Promise<string | u
const refreshPromise = (async () => {
const { wpUrl } = useRuntimeConfig();
const endpoint = `${wpUrl}/graphql`;
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>({
const { data } = await executeGraphQLHTTP<ResultOf<"AuthRefreshToken">>(
{
query: AuthRefreshTokenDocument,
variables: { refreshToken },
}, { endpoint });
},
{ endpoint }
);
return data?.refreshToken?.authToken || undefined;
})();
@@ -91,8 +94,7 @@ export async function getAuthToken(event: H3Event): Promise<string | undefined>
}
session.secure.authToken = newAuthToken;
await setUserSession(event, session);
}
catch {
} catch {
await clearUserSession(event);
return;
}

View File

@@ -2,9 +2,7 @@
"$schema": "./node_modules/wrangler/config-schema.json",
"main": "./output/server/index.mjs",
"compatibility_date": "2026-01-27",
"compatibility_flags": [
"nodejs_compat"
],
"compatibility_flags": ["nodejs_compat"],
"observability": {
"enabled": true
},