fix: Replace slugify in deploy-preview-netlify with simple regex solution #1543

Merged
konrad merged 1 commits from saibotk/frontend:fix/netlify-preview-slugs into main 2022-02-14 18:09:21 +00:00

1 Commits

Author SHA1 Message Date
saibotk a33e1e45bc
fix: Replace slugify in deploy-preview-netlify with simple regex
continuous-integration/drone/pr Build is passing Details
This commit removes the direct dependency on the "slugify" package, since it produces slugs, which are still invalid to be used as subdomain names.

We now use a custom RegEx scheme which just replaces all white spaces, dots and slashes with a "-" sign for readability and removes all otherwise invalid characters.

To account for specific language characters or unicode variants we first normalize it using the String.prototype.normalize() function, so we can preserve as much characters as possible. 

Additionally, we now make sure that our alias is not longer than 37 characters, which is the maximum alias length according to Netlify's documentation [0]

[0]: https://cli.netlify.com/commands/deploy
2022-02-14 15:11:03 +01:00