From 4e0f2a2ec3126ccf9bc8224e9d0e3ba90e08bb59 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Sat, 11 Nov 2023 11:12:12 +0000 Subject: [PATCH] Issue #3398946 by Spokje: Upgrade glob to latest possible version working with yarn 1.* --- core/package.json | 3 +- core/scripts/css/postcss-build.js | 15 ++-- core/scripts/js/assets/ckeditor5Files.js | 6 +- core/scripts/js/ckeditor5-check-plugins.js | 4 +- .../js/ckeditor5-types-documentation.js | 4 +- .../Drupal/Nightwatch/nightwatch.conf.js | 20 +++--- core/yarn.lock | 71 +++++++++++++++---- 7 files changed, 84 insertions(+), 39 deletions(-) diff --git a/core/package.json b/core/package.json index d143673d1b5..059bbe2afc5 100644 --- a/core/package.json +++ b/core/package.json @@ -70,7 +70,7 @@ "eslint-plugin-jquery": "^1.5.1", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-yml": "^1.8.0", - "glob": "^8.0.3", + "glob": "10.3.5", "jquery": "~3.7.0", "jquery-form": "4.3.x", "jquery-ui": "1.13.x", @@ -105,6 +105,7 @@ "webpack-cli": "^5.1.3" }, "resolutions": { + "glob/jackspeak": "2.1.1", "nightwatch/semver": "~7.5.2" }, "browserslist": [ diff --git a/core/scripts/css/postcss-build.js b/core/scripts/css/postcss-build.js index ce1eca45879..743a155ff92 100644 --- a/core/scripts/css/postcss-build.js +++ b/core/scripts/css/postcss-build.js @@ -6,9 +6,9 @@ * Run build:css with --file to only parse a specific file. Using the --check * flag build:css can be run to check if files are compiled correctly. * @example Only process misc/drupal.pcss.css and misc/drupal.init.pcss.css - * yarn run build:css -- --file misc/drupal.pcss.css --file misc/drupal.init.pcss.css + * yarn run build:css --file misc/drupal.pcss.css --file misc/drupal.init.pcss.css * @example Check if all files have been compiled correctly - * yarn run build:css -- --check + * yarn run build:css --check * * @internal This file is part of the core CSS build process and is only * designed to be used in that context. @@ -16,7 +16,7 @@ 'use strict'; -const glob = require('glob'); +const { globSync } = require('glob'); const argv = require('minimist')(process.argv.slice(2)); const changeOrAdded = require('./changeOrAdded'); const check = require('./check'); @@ -28,10 +28,7 @@ const fileMatch = './**/*.pcss.css'; const globOptions = { ignore: './node_modules/**' }; -const processFiles = (error, filePaths) => { - if (error) { - process.exitCode = 1; - } +const processFiles = (filePaths) => { // Process all the found files. let callback = changeOrAdded; if (argv.check) { @@ -41,9 +38,9 @@ const processFiles = (error, filePaths) => { }; if (argv.file) { - processFiles(null, [].concat(argv.file)); + processFiles([].concat(argv.file)); } else { - glob(fileMatch, globOptions, processFiles); + processFiles(globSync(fileMatch, globOptions).sort()); } process.exitCode = 0; diff --git a/core/scripts/js/assets/ckeditor5Files.js b/core/scripts/js/assets/ckeditor5Files.js index 422eb3e55c8..bd3c7ed2dcb 100644 --- a/core/scripts/js/assets/ckeditor5Files.js +++ b/core/scripts/js/assets/ckeditor5Files.js @@ -2,7 +2,7 @@ * @file * Callback returning the list of files to copy to the assets/vendor directory. */ -const glob = require('glob'); +const { globSync } = require('glob'); // There are a lot of CKEditor 5 packages, generate the list dynamically. // Drupal-specific mapping between CKEditor 5 name and Drupal library name. const ckeditor5PluginMapping = { @@ -23,11 +23,11 @@ const ckeditor5PluginMapping = { module.exports = (packageFolder) => { const fileList = []; // Get all the CKEditor 5 packages. - const ckeditor5Dirs = glob.sync(`{${packageFolder}/@ckeditor/ckeditor5*,${packageFolder}/ckeditor5}`); + const ckeditor5Dirs = globSync(`{${packageFolder}/@ckeditor/ckeditor5*,${packageFolder}/ckeditor5}`).sort(); for (const ckeditor5package of ckeditor5Dirs) { // Add all the files in the build/ directory to the process array for // copying. - const buildFiles = glob.sync(`${ckeditor5package}/build/**/*.js`, { + const buildFiles = globSync(`${ckeditor5package}/build/**/*.js`, { nodir: true, }); if (buildFiles.length) { diff --git a/core/scripts/js/ckeditor5-check-plugins.js b/core/scripts/js/ckeditor5-check-plugins.js index 2bec6c1222a..982d665e19d 100644 --- a/core/scripts/js/ckeditor5-check-plugins.js +++ b/core/scripts/js/ckeditor5-check-plugins.js @@ -12,7 +12,7 @@ "use strict"; -const glob = require("glob"); +const { globSync } = require("glob"); const log = require("./log"); const fs = require("fs").promises; const child_process = require("child_process"); @@ -26,7 +26,7 @@ async function getContents(files) { } (async () => { - const files = glob.sync("./modules/ckeditor5/js/build/*.js"); + const files = globSync("./modules/ckeditor5/js/build/*.js").sort(); const pluginsBefore = await getContents(files); // Execute the plugin build script. diff --git a/core/scripts/js/ckeditor5-types-documentation.js b/core/scripts/js/ckeditor5-types-documentation.js index 7197464dce3..29fcb68ce54 100644 --- a/core/scripts/js/ckeditor5-types-documentation.js +++ b/core/scripts/js/ckeditor5-types-documentation.js @@ -12,7 +12,7 @@ 'use strict'; -const glob = require('glob'); +const { globSync } = require('glob'); const log = require('./log'); const fs = require('fs'); @@ -102,7 +102,7 @@ function processFile(filePath) { return false; } -const definitions = glob.sync('./ckeditor5*/src/**/*.+(js|jsdoc)', globOptions).map(processFile); +const definitions = globSync('./ckeditor5*/src/**/*.+(js|jsdoc)', globOptions).sort().map(processFile); // Filter definitions that do not match any regex. const existingDefinitions = definitions.filter((e) => !!e); diff --git a/core/tests/Drupal/Nightwatch/nightwatch.conf.js b/core/tests/Drupal/Nightwatch/nightwatch.conf.js index e09d973503a..8e0f6eaedf1 100644 --- a/core/tests/Drupal/Nightwatch/nightwatch.conf.js +++ b/core/tests/Drupal/Nightwatch/nightwatch.conf.js @@ -1,5 +1,5 @@ const path = require('path'); -const glob = require('glob'); +const { globSync } = require('glob'); // Find directories which have Nightwatch tests in them. const regex = /(.*\/?tests\/?.*\/Nightwatch)\/.*/g; @@ -12,15 +12,15 @@ const collectedFolders = { const searchDirectory = process.env.DRUPAL_NIGHTWATCH_SEARCH_DIRECTORY || ''; const defaultIgnore = ['vendor/**']; -glob - .sync('**/tests/**/Nightwatch/**/*.js', { - cwd: path.resolve(process.cwd(), `../${searchDirectory}`), - ignore: process.env.DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES - ? process.env.DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES.split(',').concat( - defaultIgnore, - ) - : defaultIgnore, - }) +globSync('**/tests/**/Nightwatch/**/*.js', { + cwd: path.resolve(process.cwd(), `../${searchDirectory}`), + ignore: process.env.DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES + ? process.env.DRUPAL_NIGHTWATCH_IGNORE_DIRECTORIES.split(',').concat( + defaultIgnore, + ) + : defaultIgnore, +}) + .sort() .forEach((file) => { let m = regex.exec(file); while (m !== null) { diff --git a/core/yarn.lock b/core/yarn.lock index 06fb7e31e3b..f4c1224fbfc 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -1076,6 +1076,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + "@pkgr/utils@^2.3.1": version "2.4.2" resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" @@ -1961,7 +1966,7 @@ cosmiconfig@^8.2.0: parse-json "^5.2.0" path-type "^4.0.0" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -2838,6 +2843,14 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" + integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -2962,6 +2975,17 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== +glob@10.3.5: + version "10.3.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.5.tgz#4c0e46b5bccd78ac42b06a7eaaeb9ee34062968e" + integrity sha512-bYUpUD7XDEHI4Q2O5a7PXGvyw4deKR70kHiDxzQbe925wbZknhOzUt2xBgTkYL6RBcVeXYuD9iNYeqoWbBZQnA== + dependencies: + foreground-child "^3.1.0" + jackspeak "^2.0.3" + minimatch "^9.0.1" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-scurry "^1.10.1" + glob@7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" @@ -2986,17 +3010,6 @@ glob@^7.1.3, glob@^7.2.3: once "^1.3.0" path-is-absolute "^1.0.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== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - global-dirs@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485" @@ -3513,6 +3526,15 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +jackspeak@2.1.1, jackspeak@^2.0.3: + version "2.1.1" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.1.1.tgz#2a42db4cfbb7e55433c28b6f75d8b796af9669cd" + integrity sha512-juf9stUEwUaILepraGOWIJTLwg48bUnBmRqd2ln2Os1sW987zeoj/hzhbvRB95oMuS2ZTpjULmdwHNX4rzZIZw== + dependencies: + cliui "^8.0.1" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jake@^10.8.5: version "10.8.7" resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f" @@ -3866,6 +3888,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +"lru-cache@^9.1.1 || ^10.0.0": + version "10.0.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.1.tgz#0a3be479df549cca0e5d693ac402ff19537a6b7a" + integrity sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g== + make-dir@~3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -3982,6 +4009,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.1: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@~3.0.4: version "3.0.8" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.8.tgz#5e6a59bd11e2ab0de1cfb843eb2d82e546c321c1" @@ -4008,6 +4042,11 @@ minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": + version "7.0.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" + integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== + mkdirp@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" @@ -4413,6 +4452,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.10.1: + version "1.10.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" + integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== + dependencies: + lru-cache "^9.1.1 || ^10.0.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"