Skip to content

Commit

Permalink
deps: bump it-glob from 2.0.7 to 3.0.1 (#231)
Browse files Browse the repository at this point in the history
Bumps [it-glob](https://github.com/achingbrain/it) from 2.0.7 to 3.0.1.
- [Release notes](https://github.com/achingbrain/it/releases)
- [Commits](achingbrain/it@it-glob-2.0.7...it-glob-3.0.1)

---
updated-dependencies:
- dependency-name: it-glob
  dependency-type: direct:production
  update-type: version-update:semver-major
...

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Potsides <[email protected]>
  • Loading branch information
dependabot[bot] and achingbrain authored Sep 12, 2024
1 parent 632bee3 commit 500b9c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"iso-url": "^1.2.1",
"it-all": "^3.0.4",
"it-first": "^3.0.4",
"it-glob": "^2.0.6",
"it-glob": "^3.0.1",
"it-last": "^3.0.4",
"it-map": "^3.0.5",
"it-peekable": "^3.0.3",
Expand Down
22 changes: 16 additions & 6 deletions src/lib/glob-source.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import fs from 'node:fs'
import fsp from 'node:fs/promises'
import os from 'node:os'
import Path from 'node:path'
import { CodeError } from '@libp2p/interface'
import glob from 'it-glob'
import type { MtimeLike } from 'ipfs-unixfs'
import type { Options as GlobOptions } from 'it-glob'

export interface GlobSourceOptions {
/**
Expand Down Expand Up @@ -58,15 +60,23 @@ export async function * globSource (cwd: string, pattern: string, options?: Glob
cwd = Path.resolve(process.cwd(), cwd)
}

const globOptions = Object.assign({}, {
nodir: false,
realpath: false,
if (os.platform() === 'win32') {
cwd = toPosix(cwd)
}

const globOptions: GlobOptions = Object.assign({}, {
onlyFiles: false,
absolute: true,
dot: Boolean(options.hidden),
follow: options.followSymlinks ?? true
})
followSymbolicLinks: options.followSymlinks ?? true
} satisfies GlobOptions)

for await (const p of glob(cwd, pattern, globOptions)) {
// Workaround for https://github.com/micromatch/micromatch/issues/251
if (Path.basename(p).startsWith('.') && options.hidden !== true) {
continue
}

const stat = await fsp.stat(p)

let mode = options.mode
Expand All @@ -82,7 +92,7 @@ export async function * globSource (cwd: string, pattern: string, options?: Glob
}

yield {
path: toPosix(p.replace(cwd, '')),
path: p.replace(cwd, ''),
content: stat.isFile() ? fs.createReadStream(p) : undefined,
mode,
mtime
Expand Down

0 comments on commit 500b9c1

Please sign in to comment.