Files
dokploy/apps/dokploy/lib/slug.ts
Mauricio Siu 86b56e2597 Refactor appName generation in dashboard components
- Updated the appName generation logic in `AddApplication`, `AddCompose`, and `AddDatabase` components to use the `slugify` function for improved consistency and readability.
- Enhanced the `slugify` function to return a default value of "service" if the input is empty, ensuring robustness in name generation.
- Improved project name validation in `handle-project.tsx` to enforce stricter rules on naming conventions.
2025-05-04 20:14:49 -06:00

16 lines
275 B
TypeScript

import slug from "slugify";
export const slugify = (text: string | undefined) => {
if (!text) {
return "";
}
const cleanedText = text.trim().replace(/[^a-zA-Z0-9\s]/g, "") || "service";
return slug(cleanedText, {
lower: true,
trim: true,
strict: true,
});
};