Skip to content

Commit

Permalink
feat: ensure version prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
RostiMelk committed Feb 26, 2025
1 parent 85197ee commit 67c7a58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {debug} from '../../debug'
import {DEFAULT_API_VERSION, MIGRATIONS_DIRECTORY} from './constants'
import {resolveMigrations} from './listMigrationsCommand'
import {prettyFormat} from './prettyMutationFormatter'
import {ensureVersionPrefix} from './utils/esureVersionPrefix'
import {isLoadableMigrationScript, resolveMigrationScript} from './utils/resolveMigrationScript'

const helpText = `
Expand Down Expand Up @@ -182,7 +183,7 @@ const runMigrationCommand: CliCommandDefinition<CreateFlags> = {
projectId: project ?? projectConfig.projectId!,
apiHost: projectConfig.apiHost!,
token: projectConfig.token!,
apiVersion: apiVersion ?? DEFAULT_API_VERSION,
apiVersion: ensureVersionPrefix(apiVersion ?? DEFAULT_API_VERSION),
} as const
if (dry) {
dryRunHandler()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function ensureVersionPrefix(version: string): string {
if (!version.startsWith('v')) {
return `v${version}`
}
return version
}

0 comments on commit 67c7a58

Please sign in to comment.