feat(workspaces): add workspace slug support (#2982)

* feat(workspaces): add workspace slug support

* chore(workspaces): lint

* feat(workspaces): add slug validation and generation

* fix(workspaces): test lint miss
This commit is contained in:
Gergő Jedlicska
2024-09-18 13:29:36 +02:00
committed by GitHub
parent 56d392424d
commit 00c01db923
25 changed files with 518 additions and 82 deletions
@@ -10,6 +10,13 @@ export class InvalidWorkspaceSlugError extends Error {
}
}
export const generateSlugFromName = ({ name }: { name: string }): string => {
return name
.replace(/ /g, '-')
.toLowerCase()
.replace(/[^a-z0-9-]/g, '')
}
export function validateWorkspaceSlug(slug: string): void {
if (slug.length < MIN_SLUG_LENGTH) {
throw new InvalidWorkspaceSlugError(