Skip to content

Commit ec3e020

Browse files
committedMar 23, 2023
deps: glob@9.3.1
1 parent 99cf197 commit ec3e020

File tree

286 files changed

+170
-14672
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+170
-14672
lines changed
 

‎lib/commands/help-search.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
const fs = require('fs')
1+
const { readFile } = require('fs/promises')
22
const path = require('path')
33
const chalk = require('chalk')
4-
const { promisify } = require('util')
5-
const glob = promisify(require('glob'))
6-
const readFile = promisify(fs.readFile)
4+
const glob = require('glob')
75
const BaseCommand = require('../base-command.js')
86

97
const globify = pattern => pattern.split('\\').join('/')
@@ -20,7 +18,9 @@ class HelpSearch extends BaseCommand {
2018
}
2119

2220
const docPath = path.resolve(this.npm.npmRoot, 'docs/content')
23-
const files = await glob(`${globify(docPath)}/*/*.md`)
21+
let files = await glob(`${globify(docPath)}/*/*.md`)
22+
// preserve glob@8 behavior
23+
files = files.sort((a, b) => a.localeCompare(b, 'en'))
2424
const data = await this.readFiles(files)
2525
const results = await this.searchFiles(args, data, files)
2626
const formatted = this.formatResults(args, results)

‎lib/commands/help.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
const spawn = require('@npmcli/promise-spawn')
22
const path = require('path')
33
const openUrl = require('../utils/open-url.js')
4-
const { promisify } = require('util')
5-
const glob = promisify(require('glob'))
4+
const glob = require('glob')
65
const localeCompare = require('@isaacs/string-locale-compare')('en')
76

87
const globify = pattern => pattern.split('\\').join('/')
@@ -34,7 +33,9 @@ class Help extends BaseCommand {
3433
return []
3534
}
3635
const g = path.resolve(this.npm.npmRoot, 'man/man[0-9]/*.[0-9]')
37-
const files = await glob(globify(g))
36+
let files = await glob(globify(g))
37+
// preserve glob@8 behavior
38+
files = files.sort((a, b) => a.localeCompare(b, 'en'))
3839

3940
return Object.keys(files.reduce(function (acc, file) {
4041
file = path.basename(file).replace(/\.[0-9]+$/, '')
@@ -86,7 +87,9 @@ class Help extends BaseCommand {
8687
if (aManNumberMatch[1] !== bManNumberMatch[1]) {
8788
return aManNumberMatch[1] - bManNumberMatch[1]
8889
}
90+
/* istanbul ignore next */
8991
} else if (bManNumberMatch) {
92+
/* istanbul ignore next */
9093
return 1
9194
}
9295

0 commit comments

Comments
 (0)