Skip to content

Commit cbfaadb

Browse files
authored
bump glob to v10 (#658)
closes #638 sort paths since they come back in reverse order now --------- Co-authored-by: Misha Kaletsky <[email protected]>
1 parent 53c9a54 commit cbfaadb

File tree

3 files changed

+14
-59
lines changed

3 files changed

+14
-59
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"dependencies": {
1818
"@rushstack/ts-command-line": "^4.12.2",
1919
"emittery": "^0.13.0",
20-
"glob": "^8.0.3",
20+
"glob": "^10.3.10",
2121
"pony-cause": "^2.1.4",
2222
"type-fest": "^4.0.0"
2323
},

pnpm-lock.yaml

Lines changed: 9 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/umzug.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import emittery from 'emittery'
22
import * as fs from 'fs'
3-
import glob from 'glob'
3+
import {glob} from 'glob'
44
import * as path from 'path'
55
import * as errorCause from 'pony-cause'
6-
import {promisify} from 'util'
76
import type {CommandLineParserOptions} from './cli'
87
import {UmzugCLI} from './cli'
98
import type {UmzugStorage} from './storage'
@@ -23,8 +22,6 @@ import type {
2322
} from './types'
2423
import {RerunBehavior} from './types'
2524

26-
const globAsync = promisify(glob)
27-
2825
type MigrationErrorParams = {
2926
direction: 'up' | 'down'
3027
} & MigrationParams<unknown>
@@ -489,12 +486,13 @@ export class Umzug<Ctx extends object = object> extends emittery<UmzugEvents<Ctx
489486
}
490487

491488
const fileGlob = inputMigrations.glob
492-
const [globString, globOptions]: Parameters<typeof glob.sync> = Array.isArray(fileGlob) ? fileGlob : [fileGlob]
489+
const [globString, globOptions] = Array.isArray(fileGlob) ? fileGlob : [fileGlob]
493490

494491
const resolver: Resolver<Ctx> = inputMigrations.resolve ?? Umzug.defaultResolver
495492

496493
return async context => {
497-
const paths = await globAsync(globString, {...globOptions, absolute: true})
494+
const paths = await glob(globString, {...globOptions, withFileTypes: false, absolute: true})
495+
paths.sort() // glob returns results in reverse alphabetical order these days, but it has never guaranteed not to do that https://github.com/isaacs/node-glob/issues/570
498496
return paths.map(unresolvedPath => {
499497
const filepath = path.resolve(unresolvedPath)
500498
const name = path.basename(filepath)

0 commit comments

Comments
 (0)