diff --git a/.npmrc b/.npmrc index f3a9cab..f4a6691 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -@hykocx:registry=https://git.hyko.cx/api/packages/hykocx/npm/ \ No newline at end of file +@zen:registry=https://git.hyko.cx/api/packages/zen/npm/ \ No newline at end of file diff --git a/README.md b/README.md index 6360b62..ca1de0f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # zen -Un CMS construit sur l'essentiel, rien de plus, rien de moins. +Un CMS Next.js construit sur l'essentiel, rien de plus, rien de moins. > [!WARNING] > Ce projet est en développement actif et n'est pas encore prêt pour une utilisation en production. L'API, la structure et les fonctionnalités peuvent changer à tout moment. diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 861d2ac..15c7bec 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -11,7 +11,7 @@ Créer un fichier `.npmrc` à la racine du projet avec le contenu suivant : ## 2. Installer le package ```bash -npm install @hykocx/zen +npm install @zen/core ``` ## 3. Installer les styles @@ -19,7 +19,7 @@ npm install @hykocx/zen Ajouter la ligne suivante dans le fichier `globals.css` : ```css -@import '@hykocx/zen/styles/zen.css'; +@import '@zen/core/styles/zen.css'; ``` ## 4. Ajouter ZenProvider au layout racine @@ -29,7 +29,7 @@ Entourer l'application avec `ZenProvider` dans le layout racine pour activer les ```javascript // app/layout.js import './globals.css'; -import { ZenProvider } from '@hykocx/zen/provider'; +import { ZenProvider } from '@zen/core/provider'; export const metadata = { title: 'My App', diff --git a/docs/dev/DEV.md b/docs/dev/DEV.md index 9f2139b..120a5a3 100644 --- a/docs/dev/DEV.md +++ b/docs/dev/DEV.md @@ -2,7 +2,7 @@ ## Publier le package -Le package `@hykocx/zen` est publié sur le registre npm à `https://git.hyko.cx`. +Le package `@zen/core` est publié sur le registre npm à `https://git.hyko.cx`. ### 1. Configurer l'authentification diff --git a/docs/modules/EXTERNAL_MODULE.md b/docs/modules/EXTERNAL_MODULE.md index a6a6b35..6bc3a14 100644 --- a/docs/modules/EXTERNAL_MODULE.md +++ b/docs/modules/EXTERNAL_MODULE.md @@ -1,6 +1,6 @@ # Créer un module externe -Un module externe est un package npm indépendant qui s'intègre dans une app qui utilise `@hykocx/zen`. Il n'a pas besoin de modifier le code source du CMS. +Un module externe est un package npm indépendant qui s'intègre dans une app qui utilise `@zen/core`. Il n'a pas besoin de modifier le code source du CMS. --- @@ -10,7 +10,7 @@ Un module externe est un package npm indépendant qui s'intègre dans une app qu @scope/zen-nom-du-module ``` -Exemples : `@hykocx/zen-invoice`, `@hykocx/zen-nuage`. +Exemples : `@zen/core-invoice`, `@zen/core-nuage`. --- @@ -34,11 +34,11 @@ zen-invoice/ ## index.js -On utilise `defineModule()` importé depuis `@hykocx/zen/modules/define`. +On utilise `defineModule()` importé depuis `@zen/core/modules/define`. ```js import { lazy } from 'react'; -import { defineModule } from '@hykocx/zen/modules/define'; +import { defineModule } from '@zen/core/modules/define'; import { createTables, dropTables } from './db.js'; import { getInvoiceByToken } from './actions.js'; @@ -149,7 +149,7 @@ async setup(ctx) { ```json { - "name": "@hykocx/zen-invoice", + "name": "@zen/core-invoice", "version": "1.0.0", "type": "module", "main": "./index.js", @@ -157,7 +157,7 @@ async setup(ctx) { ".": "./index.js" }, "peerDependencies": { - "@hykocx/zen": ">=1.0.0", + "@zen/core": ">=1.0.0", "react": ">=19.0.0" } } @@ -170,14 +170,14 @@ async setup(ctx) { ### 1. Installer le package ```bash -npm install @hykocx/zen-invoice +npm install @zen/core-invoice ``` ### 2. Créer zen.config.js à la racine de l'app ```js // zen.config.js -import invoiceModule from '@hykocx/zen-invoice'; +import invoiceModule from '@zen/core-invoice'; export default { modules: [invoiceModule], @@ -192,7 +192,7 @@ import zenConfig from './zen.config.js'; export async function register() { if (process.env.NEXT_RUNTIME === 'nodejs') { - const { initializeZen } = await import('@hykocx/zen'); + const { initializeZen } = await import('@zen/core'); await initializeZen(zenConfig); } } @@ -203,7 +203,7 @@ export async function register() { ```jsx // app/layout.js import zenConfig from './zen.config.js'; -import { ZenProvider } from '@hykocx/zen/provider'; +import { ZenProvider } from '@zen/core/provider'; export default function RootLayout({ children }) { return ( diff --git a/docs/modules/INTERNAL_MODULE.md b/docs/modules/INTERNAL_MODULE.md index 6fca0e5..37848ef 100644 --- a/docs/modules/INTERNAL_MODULE.md +++ b/docs/modules/INTERNAL_MODULE.md @@ -1,6 +1,6 @@ # Créer un module interne -Un module interne vit dans `src/modules/` et fait partie du package `@hykocx/zen`. Il a accès direct aux services du CMS sans passer par un contexte injecté. +Un module interne vit dans `src/modules/` et fait partie du package `@zen/core`. Il a accès direct aux services du CMS sans passer par un contexte injecté. --- diff --git a/package-lock.json b/package-lock.json index b4d1de6..531e962 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@hykocx/zen", - "version": "1.3.2", + "name": "@zen/core", + "version": "1.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@hykocx/zen", - "version": "1.3.2", + "name": "@zen/core", + "version": "1.3.3", "license": "GPL-3.0-only", "dependencies": { "@headlessui/react": "^2.0.0", diff --git a/package.json b/package.json index 4780551..ea32ad9 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { - "name": "@hykocx/zen", - "version": "1.3.2", + "name": "@zen/core", + "version": "1.3.3", "description": "Un CMS construit sur l'essentiel, rien de plus, rien de moins.", "repository": { "type": "git", - "url": "https://git.hyko.cx/hykocx/zen.git" + "url": "https://git.hyko.cx/zen/core.git" }, "publishConfig": { - "registry": "https://git.hyko.cx/api/packages/hykocx/npm/" + "registry": "https://git.hyko.cx/api/packages/zen/npm/" }, "license": "GPL-3.0-only", "author": "Hyko", diff --git a/src/cli/setup.js b/src/cli/setup.js index 10da70d..53d48c6 100644 --- a/src/cli/setup.js +++ b/src/cli/setup.js @@ -15,7 +15,7 @@ const templates = { instrumentation: `// instrumentation.js export async function register() { if (process.env.NEXT_RUNTIME === 'nodejs') { - const { initializeZen } = await import('@hykocx/zen'); + const { initializeZen } = await import('@zen/core'); await initializeZen(); } } @@ -26,7 +26,7 @@ export default function Redirect() { redirect('/auth/login/'); } `, - authCatchAll: `export { default } from '@hykocx/zen/auth/page'; + authCatchAll: `export { default } from '@zen/core/auth/page'; `, adminRedirect: `import { redirect } from 'next/navigation'; @@ -34,11 +34,11 @@ export default function Redirect() { redirect('/admin/dashboard'); } `, - adminCatchAll: `export { default } from '@hykocx/zen/admin/page'; + adminCatchAll: `export { default } from '@zen/core/admin/page'; `, - zenApiRoute: `export { GET, POST, PUT, DELETE, PATCH } from '@hykocx/zen/zen/api'; + zenApiRoute: `export { GET, POST, PUT, DELETE, PATCH } from '@zen/core/zen/api'; `, - zenPageRoute: `export { default, generateMetadata } from '@hykocx/zen/modules/page'; + zenPageRoute: `export { default, generateMetadata } from '@zen/core/modules/page'; `, nextConfig: `// next.config.js module.exports = { @@ -144,7 +144,7 @@ async function setupZen(options = {}) { console.log('\n🎉 Setup complete!'); console.log('\nNext steps:'); console.log(' 1. Add Zen styles to your globals.css:'); - console.log(' @import \'@hykocx/zen/styles/zen.css\';'); + console.log(' @import \'@zen/core/styles/zen.css\';'); console.log(' 2. Configure environment variables (see .env.example)'); console.log(' 3. Initialize the database:'); console.log(' npx zen-db init'); diff --git a/src/core/api/handlers/storage.js b/src/core/api/handlers/storage.js index 908421f..82ccd27 100644 --- a/src/core/api/handlers/storage.js +++ b/src/core/api/handlers/storage.js @@ -6,7 +6,7 @@ import { validateSession } from '../../../features/auth/lib/session.js'; import { cookies } from 'next/headers'; import { getSessionCookieName } from '../../../shared/lib/appConfig.js'; -import { getFile } from '@hykocx/zen/storage'; +import { getFile } from '@zen/core/storage'; // Get cookie name from environment or use default const COOKIE_NAME = getSessionCookieName(); diff --git a/src/core/api/handlers/users.js b/src/core/api/handlers/users.js index 1045613..0bcaa56 100644 --- a/src/core/api/handlers/users.js +++ b/src/core/api/handlers/users.js @@ -5,10 +5,10 @@ import { validateSession } from '../../../features/auth/lib/session.js'; import { cookies } from 'next/headers'; -import { query, updateById } from '@hykocx/zen/database'; +import { query, updateById } from '@zen/core/database'; import { getSessionCookieName } from '../../../shared/lib/appConfig.js'; import { updateUser } from '../../../features/auth/lib/auth.js'; -import { uploadImage, deleteFile, generateUniqueFilename, generateUserFilePath, FILE_TYPE_PRESETS, FILE_SIZE_LIMITS, validateUpload } from '@hykocx/zen/storage'; +import { uploadImage, deleteFile, generateUniqueFilename, generateUserFilePath, FILE_TYPE_PRESETS, FILE_SIZE_LIMITS, validateUpload } from '@zen/core/storage'; // Get cookie name from environment or use default const COOKIE_NAME = getSessionCookieName(); diff --git a/src/core/api/index.js b/src/core/api/index.js index 67ce3c1..30551b4 100644 --- a/src/core/api/index.js +++ b/src/core/api/index.js @@ -2,7 +2,7 @@ * Zen API Module * * This module exports API utilities for custom handlers - * For route setup, import from '@hykocx/zen/zen/api' + * For route setup, import from '@zen/core/zen/api' */ // Export router utilities (for custom handlers) @@ -18,4 +18,4 @@ export { } from './handlers/users.js'; // Module API handlers are now self-contained in their respective modules -// e.g., invoice handlers are in @hykocx/zen/modules/invoice/api +// e.g., invoice handlers are in @zen/core/modules/invoice/api diff --git a/src/core/cron/index.js b/src/core/cron/index.js index 77af15b..d8910a9 100644 --- a/src/core/cron/index.js +++ b/src/core/cron/index.js @@ -3,7 +3,7 @@ * Wrapper around node-cron for scheduling tasks * * Usage in modules: - * import { schedule, validate } from '@hykocx/zen/cron'; + * import { schedule, validate } from '@zen/core/cron'; */ import cron from 'node-cron'; diff --git a/src/core/modules/client.js b/src/core/modules/client.js index 34588fd..a335072 100644 --- a/src/core/modules/client.js +++ b/src/core/modules/client.js @@ -29,4 +29,4 @@ export { // NOTE: getModulePublicPages is NOT exported here because it relies on the // server-side registry which is empty on the client. Use getModulePublicPageLoader() -// from '@hykocx/zen/modules/pages' instead for client-side public page loading. +// from '@zen/core/modules/pages' instead for client-side public page loading. diff --git a/src/core/payments/stripe.js b/src/core/payments/stripe.js index bcb4558..ce3ffb3 100644 --- a/src/core/payments/stripe.js +++ b/src/core/payments/stripe.js @@ -3,7 +3,7 @@ * Generic Stripe integration for payment processing * * Usage in modules: - * import { createCheckoutSession, isEnabled } from '@hykocx/zen/stripe'; + * import { createCheckoutSession, isEnabled } from '@zen/core/stripe'; */ /** diff --git a/src/core/pdf/index.js b/src/core/pdf/index.js index 9548dc6..6af82a4 100644 --- a/src/core/pdf/index.js +++ b/src/core/pdf/index.js @@ -3,7 +3,7 @@ * Wrapper around @react-pdf/renderer for PDF generation * * Usage in modules: - * import { renderToBuffer } from '@hykocx/zen/pdf'; + * import { renderToBuffer } from '@zen/core/pdf'; */ import { renderToBuffer as reactPdfRenderToBuffer } from '@react-pdf/renderer'; diff --git a/src/features/admin/actions.js b/src/features/admin/actions.js index a263877..d3e8d20 100644 --- a/src/features/admin/actions.js +++ b/src/features/admin/actions.js @@ -5,8 +5,8 @@ * server-side code (which includes database imports) into client components. * * Usage: - * import { getDashboardStats, getModuleDashboardStats } from '@hykocx/zen/admin/actions'; + * import { getDashboardStats, getModuleDashboardStats } from '@zen/core/admin/actions'; */ export { getDashboardStats } from './actions/statsActions.js'; -export { getAllModuleDashboardStats as getModuleDashboardStats } from '@hykocx/zen/modules/actions'; +export { getAllModuleDashboardStats as getModuleDashboardStats } from '@zen/core/modules/actions'; diff --git a/src/features/admin/actions/statsActions.js b/src/features/admin/actions/statsActions.js index 318f43c..2fc9332 100644 --- a/src/features/admin/actions/statsActions.js +++ b/src/features/admin/actions/statsActions.js @@ -9,9 +9,9 @@ * * ```javascript * // app/(admin)/admin/[...admin]/page.js - * import { protectAdmin } from '@hykocx/zen/admin'; - * import { getDashboardStats, getModuleDashboardStats } from '@hykocx/zen/admin/actions'; - * import { AdminPagesClient } from '@hykocx/zen/admin/pages'; + * import { protectAdmin } from '@zen/core/admin'; + * import { getDashboardStats, getModuleDashboardStats } from '@zen/core/admin/actions'; + * import { AdminPagesClient } from '@zen/core/admin/pages'; * * export default async function AdminPage({ params }) { * const { user } = await protectAdmin(); @@ -37,7 +37,7 @@ 'use server'; -import { query } from '@hykocx/zen/database'; +import { query } from '@zen/core/database'; /** * Get total number of users diff --git a/src/features/admin/components/pages/ProfilePage.js b/src/features/admin/components/pages/ProfilePage.js index 942ba0c..132b935 100644 --- a/src/features/admin/components/pages/ProfilePage.js +++ b/src/features/admin/components/pages/ProfilePage.js @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'; import { Card, Input, Button } from '../../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; const ProfilePage = ({ user: initialUser }) => { const toast = useToast(); diff --git a/src/features/admin/components/pages/UserEditPage.js b/src/features/admin/components/pages/UserEditPage.js index 3677f35..8ad7dcb 100644 --- a/src/features/admin/components/pages/UserEditPage.js +++ b/src/features/admin/components/pages/UserEditPage.js @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { Button, Card, Input, Select, Loading } from '../../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; /** * User Edit Page Component diff --git a/src/features/admin/components/pages/UsersPage.js b/src/features/admin/components/pages/UsersPage.js index 319be45..e8be61f 100644 --- a/src/features/admin/components/pages/UsersPage.js +++ b/src/features/admin/components/pages/UsersPage.js @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { Card, Table, StatusBadge, Pagination, Button } from '../../../../shared/components'; import { PencilEdit01Icon } from '../../../../shared/Icons.js'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; const UsersPageClient = () => { const router = useRouter(); diff --git a/src/features/admin/index.js b/src/features/admin/index.js index c043c00..fb20c9b 100644 --- a/src/features/admin/index.js +++ b/src/features/admin/index.js @@ -9,8 +9,8 @@ export { protectAdmin, isAdmin } from './middleware/protect.js'; // Component exports (for catch-all routes) export { AdminPagesClient, AdminPagesLayout } from './pages.js'; -// NOTE: Server-only navigation builder is in '@hykocx/zen/admin/navigation' +// NOTE: Server-only navigation builder is in '@zen/core/admin/navigation' // Do NOT import from this file to avoid bundling database code into client // NOTE: Admin server actions are exported separately to avoid bundling issues -// Import them from '@hykocx/zen/admin/actions' instead +// Import them from '@zen/core/admin/actions' instead diff --git a/src/features/admin/middleware/protect.js b/src/features/admin/middleware/protect.js index fec880f..5e02286 100644 --- a/src/features/admin/middleware/protect.js +++ b/src/features/admin/middleware/protect.js @@ -17,7 +17,7 @@ import { redirect } from 'next/navigation'; * * @example * // In a server component: - * import { protectAdmin } from '@hykocx/zen/admin'; + * import { protectAdmin } from '@zen/core/admin'; * * export default async function AdminPage() { * const session = await protectAdmin(); @@ -47,7 +47,7 @@ async function protectAdmin(options = {}) { * @returns {Promise} True if user is admin * * @example - * import { isAdmin } from '@hykocx/zen/admin'; + * import { isAdmin } from '@zen/core/admin'; * * export default async function Page() { * const admin = await isAdmin(); diff --git a/src/features/admin/navigation.server.js b/src/features/admin/navigation.server.js index 44be9ec..b51b5c3 100644 --- a/src/features/admin/navigation.server.js +++ b/src/features/admin/navigation.server.js @@ -7,16 +7,16 @@ * IMPORTANT: This file is NOT bundled to ensure it shares the same registry instance * that was populated during module discovery. * - * IMPORTANT: We import from '@hykocx/zen' (main package) to use the same registry + * IMPORTANT: We import from '@zen/core' (main package) to use the same registry * instance that was populated during initializeZen(). DO NOT import from - * '@hykocx/zen/core/modules' as that's a separate bundle with its own registry. + * '@zen/core/core/modules' as that's a separate bundle with its own registry. * * IMPORTANT: Navigation data must be serializable (no functions/components). * Icons are passed as string names and resolved on the client. */ // Import from the main package to use the same registry as discovery -import { moduleSystem } from '@hykocx/zen'; +import { moduleSystem } from '@zen/core'; const { getAllAdminNavigation } = moduleSystem; /** diff --git a/src/features/admin/page.js b/src/features/admin/page.js index 74aef83..8163daa 100644 --- a/src/features/admin/page.js +++ b/src/features/admin/page.js @@ -5,18 +5,18 @@ * Users can simply re-export this in their app/admin/[...admin]/page.js: * * ```javascript - * export { default } from '@hykocx/zen/admin/page'; + * export { default } from '@zen/core/admin/page'; * ``` * * This eliminates the need to manually import and pass all actions and props. */ -import { AdminPagesLayout, AdminPagesClient } from '@hykocx/zen/admin/pages'; -import { protectAdmin } from '@hykocx/zen/admin'; -import { buildNavigationSections } from '@hykocx/zen/admin/navigation'; -import { getDashboardStats, getModuleDashboardStats } from '@hykocx/zen/admin/actions'; -import { logoutAction } from '@hykocx/zen/auth/actions'; -import { getAppName, getModulesConfig, getAppConfig, moduleSystem } from '@hykocx/zen'; +import { AdminPagesLayout, AdminPagesClient } from '@zen/core/admin/pages'; +import { protectAdmin } from '@zen/core/admin'; +import { buildNavigationSections } from '@zen/core/admin/navigation'; +import { getDashboardStats, getModuleDashboardStats } from '@zen/core/admin/actions'; +import { logoutAction } from '@zen/core/auth/actions'; +import { getAppName, getModulesConfig, getAppConfig, moduleSystem } from '@zen/core'; const { getAdminPage } = moduleSystem; diff --git a/src/features/auth/README-custom-login.md b/src/features/auth/README-custom-login.md index 1f2e173..7c9ecb3 100644 --- a/src/features/auth/README-custom-login.md +++ b/src/features/auth/README-custom-login.md @@ -15,8 +15,8 @@ You can use a **custom page for every auth flow**: | Confirm email | `ConfirmEmailPage` | `verifyEmailAction` | | Logout | `LogoutPage` | `logoutAction`, `setSessionCookie` | -- **Components**: from `@hykocx/zen/auth/components` -- **Actions**: from `@hykocx/zen/auth/actions` +- **Components**: from `@zen/core/auth/components` +- **Actions**: from `@zen/core/auth/actions` Create your own routes (e.g. `/login`, `/register`, `/auth/forgot`) and wrap Zen’s components in your layout. Each page follows the same pattern: a **server component** that loads data and passes actions, and a **client wrapper** that handles navigation and renders the Zen component. @@ -58,7 +58,7 @@ Use this when wiring each custom page. **Server:** `app/login/page.js` (or `app/auth/login/page.js`) ```js -import { getSession, loginAction, setSessionCookie } from '@hykocx/zen/auth/actions'; +import { getSession, loginAction, setSessionCookie } from '@zen/core/auth/actions'; import { LoginPageWrapper } from './LoginPageWrapper'; export default async function LoginRoute() { @@ -81,7 +81,7 @@ export default async function LoginRoute() { 'use client'; import { useRouter } from 'next/navigation'; -import { LoginPage } from '@hykocx/zen/auth/components'; +import { LoginPage } from '@zen/core/auth/components'; export function LoginPageWrapper({ loginAction, setSessionCookie, currentUser }) { const router = useRouter(); @@ -104,7 +104,7 @@ export function LoginPageWrapper({ loginAction, setSessionCookie, currentUser }) **Server:** `app/register/page.js` ```js -import { getSession, registerAction } from '@hykocx/zen/auth/actions'; +import { getSession, registerAction } from '@zen/core/auth/actions'; import { RegisterPageWrapper } from './RegisterPageWrapper'; export default async function RegisterRoute() { @@ -126,7 +126,7 @@ export default async function RegisterRoute() { 'use client'; import { useRouter } from 'next/navigation'; -import { RegisterPage } from '@hykocx/zen/auth/components'; +import { RegisterPage } from '@zen/core/auth/components'; export function RegisterPageWrapper({ registerAction, currentUser }) { const router = useRouter(); @@ -147,7 +147,7 @@ export function RegisterPageWrapper({ registerAction, currentUser }) { **Server:** `app/forgot/page.js` ```js -import { getSession, forgotPasswordAction } from '@hykocx/zen/auth/actions'; +import { getSession, forgotPasswordAction } from '@zen/core/auth/actions'; import { ForgotPasswordPageWrapper } from './ForgotPasswordPageWrapper'; export default async function ForgotRoute() { @@ -169,7 +169,7 @@ export default async function ForgotRoute() { 'use client'; import { useRouter } from 'next/navigation'; -import { ForgotPasswordPage } from '@hykocx/zen/auth/components'; +import { ForgotPasswordPage } from '@zen/core/auth/components'; export function ForgotPasswordPageWrapper({ forgotPasswordAction, currentUser }) { const router = useRouter(); @@ -192,7 +192,7 @@ Requires `email` and `token` from the reset link (e.g. `/auth/reset?email=...&to **Server:** `app/auth/reset/page.js` (or `app/reset/page.js` with dynamic segment if needed) ```js -import { resetPasswordAction } from '@hykocx/zen/auth/actions'; +import { resetPasswordAction } from '@zen/core/auth/actions'; import { ResetPasswordPageWrapper } from './ResetPasswordPageWrapper'; export default async function ResetRoute({ searchParams }) { @@ -217,7 +217,7 @@ export default async function ResetRoute({ searchParams }) { 'use client'; import { useRouter } from 'next/navigation'; -import { ResetPasswordPage } from '@hykocx/zen/auth/components'; +import { ResetPasswordPage } from '@zen/core/auth/components'; export function ResetPasswordPageWrapper({ resetPasswordAction, email, token }) { const router = useRouter(); @@ -241,7 +241,7 @@ Requires `email` and `token` from the verification link (e.g. `/auth/confirm?ema **Server:** `app/auth/confirm/page.js` ```js -import { verifyEmailAction } from '@hykocx/zen/auth/actions'; +import { verifyEmailAction } from '@zen/core/auth/actions'; import { ConfirmEmailPageWrapper } from './ConfirmEmailPageWrapper'; export default async function ConfirmRoute({ searchParams }) { @@ -266,7 +266,7 @@ export default async function ConfirmRoute({ searchParams }) { 'use client'; import { useRouter } from 'next/navigation'; -import { ConfirmEmailPage } from '@hykocx/zen/auth/components'; +import { ConfirmEmailPage } from '@zen/core/auth/components'; export function ConfirmEmailPageWrapper({ verifyEmailAction, email, token }) { const router = useRouter(); @@ -288,7 +288,7 @@ export function ConfirmEmailPageWrapper({ verifyEmailAction, email, token }) { **Server:** `app/auth/logout/page.js` ```js -import { logoutAction, setSessionCookie } from '@hykocx/zen/auth/actions'; +import { logoutAction, setSessionCookie } from '@zen/core/auth/actions'; import { LogoutPageWrapper } from './LogoutPageWrapper'; export default function LogoutRoute() { @@ -308,7 +308,7 @@ export default function LogoutRoute() { ```js 'use client'; -import { LogoutPage } from '@hykocx/zen/auth/components'; +import { LogoutPage } from '@zen/core/auth/components'; export function LogoutPageWrapper({ logoutAction, setSessionCookie }) { return ( @@ -324,10 +324,10 @@ export function LogoutPageWrapper({ logoutAction, setSessionCookie }) { ## Protecting routes -Use `protect()` from `@hykocx/zen/auth` and set `redirectTo` to your custom login path: +Use `protect()` from `@zen/core/auth` and set `redirectTo` to your custom login path: ```js -import { protect } from '@hykocx/zen/auth'; +import { protect } from '@zen/core/auth'; export const middleware = protect({ redirectTo: '/login' }); ``` @@ -341,7 +341,7 @@ So unauthenticated users are sent to your custom login page. If you don’t need a custom layout, keep using the built-in auth UI. In `app/auth/[...auth]/page.js`: ```js -export { default } from '@hykocx/zen/auth/page'; +export { default } from '@zen/core/auth/page'; ``` This serves login, register, forgot, reset, confirm, and logout under `/auth/*` with the default styling. diff --git a/src/features/auth/README-dashboard.md b/src/features/auth/README-dashboard.md index 2f0f89b..f8c869e 100644 --- a/src/features/auth/README-dashboard.md +++ b/src/features/auth/README-dashboard.md @@ -7,11 +7,11 @@ This guide explains how to build a **client dashboard** in your Next.js app usin | Need | Solution | |------|----------| | Require login on a page | `protect()` in a **server component** – redirects to login if not authenticated | -| Get current user on server | `getSession()` from `@hykocx/zen/auth/actions` | -| Check auth without redirect | `checkAuth()` from `@hykocx/zen/auth` | -| Require a role | `requireRole(['admin', 'manager'])` from `@hykocx/zen/auth` | -| Show user in client (header/nav) | `UserMenu` or `UserAvatar` + `useCurrentUser` from `@hykocx/zen/auth/components` | -| Edit account (name + avatar) | `AccountSection` from `@hykocx/zen/auth/components` | +| Get current user on server | `getSession()` from `@zen/core/auth/actions` | +| Check auth without redirect | `checkAuth()` from `@zen/core/auth` | +| Require a role | `requireRole(['admin', 'manager'])` from `@zen/core/auth` | +| Show user in client (header/nav) | `UserMenu` or `UserAvatar` + `useCurrentUser` from `@zen/core/auth/components` | +| Edit account (name + avatar) | `AccountSection` from `@zen/core/auth/components` | | Call user API from client | `GET /zen/api/users/me`, `PUT /zen/api/users/profile`, `POST/DELETE /zen/api/users/profile/picture` (with `credentials: 'include'`) | All user APIs are **session-based**: the session cookie is read on the server. No token in client code. Avatar and profile updates are scoped to the current user; the API validates the session on every request. @@ -24,7 +24,7 @@ Use `protect()` in a **server component**. If there is no valid session, the use ```js // app/dashboard/page.js (Server Component) -import { protect } from '@hykocx/zen/auth'; +import { protect } from '@zen/core/auth'; import { DashboardClient } from './DashboardClient'; export default async function DashboardPage() { @@ -52,8 +52,8 @@ In your layout or header (server component), get the session and pass `user` to ```js // app/layout.js or app/dashboard/layout.js -import { getSession } from '@hykocx/zen/auth/actions'; -import { UserMenu } from '@hykocx/zen/auth/components'; +import { getSession } from '@zen/core/auth/actions'; +import { UserMenu } from '@zen/core/auth/components'; export default async function Layout({ children }) { const session = await getSession(); @@ -80,7 +80,7 @@ If you prefer not to pass user from the server, use the hook in a client compone ```js 'use client'; -import { UserMenu } from '@hykocx/zen/auth/components'; +import { UserMenu } from '@zen/core/auth/components'; export function Header() { return ( @@ -115,8 +115,8 @@ Use **`AccountSection`** on a page that is already protected (e.g. `/dashboard/a ```js // app/dashboard/account/page.js -import { protect } from '@hykocx/zen/auth'; -import { AccountSection } from '@hykocx/zen/auth/components'; +import { protect } from '@zen/core/auth'; +import { AccountSection } from '@zen/core/auth/components'; export default async function AccountPage() { const session = await protect({ redirectTo: '/auth/login' }); @@ -139,7 +139,7 @@ export default async function AccountPage() { - `POST /zen/api/users/profile/picture` for upload - `DELETE /zen/api/users/profile/picture` for remove -All with `credentials: 'include'` (session cookie). Ensure your app uses **ToastProvider** (from `@hykocx/zen/toast`) if you want toasts. +All with `credentials: 'include'` (session cookie). Ensure your app uses **ToastProvider** (from `@zen/core/toast`) if you want toasts. --- @@ -148,7 +148,7 @@ All with `credentials: 'include'` (session cookie). Ensure your app uses **Toast Use **`checkAuth()`** in a server component when you only need to know whether someone is logged in: ```js -import { checkAuth } from '@hykocx/zen/auth'; +import { checkAuth } from '@zen/core/auth'; export default async function Page() { const session = await checkAuth(); @@ -159,7 +159,7 @@ export default async function Page() { Use **`requireRole()`** when a page is only for certain roles: ```js -import { requireRole } from '@hykocx/zen/auth'; +import { requireRole } from '@zen/core/auth'; export default async function ManagerPage() { const session = await requireRole(['admin', 'manager'], { @@ -201,8 +201,8 @@ app/ **dashboard/layout.js:** ```js -import { protect } from '@hykocx/zen/auth'; -import { UserMenu } from '@hykocx/zen/auth/components'; +import { protect } from '@zen/core/auth'; +import { UserMenu } from '@zen/core/auth/components'; import Link from 'next/link'; export default async function DashboardLayout({ children }) { @@ -227,7 +227,7 @@ export default async function DashboardLayout({ children }) { **dashboard/page.js:** ```js -import { protect } from '@hykocx/zen/auth'; +import { protect } from '@zen/core/auth'; export default async function DashboardPage() { const session = await protect({ redirectTo: '/auth/login' }); @@ -244,8 +244,8 @@ export default async function DashboardPage() { **dashboard/account/page.js:** ```js -import { protect } from '@hykocx/zen/auth'; -import { AccountSection } from '@hykocx/zen/auth/components'; +import { protect } from '@zen/core/auth'; +import { AccountSection } from '@zen/core/auth/components'; export default async function AccountPage() { const session = await protect({ redirectTo: '/auth/login' }); @@ -269,6 +269,6 @@ If you use the **Invoice** module and want logged-in users to see their own invo - **User–client link**: In the admin, link a user to a client (User edit → Client). Only invoices for that client are shown. - **API**: `GET /zen/api/invoices/me` (session required) returns the current user’s linked client and that client’s invoices. -- **Component**: Use `ClientInvoicesSection` from `@hykocx/zen/invoice/dashboard` on a protected page (e.g. `/dashboard/invoices`). +- **Component**: Use `ClientInvoicesSection` from `@zen/core/invoice/dashboard` on a protected page (e.g. `/dashboard/invoices`). See the [Invoice module dashboard guide](../../modules/invoice/README-dashboard.md) for the full setup (API details, page example, linking users to clients, and security). diff --git a/src/features/auth/components/AccountSection.js b/src/features/auth/components/AccountSection.js index 8c9fdfa..3beed13 100644 --- a/src/features/auth/components/AccountSection.js +++ b/src/features/auth/components/AccountSection.js @@ -11,7 +11,7 @@ import React, { useState, useEffect, useRef } from 'react'; import { Card, Input, Button } from '../../../shared/components/index.js'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; import { useCurrentUser } from './useCurrentUser.js'; import UserAvatar from './UserAvatar.js'; diff --git a/src/features/auth/components/index.js b/src/features/auth/components/index.js index 20c2a46..19b6666 100644 --- a/src/features/auth/components/index.js +++ b/src/features/auth/components/index.js @@ -3,8 +3,8 @@ * * Use these components to build custom auth pages for every flow (login, register, forgot, * reset, confirm, logout) so they match your site's style. - * For a ready-made catch-all auth UI, use AuthPagesClient from '@hykocx/zen/auth/pages'. - * For the default full-page auth (no custom layout), re-export from '@hykocx/zen/auth/page'. + * For a ready-made catch-all auth UI, use AuthPagesClient from '@zen/core/auth/pages'. + * For the default full-page auth (no custom layout), re-export from '@zen/core/auth/page'. * * --- Custom auth pages (all types) --- * @@ -21,7 +21,7 @@ * * onNavigate receives 'login' | 'register' | 'forgot' | 'reset'. Map to your routes (e.g. /auth/${page}). * For reset/confirm, pass email and token from searchParams. Full guide: see README-custom-login.md in this package. - * Protect routes with protect() from '@hykocx/zen/auth', redirectTo your login path. + * Protect routes with protect() from '@zen/core/auth', redirectTo your login path. * * --- Dashboard / user display --- * diff --git a/src/features/auth/index.js b/src/features/auth/index.js index 967a51a..de7f3ad 100644 --- a/src/features/auth/index.js +++ b/src/features/auth/index.js @@ -1,8 +1,8 @@ /** * Zen Authentication Module - Server-side utilities * - * For client components, use '@hykocx/zen/auth/pages' - * For server actions, use '@hykocx/zen/auth/actions' + * For client components, use '@zen/core/auth/pages' + * For server actions, use '@zen/core/auth/actions' */ // Authentication library (server-side only) diff --git a/src/features/auth/middleware/protect.js b/src/features/auth/middleware/protect.js index 4bd9cf5..c6e5251 100644 --- a/src/features/auth/middleware/protect.js +++ b/src/features/auth/middleware/protect.js @@ -16,7 +16,7 @@ import { redirect } from 'next/navigation'; * * @example * // In a server component: - * import { protect } from '@hykocx/zen/auth'; + * import { protect } from '@zen/core/auth'; * * export default async function ProtectedPage() { * const session = await protect(); @@ -42,7 +42,7 @@ async function protect(options = {}) { * @returns {Promise} Session object or null if not authenticated * * @example - * import { checkAuth } from '@hykocx/zen/auth'; + * import { checkAuth } from '@zen/core/auth'; * * export default async function Page() { * const session = await checkAuth(); diff --git a/src/features/auth/page.js b/src/features/auth/page.js index 90d1c02..872fad6 100644 --- a/src/features/auth/page.js +++ b/src/features/auth/page.js @@ -2,14 +2,14 @@ * Auth Page - Server Component Wrapper for Next.js App Router * * Default auth UI: login, register, forgot, reset, confirm, logout at /auth/[...auth]. - * Re-export in your app: export { default } from '@hykocx/zen/auth/page'; + * Re-export in your app: export { default } from '@zen/core/auth/page'; * * For custom auth pages (all flows) that match your site style, use components from - * '@hykocx/zen/auth/components' and actions from '@hykocx/zen/auth/actions'. + * '@zen/core/auth/components' and actions from '@zen/core/auth/actions'. * See README-custom-login.md in this package. Basic sites can keep using this default page. */ -import { AuthPagesClient } from '@hykocx/zen/auth/pages'; +import { AuthPagesClient } from '@zen/core/auth/pages'; import { registerAction, loginAction, @@ -19,7 +19,7 @@ import { verifyEmailAction, setSessionCookie, getSession -} from '@hykocx/zen/auth/actions'; +} from '@zen/core/auth/actions'; export default async function AuthPage({ params, searchParams }) { const session = await getSession(); diff --git a/src/features/provider/ZenProvider.js b/src/features/provider/ZenProvider.js index 1e15294..17a03e6 100644 --- a/src/features/provider/ZenProvider.js +++ b/src/features/provider/ZenProvider.js @@ -1,7 +1,7 @@ 'use client'; import { useState } from 'react'; -import { ToastProvider, ToastContainer } from '@hykocx/zen/toast'; +import { ToastProvider, ToastContainer } from '@zen/core/toast'; import { registerExternalModulePages } from '../../modules/modules.pages.js'; /** diff --git a/src/index.js b/src/index.js index 6fe317e..8d3be77 100644 --- a/src/index.js +++ b/src/index.js @@ -26,7 +26,7 @@ export * as pdf from "./core/pdf/index.js"; // Export module system as namespace export * as moduleSystem from "./core/modules/index.js"; -// NOTE: Toast components are CLIENT ONLY - import from '@hykocx/zen/toast' +// NOTE: Toast components are CLIENT ONLY - import from '@zen/core/toast' // Do not export here to avoid mixing client/server boundaries // Export modules system as namespace (legacy, includes invoice module) diff --git a/src/modules/index.js b/src/modules/index.js index e280353..fed9df1 100644 --- a/src/modules/index.js +++ b/src/modules/index.js @@ -4,8 +4,8 @@ * * NOTE: Individual modules (like invoice) should NOT be exported from here. * Access module functionality directly via: - * - import { ... } from '@hykocx/zen/modules/invoice' - * - Or use the dynamic registry functions from @hykocx/zen/core/modules + * - import { ... } from '@zen/core/modules/invoice' + * - Or use the dynamic registry functions from @zen/core/core/modules */ // Module registry diff --git a/src/modules/modules.actions.js b/src/modules/modules.actions.js index 78ed963..b0f1d90 100644 --- a/src/modules/modules.actions.js +++ b/src/modules/modules.actions.js @@ -5,7 +5,7 @@ * External modules registered via zen.config.js are resolved through the runtime registry. * * Usage: - * import { getModuleActions } from '@hykocx/zen/modules/actions'; + * import { getModuleActions } from '@zen/core/modules/actions'; * const { getInvoiceByToken } = getModuleActions('invoice'); */ diff --git a/src/modules/modules.metadata.js b/src/modules/modules.metadata.js index 0877705..12ec6e0 100644 --- a/src/modules/modules.metadata.js +++ b/src/modules/modules.metadata.js @@ -5,7 +5,7 @@ * External modules registered via zen.config.js are resolved through the runtime registry. * * Usage: - * import { getMetadataGenerator } from '@hykocx/zen/modules/metadata'; + * import { getMetadataGenerator } from '@zen/core/modules/metadata'; * const fn = getMetadataGenerator('invoice', 'payment'); * const meta = await fn(params.token); */ diff --git a/src/modules/page.js b/src/modules/page.js index 43672b8..f1feca8 100644 --- a/src/modules/page.js +++ b/src/modules/page.js @@ -5,16 +5,16 @@ * Users can simply re-export this in their app/zen/[...zen]/page.js: * * ```javascript - * export { default, generateMetadata } from '@hykocx/zen/modules/page'; + * export { default, generateMetadata } from '@zen/core/modules/page'; * ``` * * Module actions are loaded from the static modules.actions.js registry. */ -import { PublicPagesLayout, PublicPagesClient } from '@hykocx/zen/modules/pages'; -import { getMetadataGenerator } from '@hykocx/zen/modules/metadata'; -import { getAppConfig } from '@hykocx/zen'; -import { getModuleActions } from '@hykocx/zen/modules/actions'; +import { PublicPagesLayout, PublicPagesClient } from '@zen/core/modules/pages'; +import { getMetadataGenerator } from '@zen/core/modules/metadata'; +import { getAppConfig } from '@zen/core'; +import { getModuleActions } from '@zen/core/modules/actions'; /** * Per-module path configuration. diff --git a/src/modules/posts/README.md b/src/modules/posts/README.md index 13c5bbe..55df62b 100644 --- a/src/modules/posts/README.md +++ b/src/modules/posts/README.md @@ -353,7 +353,7 @@ import { upsertPost, // Créer ou mettre à jour (idempotent) getPosts, // Liste avec pagination deletePost, // Supprimer -} from '@hykocx/zen/modules/posts/crud'; +} from '@zen/core/modules/posts/crud'; ``` ### `upsertPost(postType, rawData, uniqueField)` @@ -384,7 +384,7 @@ Si les posts liés n'existent pas encore, les créer d'abord avec `upsertPost` p ```js // src/cron/fetch-cves.js -import { upsertPost } from '@hykocx/zen/modules/posts/crud'; +import { upsertPost } from '@zen/core/modules/posts/crud'; export async function fetchAndImportCVEs() { const response = await fetch('https://api.example.com/cves/recent'); @@ -428,7 +428,7 @@ export async function fetchAndImportCVEs() { ### Exemple : fetcher d'actualités avec source ```js -import { upsertPost } from '@hykocx/zen/modules/posts/crud'; +import { upsertPost } from '@zen/core/modules/posts/crud'; export async function fetchAndImportActualites(sourceName, articles) { // S'assurer que la source existe diff --git a/src/modules/posts/admin/PostCreatePage.js b/src/modules/posts/admin/PostCreatePage.js index a02c2d4..720ab0f 100644 --- a/src/modules/posts/admin/PostCreatePage.js +++ b/src/modules/posts/admin/PostCreatePage.js @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { Button, Card } from '../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; import { getTodayString } from '../../../shared/lib/dates.js'; import PostFormFields from './PostFormFields.js'; diff --git a/src/modules/posts/admin/PostEditPage.js b/src/modules/posts/admin/PostEditPage.js index 9c5eeb4..f9a8ae6 100644 --- a/src/modules/posts/admin/PostEditPage.js +++ b/src/modules/posts/admin/PostEditPage.js @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { Button, Card } from '../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; import { formatDateForInput, formatDateTimeForInput } from '../../../shared/lib/dates.js'; import PostFormFields from './PostFormFields.js'; diff --git a/src/modules/posts/admin/PostsIndexPage.js b/src/modules/posts/admin/PostsIndexPage.js index 9ac2652..0ad024d 100644 --- a/src/modules/posts/admin/PostsIndexPage.js +++ b/src/modules/posts/admin/PostsIndexPage.js @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { Book02Icon, Layers01Icon } from '../../../shared/Icons.js'; import { Card, Button } from '../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; /** * Posts index page — shows all configured post types. diff --git a/src/modules/posts/admin/PostsListPage.js b/src/modules/posts/admin/PostsListPage.js index 634b645..a5a0f0d 100644 --- a/src/modules/posts/admin/PostsListPage.js +++ b/src/modules/posts/admin/PostsListPage.js @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { PlusSignCircleIcon, PencilEdit01Icon, Delete02Icon, Layers01Icon } from '../../../shared/Icons.js'; import { Table, Button, Card, Pagination } from '../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; import { formatDateForDisplay, formatDateTimeForDisplay } from '../../../shared/lib/dates.js'; /** diff --git a/src/modules/posts/api.js b/src/modules/posts/api.js index 27ed701..3d025f1 100644 --- a/src/modules/posts/api.js +++ b/src/modules/posts/api.js @@ -29,7 +29,7 @@ import { validateUpload, FILE_TYPE_PRESETS, FILE_SIZE_LIMITS -} from '@hykocx/zen/storage'; +} from '@zen/core/storage'; import { getPostsConfig, getPostType } from './config.js'; diff --git a/src/modules/posts/categories/admin/CategoriesListPage.js b/src/modules/posts/categories/admin/CategoriesListPage.js index 0265f3e..32f1712 100644 --- a/src/modules/posts/categories/admin/CategoriesListPage.js +++ b/src/modules/posts/categories/admin/CategoriesListPage.js @@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { PlusSignCircleIcon, PencilEdit01Icon, Delete02Icon } from '../../../../shared/Icons.js'; import { Table, Button, StatusBadge, Card, Pagination } from '../../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; function getPostTypeFromPath(pathname) { const segments = (pathname || '').split('/').filter(Boolean); diff --git a/src/modules/posts/categories/admin/CategoryCreatePage.js b/src/modules/posts/categories/admin/CategoryCreatePage.js index e720547..a21a512 100644 --- a/src/modules/posts/categories/admin/CategoryCreatePage.js +++ b/src/modules/posts/categories/admin/CategoryCreatePage.js @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { Button, Card, Input, Textarea } from '../../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; function getPostTypeFromPath(pathname) { const segments = (pathname || '').split('/').filter(Boolean); diff --git a/src/modules/posts/categories/admin/CategoryEditPage.js b/src/modules/posts/categories/admin/CategoryEditPage.js index b8b2d02..aea5cec 100644 --- a/src/modules/posts/categories/admin/CategoryEditPage.js +++ b/src/modules/posts/categories/admin/CategoryEditPage.js @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'; import { useRouter, usePathname } from 'next/navigation'; import { Button, Card, Input, Textarea } from '../../../../shared/components'; -import { useToast } from '@hykocx/zen/toast'; +import { useToast } from '@zen/core/toast'; function getParamsFromPath(pathname) { const segments = (pathname || '').split('/').filter(Boolean); diff --git a/src/modules/posts/categories/crud.js b/src/modules/posts/categories/crud.js index aef1288..f2b2eca 100644 --- a/src/modules/posts/categories/crud.js +++ b/src/modules/posts/categories/crud.js @@ -3,7 +3,7 @@ * Categories are scoped by post_type. */ -import { query } from '@hykocx/zen/database'; +import { query } from '@zen/core/database'; /** * Create a new category for a post type. diff --git a/src/modules/posts/crud.js b/src/modules/posts/crud.js index 17449ed..f51c5ca 100644 --- a/src/modules/posts/crud.js +++ b/src/modules/posts/crud.js @@ -4,8 +4,8 @@ * Relation fields are stored in zen_posts_relations (many-to-many). */ -import { query } from '@hykocx/zen/database'; -import { deleteFile } from '@hykocx/zen/storage'; +import { query } from '@zen/core/database'; +import { deleteFile } from '@zen/core/storage'; import { getPostType } from './config.js'; function slugify(text) { diff --git a/src/modules/posts/db.js b/src/modules/posts/db.js index 0b51a60..ab586e1 100644 --- a/src/modules/posts/db.js +++ b/src/modules/posts/db.js @@ -3,7 +3,7 @@ * Creates zen_posts and zen_posts_category tables. */ -import { query } from '@hykocx/zen/database'; +import { query } from '@zen/core/database'; import { getPostsConfig } from './config.js'; async function tableExists(tableName) { diff --git a/src/shared/lib/init.js b/src/shared/lib/init.js index 4a42c49..f2768a4 100644 --- a/src/shared/lib/init.js +++ b/src/shared/lib/init.js @@ -19,7 +19,7 @@ const ZEN_INIT_KEY = Symbol.for('__ZEN_INITIALIZED__'); * // instrumentation.js (Recommended) — internal modules only * export async function register() { * if (process.env.NEXT_RUNTIME === 'nodejs') { - * const { initializeZen } = await import('@hykocx/zen'); + * const { initializeZen } = await import('@zen/core'); * await initializeZen(); * } * } @@ -29,7 +29,7 @@ const ZEN_INIT_KEY = Symbol.for('__ZEN_INITIALIZED__'); * import zenConfig from './zen.config.js'; * export async function register() { * if (process.env.NEXT_RUNTIME === 'nodejs') { - * const { initializeZen } = await import('@hykocx/zen'); + * const { initializeZen } = await import('@zen/core'); * await initializeZen(zenConfig); * } * } diff --git a/tsup.config.js b/tsup.config.js index b223bee..6fb0f6b 100644 --- a/tsup.config.js +++ b/tsup.config.js @@ -43,7 +43,7 @@ export default defineConfig([ splitting: false, sourcemap: false, clean: true, - external: ['react', 'react-dom', 'next', 'pg', 'dotenv', 'dotenv/config', 'resend', '@react-email/components', 'node-cron', 'readline', 'crypto', 'url', 'fs', 'path', 'net', 'dns', 'tls', '@hykocx/zen/database', '@hykocx/zen/email', '@hykocx/zen/email/templates', '@hykocx/zen/storage', '@hykocx/zen/toast', '@hykocx/zen/modules/actions', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner'], + external: ['react', 'react-dom', 'next', 'pg', 'dotenv', 'dotenv/config', 'resend', '@react-email/components', 'node-cron', 'readline', 'crypto', 'url', 'fs', 'path', 'net', 'dns', 'tls', '@zen/core/database', '@zen/core/email', '@zen/core/email/templates', '@zen/core/storage', '@zen/core/toast', '@zen/core/modules/actions', '@aws-sdk/client-s3', '@aws-sdk/s3-request-presigner'], noExternal: [], bundle: true, banner: { @@ -77,18 +77,18 @@ export default defineConfig([ 'react', 'react-dom', 'next', - '@hykocx/zen', - '@hykocx/zen/auth/pages', - '@hykocx/zen/auth/actions', - '@hykocx/zen/admin', - '@hykocx/zen/admin/pages', - '@hykocx/zen/admin/actions', - '@hykocx/zen/admin/navigation', - '@hykocx/zen/toast', - '@hykocx/zen/core/modules', - '@hykocx/zen/modules/pages', - '@hykocx/zen/modules/actions', - '@hykocx/zen/modules/metadata', + '@zen/core', + '@zen/core/auth/pages', + '@zen/core/auth/actions', + '@zen/core/admin', + '@zen/core/admin/pages', + '@zen/core/admin/actions', + '@zen/core/admin/navigation', + '@zen/core/toast', + '@zen/core/core/modules', + '@zen/core/modules/pages', + '@zen/core/modules/actions', + '@zen/core/modules/metadata', ], bundle: false, // Don't bundle these files esbuildOptions(options) {