fix(cli): remove the double period before file extension in new migration files
This commit is contained in:
parent
7d8ac9b185
commit
1940885134
2 changed files with 7 additions and 4 deletions
5
.changeset/smart-colts-fix.md
Normal file
5
.changeset/smart-colts-fix.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@emigrate/cli': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove the double period before the file extension when generating new migration files
|
||||||
|
|
@ -34,9 +34,7 @@ export default async function newCommand({ directory, template, plugins = [], ex
|
||||||
throw new UnexpectedError(`Failed to read template file: ${templatePath}`, { cause: error });
|
throw new UnexpectedError(`Failed to read template file: ${templatePath}`, { cause: error });
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}.${withLeadingPeriod(
|
filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}${withLeadingPeriod(extension ?? fileExtension)}`;
|
||||||
extension ?? fileExtension,
|
|
||||||
)}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let hasGeneratedFile = Boolean(filename && content !== undefined);
|
let hasGeneratedFile = Boolean(filename && content !== undefined);
|
||||||
|
|
@ -56,7 +54,7 @@ export default async function newCommand({ directory, template, plugins = [], ex
|
||||||
|
|
||||||
if (extension && !hasGeneratedFile) {
|
if (extension && !hasGeneratedFile) {
|
||||||
content = '';
|
content = '';
|
||||||
filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}.${withLeadingPeriod(extension)}`;
|
filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}${withLeadingPeriod(extension)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!filename || content === undefined) {
|
if (!filename || content === undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue