fix(plugin-tools): trim leading underscores from filenames

This commit is contained in:
Joakim Carlstein 2023-11-10 14:47:44 +01:00
parent 23d390e602
commit 4e2a27ffeb

View file

@ -109,7 +109,7 @@ export const getTimestampPrefix = () => new Date().toISOString().replaceAll(/[-:
*/
export const sanitizeMigrationName = (name: string) =>
name
.replaceAll(/[\W/\\:|*?'"<>]+/g, '_')
.replaceAll(/[\W/\\:|*?'"<>_]+/g, '_')
.trim()
.replace(/_$/, '')
.replace(/^_|_$/, '')
.toLocaleLowerCase();