diff --git a/.changeset/smart-colts-fix.md b/.changeset/smart-colts-fix.md new file mode 100644 index 0000000..2ec6858 --- /dev/null +++ b/.changeset/smart-colts-fix.md @@ -0,0 +1,5 @@ +--- +'@emigrate/cli': patch +--- + +Remove the double period before the file extension when generating new migration files diff --git a/packages/cli/src/new-command.ts b/packages/cli/src/new-command.ts index 137b481..cd6c055 100644 --- a/packages/cli/src/new-command.ts +++ b/packages/cli/src/new-command.ts @@ -34,9 +34,7 @@ export default async function newCommand({ directory, template, plugins = [], ex throw new UnexpectedError(`Failed to read template file: ${templatePath}`, { cause: error }); } - filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}.${withLeadingPeriod( - extension ?? fileExtension, - )}`; + filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}${withLeadingPeriod(extension ?? fileExtension)}`; } let hasGeneratedFile = Boolean(filename && content !== undefined); @@ -56,7 +54,7 @@ export default async function newCommand({ directory, template, plugins = [], ex if (extension && !hasGeneratedFile) { content = ''; - filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}.${withLeadingPeriod(extension)}`; + filename = `${getTimestampPrefix()}_${sanitizeMigrationName(name)}${withLeadingPeriod(extension)}`; } if (!filename || content === undefined) {