Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
deps: bump glob from 8.1.0 to 9.3.0 (#162)
Browse files Browse the repository at this point in the history
* deps: bump glob from 8.1.0 to 9.3.0

Bumps [glob](https://github.com/isaacs/node-glob) from 8.1.0 to 9.3.0.
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v8.1.0...v9.3.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* fixup: glob is promisified now

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gar <gar+gh@danger.computer>
  • Loading branch information
dependabot[bot] and wraithgar authored Mar 21, 2023
1 parent fbaf022 commit bd925f0
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 56 deletions.
87 changes: 35 additions & 52 deletions lib/read-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,12 @@ function gypfile (file, data, cb) {
return cb(null, data)
}

glob('*.gyp', { cwd: dir }, function (er, files) {
if (er) {
return cb(er)
}
if (data.gypfile === false) {
return cb(null, data)
}
gypfile_(file, data, files, cb)
})
if (data.gypfile === false) {
return cb(null, data)
}
glob('*.gyp', { cwd: dir })
.then(files => gypfile_(file, data, files, cb))
.catch(er => cb(er))
}

function gypfile_ (file, data, files, cb) {
Expand All @@ -246,22 +243,13 @@ function serverjs (file, data, cb) {
if (s.start) {
return cb(null, data)
}
glob('server.js', { cwd: dir }, function (er, files) {
if (er) {
return cb(er)
fs.access(path.join(dir, 'server.js'), (err) => {
if (!err) {
s.start = 'node server.js'
data.scripts = s
}
serverjs_(file, data, files, cb)
})
}

function serverjs_ (file, data, files, cb) {
if (!files.length) {
return cb(null, data)
}
var s = data.scripts || {}
s.start = 'node server.js'
data.scripts = s
return cb(null, data)
})
}

function authors (file, data, cb) {
Expand Down Expand Up @@ -294,21 +282,20 @@ function readme (file, data, cb) {
}
var dir = path.dirname(file)
var globOpts = { cwd: dir, nocase: true, mark: true }
glob('{README,README.*}', globOpts, function (er, files) {
if (er) {
return cb(er)
}
// don't accept directories.
files = files.filter(function (filtered) {
return !filtered.match(/\/$/)
glob('{README,README.*}', globOpts)
.then(files => {
// don't accept directories.
files = files.filter(function (filtered) {
return !filtered.match(/\/$/)
})
if (!files.length) {
return cb()
}
var fn = preferMarkdownReadme(files)
var rm = path.resolve(dir, fn)
return readme_(file, data, rm, cb)
})
if (!files.length) {
return cb()
}
var fn = preferMarkdownReadme(files)
var rm = path.resolve(dir, fn)
readme_(file, data, rm, cb)
})
.catch(er => cb(er))
}

function preferMarkdownReadme (files) {
Expand Down Expand Up @@ -346,15 +333,14 @@ function mans (file, data, cb) {
}
const dirname = path.dirname(file)
cwd = path.resolve(path.dirname(file), cwd)
glob('**/*.[0-9]', { cwd }, function (er, mansGlob) {
if (er) {
return cb(er)
}
data.man = mansGlob.map(man =>
path.relative(dirname, path.join(cwd, man)).split(path.sep).join('/')
)
return cb(null, data)
})
glob('**/*.[0-9]', { cwd })
.then(mansGlob => {
data.man = mansGlob.map(man =>
path.relative(dirname, path.join(cwd, man)).split(path.sep).join('/')
)
return cb(null, data)
})
.catch(er => cb(er))
}

function bins (file, data, cb) {
Expand All @@ -366,12 +352,9 @@ function bins (file, data, cb) {
}

m = path.resolve(path.dirname(file), m)
glob('**', { cwd: m }, function (er, binsGlob) {
if (er) {
return cb(er)
}
bins_(file, data, binsGlob, cb)
})
glob('**', { cwd: m })
.then(binsGlob => bins_(file, data, binsGlob, cb))
.catch(er => cb(er))
}

function bins_ (file, data, binsGlob, cb) {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"template-oss-apply": "template-oss-apply --force"
},
"dependencies": {
"glob": "^8.0.1",
"glob": "^9.3.0",
"json-parse-even-better-errors": "^3.0.0",
"normalize-package-data": "^5.0.0",
"npm-normalize-package-bin": "^3.0.0"
Expand All @@ -43,9 +43,9 @@
},
"tap": {
"branches": 68,
"functions": 83,
"lines": 76,
"statements": 77,
"functions": 74,
"lines": 74,
"statements": 74,
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/serverjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"name":"serverjs", "version":"99.999.999999999"}

9 changes: 9 additions & 0 deletions test/fixtures/serverjs/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**package
* {
* "name": "indexjs-test",
* "version": "1.2.3",
* "description": "Did you know npm could do this, even?",
* "main": "index.js"
* }
**/
console.log('just a simple single-file package')
17 changes: 17 additions & 0 deletions test/serverjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const t = require('tap')
const read = require('../')
const { resolve } = require('path')
t.test('server.js file present', t => {
const fixture = resolve(__dirname, 'fixtures/serverjs/package.json')
read(fixture, (er, data) => {
if (er) {
throw er
}
t.match(data, {
scripts: {
start: 'node server.js',
},
})
t.end()
})
})

0 comments on commit bd925f0

Please sign in to comment.