mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-19 14:15:21 +02:00
- 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.
16 lines
275 B
TypeScript
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,
|
|
});
|
|
};
|