diff --git a/package-lock.json b/package-lock.json index e5dc4547f2..a57fab5b3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "file-type": "18.2.1", "flat": "^5.0.2", "github-slugger": "^2.0.0", + "glob": "9.3.2", "got": "^12.5.3", "gray-matter": "^4.0.3", "hast-util-from-parse5": "^7.1.0", @@ -135,7 +136,6 @@ "eslint-plugin-promise": "^6.0.0", "event-to-promise": "^0.8.0", "git-diff": "^2.0.6", - "glob": "^8.0.3", "graphql": "^16.5.0", "http-status-code": "^2.1.0", "husky": "^8.0.1", @@ -6479,7 +6479,6 @@ }, "node_modules/brace-expansion": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -9543,7 +9542,6 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", - "devOptional": true, "license": "ISC" }, "node_modules/fsevents": { @@ -9782,18 +9780,17 @@ "license": "ISC" }, "node_modules/glob": { - "version": "8.0.3", - "dev": true, - "license": "ISC", + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.2.tgz", + "integrity": "sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA==", "dependencies": { "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "minimatch": "^7.4.1", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" }, "engines": { - "node": ">=12" + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -9816,17 +9813,6 @@ "license": "BSD-2-Clause", "peer": true }, - "node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/global-dirs": { "version": "3.0.0", "dev": true, @@ -13836,6 +13822,25 @@ "node": ">=14" } }, + "node_modules/linkinator/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/linkinator/node_modules/mime": { "version": "3.0.0", "dev": true, @@ -13847,6 +13852,18 @@ "node": ">=10.0.0" } }, + "node_modules/linkinator/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/lint-staged": { "version": "13.0.3", "dev": true, @@ -15289,9 +15306,9 @@ } }, "node_modules/minimatch": { - "version": "7.0.0", - "dev": true, - "license": "ISC", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.3.tgz", + "integrity": "sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A==", "dependencies": { "brace-expansion": "^2.0.1" }, @@ -15322,6 +15339,14 @@ "node": ">= 6" } }, + "node_modules/minipass": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", + "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==", + "engines": { + "node": ">=8" + } + }, "node_modules/mixin-object": { "version": "2.0.1", "devOptional": true, @@ -16193,6 +16218,29 @@ "dev": true, "license": "MIT" }, + "node_modules/path-scurry": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.3.tgz", + "integrity": "sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g==", + "dependencies": { + "lru-cache": "^7.14.1", + "minipass": "^4.0.2" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "license": "MIT" @@ -24962,7 +25010,6 @@ }, "brace-expansion": { "version": "2.0.1", - "dev": true, "requires": { "balanced-match": "^1.0.0" } @@ -26909,8 +26956,7 @@ } }, "fs.realpath": { - "version": "1.0.0", - "devOptional": true + "version": "1.0.0" }, "fsevents": { "version": "2.3.2", @@ -27066,23 +27112,14 @@ "version": "2.0.0" }, "glob": { - "version": "8.0.3", - "dev": true, + "version": "9.3.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.2.tgz", + "integrity": "sha512-BTv/JhKXFEHsErMte/AnfiSv8yYOLLiyH2lTg8vn02O21zWFgHPTfxtgn1QRe7NRgggUhC8hacR2Re94svHqeA==", "requires": { "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "dependencies": { - "minimatch": { - "version": "5.1.6", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } + "minimatch": "^7.4.1", + "minipass": "^4.2.4", + "path-scurry": "^1.6.1" } }, "glob-parent": { @@ -29963,9 +30000,31 @@ "update-notifier": "^6.0.0" }, "dependencies": { + "glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, "mime": { "version": "3.0.0", "dev": true + }, + "minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } } } }, @@ -30766,8 +30825,9 @@ "dev": true }, "minimatch": { - "version": "7.0.0", - "dev": true, + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.3.tgz", + "integrity": "sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A==", "requires": { "brace-expansion": "^2.0.1" } @@ -30784,6 +30844,11 @@ "kind-of": "^6.0.3" } }, + "minipass": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.5.tgz", + "integrity": "sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==" + }, "mixin-object": { "version": "2.0.1", "devOptional": true, @@ -31337,6 +31402,22 @@ "version": "1.0.7", "dev": true }, + "path-scurry": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.3.tgz", + "integrity": "sha512-RAmB+n30SlN+HnNx6EbcpoDy9nwdpcGPnEKrJnu6GZoDWBdIjo1UQMVtW2ybtC7LC2oKLcMq8y5g8WnKLiod9g==", + "requires": { + "lru-cache": "^7.14.1", + "minipass": "^4.0.2" + }, + "dependencies": { + "lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==" + } + } + }, "path-to-regexp": { "version": "0.1.7" }, diff --git a/package.json b/package.json index b11a1ed0b9..75c8168762 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "file-type": "18.2.1", "flat": "^5.0.2", "github-slugger": "^2.0.0", + "glob": "9.3.2", "got": "^12.5.3", "gray-matter": "^4.0.3", "hast-util-from-parse5": "^7.1.0", @@ -137,7 +138,6 @@ "eslint-plugin-promise": "^6.0.0", "event-to-promise": "^0.8.0", "git-diff": "^2.0.6", - "glob": "^8.0.3", "graphql": "^16.5.0", "http-status-code": "^2.1.0", "husky": "^8.0.1", diff --git a/src/rest/scripts/openapi-check.js b/src/rest/scripts/openapi-check.js index 1d3f180e65..4cd69f435d 100755 --- a/src/rest/scripts/openapi-check.js +++ b/src/rest/scripts/openapi-check.js @@ -8,7 +8,7 @@ import fs from 'fs' import path from 'path' -import glob from 'glob' +import { globSync } from 'glob' import { program } from 'commander' import { createOperations, processOperations } from './utils/get-operations.js' @@ -22,7 +22,7 @@ program const filenames = program.opts().files -const filesToCheck = filenames.flatMap((filename) => glob.sync(filename)) +const filesToCheck = filenames.flatMap((filename) => globSync(filename)) if (filesToCheck.length) { check(filesToCheck) diff --git a/tests/content/secure-files.js b/tests/content/secure-files.js index b714d0d578..3389cc8405 100644 --- a/tests/content/secure-files.js +++ b/tests/content/secure-files.js @@ -1,5 +1,5 @@ import fs from 'fs/promises' -import path from 'path' + import glob from 'glob' /* @@ -17,21 +17,14 @@ const secureFiles = [ }, ] -const codeOwnersFile = await fs.readFile(path.join(process.cwd(), '.github/CODEOWNERS'), 'utf8') +const codeOwnersFile = await fs.readFile('.github/CODEOWNERS', 'utf8') const codeOwners = codeOwnersFile.split(/\r?\n/) describe('Secure file paths are present and have code owners if required', () => { for (const file of secureFiles) { test(`secure file(s) check for: ${file.name}`, async () => { // Verify file(s) exist in provided path - const matchingFiles = await new Promise((resolve, reject) => { - glob(file.path, { strict: true }, (error, files) => { - if (error) { - return reject(error) - } - resolve(files) - }) - }) + const matchingFiles = await glob(file.path) expect(matchingFiles.length, `Expected to find content in "${file.path}"`).toBeGreaterThan(0) // Verify there are code owners for file(s)