Skip to content

Commit 5943a5a

Browse files
authored
Finish glob and fs-extra async implementation (facebook#4393)
* Update glob dependency to version 11 and migrate from glob-promise to improve performance and maintainability * Remove unused 'path' dependency from package.json and update yarn.lock
1 parent 37f6ac2 commit 5943a5a

File tree

7 files changed

+53
-83
lines changed

7 files changed

+53
-83
lines changed

scripts/lint-examples/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"@react-native/typescript-config": "^0.76.0-rc.2",
1818
"@types/react": "^18.2.79",
1919
"eslint": "^8.57.1",
20-
"glob-promise": "^4.2.2",
21-
"prettier": "2.8.8",
20+
"glob": "^11.0.0",
21+
"prettier": "^3.4.2",
2222
"react": "18.3.1",
2323
"react-native": "^0.76.0-rc.2",
2424
"react-native-safe-area-context": "^4.11.0",

scripts/lint-examples/src/lintExamples.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
const {execSync} = require('child_process');
1111
const {promises: fs} = require('fs');
1212
const path = require('path');
13-
const glob = require('glob-promise');
13+
const glob = require('glob');
1414

1515
/**
1616
* The root document to search for documents
@@ -74,7 +74,7 @@ async function lintExamples({command, args, extension, writeBack}) {
7474
* @param extension extension to treat the example as if it does not specify
7575
*/
7676
async function extractExamples(extension) {
77-
const documents = await glob('**/*.md', {
77+
const documents = await glob.glob('**/*.md', {
7878
cwd: documentsRoot,
7979
absolute: true,
8080
});

sync-api-docs/extractDocsFromRN.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const GENERATE_ANNOTATION = '@' + 'generate-docs';
1919
module.exports = extractDocsFromRN;
2020

2121
async function extractDocsFromRN(rnRoot) {
22-
// TODO: make implementation async
23-
24-
const allComponentFiles = glob.sync(
22+
const allComponentFiles = await glob.glob(
2523
path.join(rnRoot, '/Libraries/{Components,Image,}/**/*.js'),
2624
{
2725
nodir: true,
@@ -32,7 +30,7 @@ async function extractDocsFromRN(rnRoot) {
3230
const docs = [];
3331

3432
for (const file of allComponentFiles) {
35-
const contents = fs.readFileSync(file, {encoding: 'utf-8'});
33+
const contents = await fs.readFile(file, {encoding: 'utf-8'});
3634
if (!contents.includes(GENERATE_ANNOTATION)) {
3735
continue;
3836
}

sync-api-docs/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
},
99
"devDependencies": {
1010
"@motiz88/react-native-docgen": "0.0.3",
11-
"fs-extra": "^9.1.0",
12-
"glob": "^7.1.6",
11+
"fs-extra": "^11.2.0",
12+
"glob": "^11.0.0",
1313
"he": "^1.2.0",
14-
"path": "^0.12.7",
1514
"react-docgen-markdown-renderer": "^2.1.3",
1615
"tokenize-comment": "^3.0.1"
1716
}

website/image-check.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
const glob = require('glob-promise');
8+
const glob = require('glob');
99
const fs = require('fs-extra');
1010
const path = require('path');
1111
const siteConfig = require('./docusaurus.config.js');
@@ -14,7 +14,8 @@ const imageReferenceRegExp = new RegExp(/!\[.*?\]\((.*)\)/g);
1414

1515
let missingAssets = [];
1616
let queue = Promise.resolve();
17-
glob('./docs/**/*.md')
17+
glob
18+
.glob('./docs/**/*.md')
1819
.then(files => {
1920
files.forEach(file => {
2021
queue = queue

website/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@
6969
"@react-native-website/update-redirects": "0.0.0",
7070
"@types/google.analytics": "^0.0.46",
7171
"alex": "^10.0.0",
72-
"fs-extra": "^10.1.0",
73-
"glob": "^8.0.3",
74-
"glob-promise": "^4.2.2",
75-
"path": "^0.12.7",
72+
"fs-extra": "^11.2.0",
73+
"glob": "^11.0.0",
7674
"remark-cli": "^12.0.1",
7775
"typescript": "^5.7.2"
7876
}

yarn.lock

Lines changed: 40 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,14 +3451,6 @@
34513451
"@types/qs" "*"
34523452
"@types/serve-static" "*"
34533453

3454-
"@types/glob@^7.1.3":
3455-
version "7.2.0"
3456-
resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb"
3457-
integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==
3458-
dependencies:
3459-
"@types/minimatch" "*"
3460-
"@types/node" "*"
3461-
34623454
"@types/google.analytics@^0.0.46":
34633455
version "0.0.46"
34643456
resolved "https://registry.yarnpkg.com/@types/google.analytics/-/google.analytics-0.0.46.tgz#621be217fa21f847df62188fcaa86a7340c689da"
@@ -3580,11 +3572,6 @@
35803572
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a"
35813573
integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==
35823574

3583-
"@types/minimatch@*":
3584-
version "5.1.2"
3585-
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca"
3586-
integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==
3587-
35883575
"@types/minimist@^1.2.2":
35893576
version "1.2.2"
35903577
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
@@ -6877,15 +6864,6 @@ from@~0:
68776864
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
68786865
integrity sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==
68796866

6880-
fs-extra@^10.1.0:
6881-
version "10.1.0"
6882-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
6883-
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
6884-
dependencies:
6885-
graceful-fs "^4.2.0"
6886-
jsonfile "^6.0.1"
6887-
universalify "^2.0.0"
6888-
68896867
fs-extra@^11.1.1, fs-extra@^11.2.0:
68906868
version "11.2.0"
68916869
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.2.0.tgz#e70e17dfad64232287d01929399e0ea7c86b0e5b"
@@ -6895,7 +6873,7 @@ fs-extra@^11.1.1, fs-extra@^11.2.0:
68956873
jsonfile "^6.0.1"
68966874
universalify "^2.0.0"
68976875

6898-
fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.1.0:
6876+
fs-extra@^9.0.0, fs-extra@^9.0.1:
68996877
version "9.1.0"
69006878
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
69016879
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
@@ -7026,13 +7004,6 @@ glob-parent@^6.0.1, glob-parent@^6.0.2:
70267004
dependencies:
70277005
is-glob "^4.0.3"
70287006

7029-
glob-promise@^4.2.2:
7030-
version "4.2.2"
7031-
resolved "https://registry.yarnpkg.com/glob-promise/-/glob-promise-4.2.2.tgz#15f44bcba0e14219cd93af36da6bb905ff007877"
7032-
integrity sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw==
7033-
dependencies:
7034-
"@types/glob" "^7.1.3"
7035-
70367007
glob-to-regexp@^0.4.1:
70377008
version "0.4.1"
70387009
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
@@ -7050,6 +7021,18 @@ glob@^10.0.0, glob@^10.2.2:
70507021
package-json-from-dist "^1.0.0"
70517022
path-scurry "^1.11.1"
70527023

7024+
glob@^11.0.0:
7025+
version "11.0.0"
7026+
resolved "https://registry.yarnpkg.com/glob/-/glob-11.0.0.tgz#6031df0d7b65eaa1ccb9b29b5ced16cea658e77e"
7027+
integrity sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==
7028+
dependencies:
7029+
foreground-child "^3.1.0"
7030+
jackspeak "^4.0.1"
7031+
minimatch "^10.0.0"
7032+
minipass "^7.1.2"
7033+
package-json-from-dist "^1.0.0"
7034+
path-scurry "^2.0.0"
7035+
70537036
glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.3:
70547037
version "7.2.3"
70557038
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
@@ -7062,17 +7045,6 @@ glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.3:
70627045
once "^1.3.0"
70637046
path-is-absolute "^1.0.0"
70647047

7065-
glob@^8.0.3:
7066-
version "8.1.0"
7067-
resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e"
7068-
integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==
7069-
dependencies:
7070-
fs.realpath "^1.0.0"
7071-
inflight "^1.0.4"
7072-
inherits "2"
7073-
minimatch "^5.0.1"
7074-
once "^1.3.0"
7075-
70767048
global-dirs@^3.0.0:
70777049
version "3.0.1"
70787050
resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.1.tgz#0c488971f066baceda21447aecb1a8b911d22485"
@@ -8344,6 +8316,13 @@ jackspeak@^3.1.2:
83448316
optionalDependencies:
83458317
"@pkgjs/parseargs" "^0.11.0"
83468318

8319+
jackspeak@^4.0.1:
8320+
version "4.0.2"
8321+
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-4.0.2.tgz#11f9468a3730c6ff6f56823a820d7e3be9bef015"
8322+
integrity sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==
8323+
dependencies:
8324+
"@isaacs/cliui" "^8.0.2"
8325+
83478326
jake@^10.8.5:
83488327
version "10.8.7"
83498328
resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.7.tgz#63a32821177940c33f356e0ba44ff9d34e1c7d8f"
@@ -9168,6 +9147,11 @@ lru-cache@^10.0.1, lru-cache@^10.2.0:
91689147
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119"
91699148
integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==
91709149

9150+
lru-cache@^11.0.0:
9151+
version "11.0.2"
9152+
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.0.2.tgz#fbd8e7cf8211f5e7e5d91905c415a3f55755ca39"
9153+
integrity sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==
9154+
91719155
lru-cache@^5.1.1:
91729156
version "5.1.1"
91739157
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
@@ -10799,6 +10783,13 @@ [email protected], minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.0.5, minimatch
1079910783
dependencies:
1080010784
brace-expansion "^1.1.7"
1080110785

10786+
minimatch@^10.0.0:
10787+
version "10.0.1"
10788+
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.0.1.tgz#ce0521856b453c86e25f2c4c0d03e6ff7ddc440b"
10789+
integrity sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==
10790+
dependencies:
10791+
brace-expansion "^2.0.1"
10792+
1080210793
minimatch@^5.0.1:
1080310794
version "5.1.6"
1080410795
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
@@ -11535,6 +11526,14 @@ path-scurry@^1.11.1:
1153511526
lru-cache "^10.2.0"
1153611527
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
1153711528

11529+
path-scurry@^2.0.0:
11530+
version "2.0.0"
11531+
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.0.tgz#9f052289f23ad8bf9397a2a0425e7b8615c58580"
11532+
integrity sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==
11533+
dependencies:
11534+
lru-cache "^11.0.0"
11535+
minipass "^7.1.2"
11536+
1153811537
1153911538
version "0.1.10"
1154011539
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b"
@@ -11557,14 +11556,6 @@ path-type@^4.0.0:
1155711556
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
1155811557
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
1155911558

11560-
path@^0.12.7:
11561-
version "0.12.7"
11562-
resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f"
11563-
integrity sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==
11564-
dependencies:
11565-
process "^0.11.1"
11566-
util "^0.10.3"
11567-
1156811559
1156911560
version "0.0.11"
1157011561
resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445"
@@ -12221,11 +12212,6 @@ prettier-linter-helpers@^1.0.0:
1222112212
dependencies:
1222212213
fast-diff "^1.1.2"
1222312214

12224-
12225-
version "2.8.8"
12226-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
12227-
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
12228-
1222912215
prettier@^3.4.2:
1223012216
version "3.4.2"
1223112217
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f"
@@ -12299,11 +12285,6 @@ process-nextick-args@~2.0.0:
1229912285
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
1230012286
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
1230112287

12302-
process@^0.11.1:
12303-
version "0.11.10"
12304-
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
12305-
integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
12306-
1230712288
promise-inflight@^1.0.1:
1230812289
version "1.0.1"
1230912290
resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
@@ -15034,13 +15015,6 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
1503415015
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
1503515016
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
1503615017

15037-
util@^0.10.3:
15038-
version "0.10.4"
15039-
resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901"
15040-
integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==
15041-
dependencies:
15042-
inherits "2.0.3"
15043-
1504415018
utila@~0.4:
1504515019
version "0.4.0"
1504615020
resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c"

0 commit comments

Comments
 (0)