Skip to content

Commit

Permalink
Minimal changes to the typescript client
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-dp committed Dec 22, 2023
1 parent f016e66 commit c43259d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
17 changes: 2 additions & 15 deletions clients/typescript/src/cli/migrations/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,17 @@ export async function getMigrationNames(
* @param migrationsFolder Folder where migrations are stored.
* @returns An array of migrations.
*/
async function loadMigrations(
export async function loadMigrations(
migrationsFolder: string
): Promise<Migration[]> {
const migrationMetaDatas = await loadMigrationsMetaData(migrationsFolder)
return migrationMetaDatas.map(makeMigration)
}


/**
* Loads the meta data of all migrations that are present in the provided migrations folder.
* @param migrationsFolder Folder where migrations are stored.
* @returns An array of migrations meta data.
*/
export async function loadMigrationsMetaData(
migrationsFolder: string
): Promise<MetaData[]> {
const dirNames = await getMigrationNames(migrationsFolder)
const migrationPaths = dirNames.map((dirName) =>
path.join(migrationsFolder, dirName, 'metadata.json')
)
const migrationMetaDatas = await Promise.all(
migrationPaths.map(readMetadataFile)
)
return migrationMetaDatas
return migrationMetaDatas.map(makeMigration)
}

/**
Expand Down
2 changes: 0 additions & 2 deletions clients/typescript/src/cli/migrations/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export { handleGenerate } from './handler'
export { fetchMigrations } from './migrate'
export { loadMigrationsMetaData } from './builder'
2 changes: 1 addition & 1 deletion clients/typescript/src/cli/migrations/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ async function executeShellCommand(
* Fetches the migrations from the provided endpoint,
* unzips them and writes them to the `writeTo` location.
*/
export async function fetchMigrations(
async function fetchMigrations(
endpoint: string,
writeTo: string,
tmpFolder: string
Expand Down

0 comments on commit c43259d

Please sign in to comment.