diff options
author | Evan Read <eread@gitlab.com> | 2023-03-06 05:16:41 +0300 |
---|---|---|
committer | David O'Regan <doregan@gitlab.com> | 2023-03-06 05:16:41 +0300 |
commit | a54039663d153148e32c8d658d51d7b1f17a863d (patch) | |
tree | 2d8ccf5f09b7ae1f6ff10193ea9c620b104ce16a | |
parent | 547451f7e5c1aace1cfc2e2fadd73c17ce17aabb (diff) |
Roll glob dependency forward
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | rollup.config.js | 4 | ||||
-rw-r--r-- | scripts/lunr/preindex.js | 20 | ||||
-rw-r--r-- | yarn.lock | 37 |
4 files changed, 44 insertions, 19 deletions
diff --git a/package.json b/package.json index 792cbc0d..ebe27670 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "compare-versions": "^5.0.3", "eslint-plugin-filenames": "^1.3.2", "front-matter": "^4.0.2", - "glob": "^8.1.0", + "glob": "^9.2.1", "instantsearch.css": "^8.0.0", "instantsearch.js": "^4.51.1", "jquery": "^3.6.3", diff --git a/rollup.config.js b/rollup.config.js index 8a67c8f7..d84f6f61 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,7 +2,7 @@ const inject = require('@rollup/plugin-inject'); const json = require('@rollup/plugin-json'); const { nodeResolve } = require('@rollup/plugin-node-resolve'); const replace = require('@rollup/plugin-replace'); -const glob = require('glob'); +const { globSync } = require('glob'); const commonjs = require('@rollup/plugin-commonjs'); const { babel } = require('@rollup/plugin-babel'); const importResolver = require('rollup-plugin-import-resolver'); @@ -15,7 +15,7 @@ function mapDirectory(file) { return file.replace('content/', 'public/'); } -module.exports = glob.sync('content/frontend/**/*.js').map((file) => ({ +module.exports = globSync('content/frontend/**/*.js').map((file) => ({ input: file, output: { file: mapDirectory(file), diff --git a/scripts/lunr/preindex.js b/scripts/lunr/preindex.js index b883d9a0..088fd35c 100644 --- a/scripts/lunr/preindex.js +++ b/scripts/lunr/preindex.js @@ -16,20 +16,12 @@ const fs = require('fs'); const lunr = require('lunr'); const cheerio = require('cheerio'); -const glob = require('glob'); +const { glob } = require('glob'); const htmlSrc = 'public/'; const outputDir = `${htmlSrc}assets/javascripts`; -/** - * Find all HTML files within a given path, - * then execute a callback function to build the index. - */ -const buildIndex = (path, callback) => { - glob(`${path}/**/*.html`, callback); -}; - -/** +/* * Extracts text from a given HTML element. * * @param {cheerio} $ @@ -53,10 +45,8 @@ const getText = ($, element) => { /** * Build the index and output files. */ -buildIndex(htmlSrc, (err, filenames) => { - if (err) { - console.error(err); - } +(async () => { + const filenames = await glob(`${htmlSrc}/**/*.html`); // Create an array of objects containing each page's text content. const pages = []; @@ -103,4 +93,4 @@ buildIndex(htmlSrc, (err, filenames) => { console.error(fsErr); } }); -}); +})(); @@ -3924,7 +3924,7 @@ glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3, glob@^8.1.0: +glob@^8.0.3: version "8.1.0" resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== @@ -3935,6 +3935,16 @@ glob@^8.0.3, glob@^8.1.0: minimatch "^5.0.1" once "^1.3.0" +glob@^9.2.1: + version "9.2.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-9.2.1.tgz#f47e34e1119e7d4f93a546e75851ba1f1e68de50" + integrity sha512-Pxxgq3W0HyA3XUvSXcFhRSs+43Jsx0ddxcFrbjxNGkL2Ak5BAUBxLqI5G6ADDeCHLfzzXFhe0b1yYcctGmytMA== + dependencies: + fs.realpath "^1.0.0" + minimatch "^7.4.1" + minipass "^4.2.4" + path-scurry "^1.6.1" + glob@~8.0.3: version "8.0.3" resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" @@ -5294,6 +5304,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru-cache@^7.14.1: + version "7.17.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.17.0.tgz#00c7ba5919e5ea7c69ff94ddabbf32cb09ab805c" + integrity sha512-zSxlVVwOabhVyTi6E8gYv2cr6bXK+8ifYz5/uyJb9feXX6NACVDwY4p5Ut3WC3Ivo/QhpARHU3iujx2xGAYHbQ== + lunr@^2.3.9: version "2.3.9" resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" @@ -5520,6 +5535,13 @@ minimatch@^5.0.1, minimatch@~5.1.2: dependencies: brace-expansion "^2.0.1" +minimatch@^7.4.1: + version "7.4.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.2.tgz#157e847d79ca671054253b840656720cb733f10f" + integrity sha512-xy4q7wou3vUoC9k1xGTXc+awNdGaGVHtFUaey8tiX4H1QRc04DZ/rmDFwNm2EBsuYEhAZ6SgMmYf3InGY6OauA== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -5534,6 +5556,11 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +minipass@^4.0.2, minipass@^4.2.4: + version "4.2.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.4.tgz#7d0d97434b6a19f59c5c3221698b48bbf3b2cd06" + integrity sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ== + mitt@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mitt/-/mitt-2.1.0.tgz#f740577c23176c6205b121b2973514eade1b2230" @@ -5849,6 +5876,14 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.6.1.tgz#dab45f7bb1d3f45a0e271ab258999f4ab7e23132" + integrity sha512-OW+5s+7cw6253Q4E+8qQ/u1fVvcJQCJo/VFD8pje+dbJCF1n5ZRMV2AEHbGp+5Q7jxQIYJxkHopnj6nzdGeZLA== + dependencies: + lru-cache "^7.14.1" + minipass "^4.0.2" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" |