fix(plugin-tools): remove double and trailing underscores from filenames and lower case the result
This commit is contained in:
parent
0081f77e86
commit
16340940b7
2 changed files with 11 additions and 1 deletions
|
|
@ -53,4 +53,9 @@ export const getTimestampPrefix = () => new Date().toISOString().replaceAll(/[-:
|
|||
* @param name A migration name to sanitize
|
||||
* @returns A sanitized migration name that can be used as a filename
|
||||
*/
|
||||
export const sanitizeMigrationName = (name: string) => name.replaceAll(/[\W/\\:|*?'"<>]/g, '_').trim();
|
||||
export const sanitizeMigrationName = (name: string) =>
|
||||
name
|
||||
.replaceAll(/[\W/\\:|*?'"<>]+/g, '_')
|
||||
.trim()
|
||||
.replace(/_$/, '')
|
||||
.toLocaleLowerCase();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue