expo-updates 58.0.19 → 58.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/android/build.gradle +2 -3
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.kt +47 -25
- package/android/src/main/java/expo/modules/updates/codesigning/CertificateChain.kt +35 -9
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt +72 -34
- package/package.json +5 -6
- package/utils/build/vcs.js +7 -14
- package/utils/build/vcs.js.map +1 -1
- package/utils/src/vcs.ts +10 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Fix a startup crash (`Compiling JS failed: Buffer is smaller than the size stated in the file header`) caused by a truncated update asset. Downloaded assets are now moved into place with an atomic rename after the hash is verified, instead of being stream-copied into the final path, and an asset file that already exists on disk is only reused when it matches the hash declared in the manifest. ([#51715](https://github.com/expo/expo/pull/51715) by [@AndreiCalazans](https://github.com/AndreiCalazans))
|
|
8
|
+
- Replace glob with Node glob and skip node_modules when discovering gitignore files. ([#52775](https://github.com/expo/expo/pull/52775) by [@kitten](https://github.com/kitten))
|
|
9
|
+
- Updated dependencies. ([#52688](https://github.com/expo/expo/pull/52688))
|
|
10
|
+
- @expo/env@2.5.4
|
|
11
|
+
|
|
12
|
+
## 58.0.20
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Remove the BouncyCastle dependency on Android. ([#52379](https://github.com/expo/expo/pull/52379) by [@lukmccall](https://github.com/lukmccall))
|
|
17
|
+
|
|
3
18
|
## 58.0.19
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/android/build.gradle
CHANGED
|
@@ -42,7 +42,7 @@ expoModule {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
group = 'host.exp.exponent'
|
|
45
|
-
version = '58.0.
|
|
45
|
+
version = '58.0.21'
|
|
46
46
|
|
|
47
47
|
// Utility method to derive boolean values from the environment or from Java properties,
|
|
48
48
|
// and return them as strings to be used in BuildConfig fields
|
|
@@ -103,7 +103,7 @@ android {
|
|
|
103
103
|
namespace "expo.modules.updates"
|
|
104
104
|
defaultConfig {
|
|
105
105
|
versionCode 31
|
|
106
|
-
versionName '58.0.
|
|
106
|
+
versionName '58.0.21'
|
|
107
107
|
consumerProguardFiles("proguard-rules.pro")
|
|
108
108
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
109
109
|
|
|
@@ -176,7 +176,6 @@ dependencies {
|
|
|
176
176
|
implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.2")
|
|
177
177
|
implementation("com.squareup.zstd:zstd-kmp-okio:0.4.0")
|
|
178
178
|
implementation("org.brotli:dec:0.1.2")
|
|
179
|
-
implementation("org.bouncycastle:bcutil-jdk15to18:1.81")
|
|
180
179
|
|
|
181
180
|
compileOnly 'com.facebook.fbjni:fbjni:0.3.0'
|
|
182
181
|
|
|
@@ -113,39 +113,61 @@ object UpdatesUtils {
|
|
|
113
113
|
@Throws(NoSuchAlgorithmException::class, IOException::class)
|
|
114
114
|
fun verifySHA256AndWriteToFile(inputStream: InputStream, destination: File, expectedBase64URLEncodedHash: String?): ByteArray {
|
|
115
115
|
DigestInputStream(inputStream, MessageDigest.getInstance("SHA-256")).use { digestInputStream ->
|
|
116
|
-
//
|
|
117
|
-
//
|
|
116
|
+
// Write to a temporary path first and only move the file into place after the hash is
|
|
117
|
+
// verified. The move is a rename on the same filesystem, so the destination is either absent
|
|
118
|
+
// or complete; it can never be observed partially written. A streamed copy into the
|
|
119
|
+
// destination (the previous implementation) left a truncated file behind when the process
|
|
120
|
+
// was killed mid-copy, and that file was later trusted because it existed.
|
|
118
121
|
val tmpFile = File(destination.absolutePath + ".tmp")
|
|
119
122
|
tmpFile.parentFile?.mkdirs()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
try {
|
|
124
|
+
digestInputStream.use { input ->
|
|
125
|
+
FileOutputStream(tmpFile).use { output ->
|
|
126
|
+
input.copyTo(output)
|
|
127
|
+
// flush to disk before the file becomes visible at the final path, so a reboot or
|
|
128
|
+
// power loss right after the move cannot leave a truncated file behind
|
|
129
|
+
output.fd.sync()
|
|
130
|
+
}
|
|
123
131
|
}
|
|
124
|
-
}
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
tmpFile.copyTo(destination, true)
|
|
140
|
-
} catch (e: NoSuchFileException) {
|
|
141
|
-
throw IOException("File download was successful, but temp file ${tmpFile.absolutePath} does not exist")
|
|
142
|
-
} catch (e: Exception) {
|
|
143
|
-
throw IOException("File download was successful, but an exception occurred: $e")
|
|
133
|
+
// this message digest must be read after the input stream has been consumed in order to get the hash correctly
|
|
134
|
+
val md = digestInputStream.messageDigest
|
|
135
|
+
val hash = md.digest()
|
|
136
|
+
val hashBase64String = toBase64Url(hash)
|
|
137
|
+
if (expectedBase64URLEncodedHash != null && expectedBase64URLEncodedHash != hashBase64String) {
|
|
138
|
+
throw IOException("File download was successful but base64url-encoded SHA-256 did not match expected; expected: $expectedBase64URLEncodedHash; actual: $hashBase64String")
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// if there are two assets with identical content, they will be written to the same file path,
|
|
142
|
+
// so we allow overwrites
|
|
143
|
+
moveFileAtomically(tmpFile, destination)
|
|
144
|
+
|
|
145
|
+
return hash
|
|
144
146
|
} finally {
|
|
145
147
|
tmpFile.delete()
|
|
146
148
|
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
147
151
|
|
|
148
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Moves [source] to [destination], replacing any existing file. The temp file and the destination
|
|
154
|
+
* live in the same directory, so `rename(2)` applies and the move is atomic. If the rename is
|
|
155
|
+
* rejected anyway (for example, the two paths end up on different mount points), fall back to a
|
|
156
|
+
* copy so the download still succeeds.
|
|
157
|
+
*/
|
|
158
|
+
@Throws(IOException::class)
|
|
159
|
+
internal fun moveFileAtomically(source: File, destination: File) {
|
|
160
|
+
if (!source.exists()) {
|
|
161
|
+
throw IOException("File download was successful, but temp file ${source.absolutePath} does not exist")
|
|
162
|
+
}
|
|
163
|
+
if (source.renameTo(destination)) {
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
Log.w(TAG, "Atomic rename of ${source.absolutePath} to ${destination.absolutePath} failed; falling back to copy")
|
|
167
|
+
try {
|
|
168
|
+
source.copyTo(destination, true)
|
|
169
|
+
} catch (e: Exception) {
|
|
170
|
+
throw IOException("File download was successful, but an exception occurred: $e")
|
|
149
171
|
}
|
|
150
172
|
}
|
|
151
173
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
package expo.modules.updates.codesigning
|
|
2
2
|
|
|
3
|
-
import org.bouncycastle.asn1.ASN1Primitive
|
|
4
|
-
import org.bouncycastle.asn1.DEROctetString
|
|
5
3
|
import java.security.cert.CertificateException
|
|
6
4
|
import java.security.cert.CertificateFactory
|
|
7
5
|
import java.security.cert.X509Certificate
|
|
@@ -13,6 +11,8 @@ private const val CODE_SIGNING_OID = "1.3.6.1.5.5.7.3.3"
|
|
|
13
11
|
// OID of expo project info, stored as `<projectId>,<scopeKey>`
|
|
14
12
|
private const val EXPO_PROJECT_INFORMATION_OID = "1.2.840.113556.1.8000.2554.43437.254.128.102.157.7894389.20439.2.1"
|
|
15
13
|
|
|
14
|
+
private const val DER_OCTET_STRING_TAG = 0x04
|
|
15
|
+
|
|
16
16
|
data class ExpoProjectInformation(val projectId: String, val scopeKey: String)
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -60,13 +60,7 @@ class CertificateChain(private val certificateStrings: List<String>) {
|
|
|
60
60
|
|
|
61
61
|
fun X509Certificate.expoProjectInformation(): ExpoProjectInformation? {
|
|
62
62
|
return getExtensionValue(EXPO_PROJECT_INFORMATION_OID)?.let {
|
|
63
|
-
|
|
64
|
-
}?.let {
|
|
65
|
-
if (it is DEROctetString) {
|
|
66
|
-
it.octets.decodeToString()
|
|
67
|
-
} else {
|
|
68
|
-
null
|
|
69
|
-
}
|
|
63
|
+
decodeDerOctetString(it).decodeToString()
|
|
70
64
|
}?.let {
|
|
71
65
|
val components = it.split(',').map { component -> component.trim() }
|
|
72
66
|
if (components.size != 2) {
|
|
@@ -76,6 +70,38 @@ class CertificateChain(private val certificateStrings: List<String>) {
|
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Returns the contents of the DER-encoded OCTET STRING.
|
|
75
|
+
* Throws for any other input, so that a malformed extension never reads as a missing one.
|
|
76
|
+
*/
|
|
77
|
+
private fun decodeDerOctetString(der: ByteArray): ByteArray {
|
|
78
|
+
val invalid = { throw CertificateException("Invalid Expo project information extension value") }
|
|
79
|
+
|
|
80
|
+
val input = der.inputStream()
|
|
81
|
+
if (input.read() != DER_OCTET_STRING_TAG) {
|
|
82
|
+
invalid()
|
|
83
|
+
}
|
|
84
|
+
var length = input.read()
|
|
85
|
+
// Long form: 0x81-0x83 means that the next 1-3 bytes hold the length.
|
|
86
|
+
if (length >= 0x80) {
|
|
87
|
+
val lengthByteCount = length - 0x80
|
|
88
|
+
if (lengthByteCount !in 1..3 || input.available() < lengthByteCount) {
|
|
89
|
+
invalid()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
length = 0
|
|
93
|
+
repeat(lengthByteCount) {
|
|
94
|
+
length = (length shl 8) or input.read()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (length != input.available()) {
|
|
99
|
+
invalid()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return input.readBytes()
|
|
103
|
+
}
|
|
104
|
+
|
|
79
105
|
private fun X509Certificate.isCACertificate(): Boolean {
|
|
80
106
|
return basicConstraints > -1 && keyUsage != null && keyUsage.isNotEmpty() && keyUsage[5]
|
|
81
107
|
}
|
|
@@ -773,47 +773,85 @@ class FileDownloader(
|
|
|
773
773
|
val path = File(destinationDirectory, filename)
|
|
774
774
|
|
|
775
775
|
if (path.exists()) {
|
|
776
|
-
asset
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
776
|
+
if (isExistingAssetFileValid(path, asset, requestedUpdate)) {
|
|
777
|
+
asset.relativePath = filename
|
|
778
|
+
return AssetDownloadResult(asset, false)
|
|
779
|
+
}
|
|
780
|
+
// the file on disk is not the asset we expect (for example, it was truncated when a previous
|
|
781
|
+
// process was killed); throw it away and download again
|
|
782
|
+
path.delete()
|
|
783
|
+
}
|
|
784
784
|
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
val canApplyPatch =
|
|
786
|
+
asset.isLaunchAsset &&
|
|
787
|
+
launchedUpdate != null &&
|
|
788
|
+
requestedUpdate != null &&
|
|
789
|
+
launchedUpdate.id != requestedUpdate.id
|
|
790
|
+
|
|
791
|
+
try {
|
|
792
|
+
val downloadResult = downloadAssetAndVerifyHashAndWriteToPath(
|
|
793
|
+
asset,
|
|
794
|
+
extraHeaders,
|
|
795
|
+
createRequestForAsset(
|
|
787
796
|
asset,
|
|
788
797
|
extraHeaders,
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
requestedUpdate = requestedUpdate,
|
|
802
|
-
embeddedAssetExtractor = embeddedAssetExtractor
|
|
803
|
-
)
|
|
798
|
+
configuration,
|
|
799
|
+
allowPatch = canApplyPatch
|
|
800
|
+
),
|
|
801
|
+
asset.expectedHash,
|
|
802
|
+
path,
|
|
803
|
+
destinationDirectory,
|
|
804
|
+
assetLoadProgressListener?.let { listener -> { listener.invoke(it) } },
|
|
805
|
+
allowPatch = canApplyPatch,
|
|
806
|
+
launchedUpdate = launchedUpdate,
|
|
807
|
+
requestedUpdate = requestedUpdate,
|
|
808
|
+
embeddedAssetExtractor = embeddedAssetExtractor
|
|
809
|
+
)
|
|
804
810
|
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
811
|
+
asset.downloadTime = Date()
|
|
812
|
+
asset.relativePath = filename
|
|
813
|
+
asset.hash = downloadResult.hash
|
|
814
|
+
return AssetDownloadResult(asset, true)
|
|
815
|
+
} catch (e: Exception) {
|
|
816
|
+
val message = "Failed to download asset ${asset.key}"
|
|
817
|
+
logger.error(message, e, UpdatesErrorCode.AssetsFailedToLoad)
|
|
818
|
+
throw IOException(message, e)
|
|
814
819
|
}
|
|
815
820
|
}
|
|
816
821
|
|
|
822
|
+
/**
|
|
823
|
+
* An asset file that already exists on disk is only reused when its contents match the hash the
|
|
824
|
+
* manifest declares for the asset. Trusting the file because it exists is unsafe: a process
|
|
825
|
+
* killed while the file was being written leaves a truncated file behind, and the launch asset
|
|
826
|
+
* then fails to load with a Hermes `Buffer is smaller than the size stated in the file header`
|
|
827
|
+
* error. When the manifest has no hash for the asset there is nothing to verify against, so the
|
|
828
|
+
* file is reused as before.
|
|
829
|
+
*/
|
|
830
|
+
private fun isExistingAssetFileValid(path: File, asset: AssetEntity, requestedUpdate: UpdateEntity?): Boolean {
|
|
831
|
+
val expectedHash = asset.expectedHash ?: return true
|
|
832
|
+
val actualHash = try {
|
|
833
|
+
UpdatesUtils.toBase64Url(UpdatesUtils.sha256(path))
|
|
834
|
+
} catch (e: Exception) {
|
|
835
|
+
logger.warn(
|
|
836
|
+
"Failed to hash existing file for asset ${asset.key}; re-downloading: ${e.message}",
|
|
837
|
+
UpdatesErrorCode.AssetsFailedToLoad,
|
|
838
|
+
requestedUpdate?.id?.toString(),
|
|
839
|
+
asset.key
|
|
840
|
+
)
|
|
841
|
+
return false
|
|
842
|
+
}
|
|
843
|
+
if (actualHash == expectedHash) {
|
|
844
|
+
return true
|
|
845
|
+
}
|
|
846
|
+
logger.warn(
|
|
847
|
+
"Existing file for asset ${asset.key} did not match expected hash (size ${path.length()} bytes); re-downloading",
|
|
848
|
+
UpdatesErrorCode.AssetsFailedToLoad,
|
|
849
|
+
requestedUpdate?.id?.toString(),
|
|
850
|
+
asset.key
|
|
851
|
+
)
|
|
852
|
+
return false
|
|
853
|
+
}
|
|
854
|
+
|
|
817
855
|
private suspend fun downloadData(request: Request, progressListener: FileDownloadProgressListener? = null): Response =
|
|
818
856
|
suspendCancellableCoroutine { continuation ->
|
|
819
857
|
val call = client.newCall(request)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-updates",
|
|
3
|
-
"version": "58.0.
|
|
3
|
+
"version": "58.0.21",
|
|
4
4
|
"description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"expo",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@expo/code-signing-certificates": "^0.0.7",
|
|
49
|
-
"@expo/env": "^2.5.
|
|
49
|
+
"@expo/env": "^2.5.4",
|
|
50
50
|
"@expo/plist": "^0.10.1",
|
|
51
51
|
"@expo/spawn-async": "^1.8.0",
|
|
52
52
|
"@react-native/asset-utils": "0.88.1",
|
|
@@ -58,14 +58,13 @@
|
|
|
58
58
|
"expo-structured-headers": "~58.0.1",
|
|
59
59
|
"expo-updates-interface": "~58.0.1",
|
|
60
60
|
"getenv": "^2.0.0",
|
|
61
|
-
"glob": "^13.0.0",
|
|
62
61
|
"ignore": "^5.3.1",
|
|
63
62
|
"nullthrows": "^1.1.1",
|
|
64
63
|
"resolve-from": "^5.0.0"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
|
-
"@expo/internal-scripts": "58.0.
|
|
68
|
-
"@expo/metro-config": "58.0.
|
|
66
|
+
"@expo/internal-scripts": "58.0.6",
|
|
67
|
+
"@expo/metro-config": "58.0.21",
|
|
69
68
|
"@testing-library/react-native": "^14.0.1",
|
|
70
69
|
"@types/debug": "^4.1.7",
|
|
71
70
|
"@types/getenv": "^1.0.3",
|
|
@@ -75,7 +74,7 @@
|
|
|
75
74
|
"@types/picomatch": "^4.0.0",
|
|
76
75
|
"@types/react": "~19.3.0",
|
|
77
76
|
"@vercel/ncc": "^0.38.4",
|
|
78
|
-
"expo-dev-client": "58.0.
|
|
77
|
+
"expo-dev-client": "58.0.18",
|
|
79
78
|
"express": "^5.1.0",
|
|
80
79
|
"form-data": "^4.0.4",
|
|
81
80
|
"memfs": "^3.6.0",
|
package/utils/build/vcs.js
CHANGED
|
@@ -22,13 +22,6 @@ function _promises() {
|
|
|
22
22
|
};
|
|
23
23
|
return data;
|
|
24
24
|
}
|
|
25
|
-
function _glob() {
|
|
26
|
-
const data = require("glob");
|
|
27
|
-
_glob = function() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
25
|
function _ignore() {
|
|
33
26
|
const data = /*#__PURE__*/ _interop_require_default(require("ignore"));
|
|
34
27
|
_ignore = function() {
|
|
@@ -135,13 +128,7 @@ node_modules
|
|
|
135
128
|
this.rootDir = rootDir;
|
|
136
129
|
}
|
|
137
130
|
async initIgnoreAsync() {
|
|
138
|
-
const ignoreFilePaths = (await (
|
|
139
|
-
cwd: this.rootDir,
|
|
140
|
-
ignore: [
|
|
141
|
-
'node_modules'
|
|
142
|
-
],
|
|
143
|
-
follow: false
|
|
144
|
-
}))// ensure that parent dir is before child directories
|
|
131
|
+
const ignoreFilePaths = (await findIgnoreFilesAsync(this.rootDir))// ensure that parent dir is before child directories
|
|
145
132
|
.sort((a, b)=>a.length - b.length && a.localeCompare(b));
|
|
146
133
|
const ignoreMapping = await Promise.all(ignoreFilePaths.map(async (filePath)=>{
|
|
147
134
|
return [
|
|
@@ -166,5 +153,11 @@ node_modules
|
|
|
166
153
|
return false;
|
|
167
154
|
}
|
|
168
155
|
}
|
|
156
|
+
async function findIgnoreFilesAsync(root) {
|
|
157
|
+
return Array.fromAsync(_promises().default.glob(`**/${GITIGNORE_FILENAME}`, {
|
|
158
|
+
cwd: root,
|
|
159
|
+
exclude: (entry)=>_path().default.basename(entry) === 'node_modules'
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
169
162
|
|
|
170
163
|
//# sourceMappingURL=vcs.js.map
|
package/utils/build/vcs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vcs.ts"],"sourcesContent":[null],"names":["getVCSClientAsync","projectDir","isGitInstalledAndConfiguredAsync","GitClient","NoVCSClient","getRootPathAsync","spawnAsync","stdout","trim","isFileIgnoredAsync","filePath","cwd","path","normalize","ignore","Ignore","initIgnoreAsync","ignores","error","code","GITIGNORE_FILENAME","DEFAULT_IGNORE","ignoreMapping","rootDir","ignoreFilePaths","
|
|
1
|
+
{"version":3,"sources":["vcs.ts"],"sourcesContent":[null],"names":["getVCSClientAsync","projectDir","isGitInstalledAndConfiguredAsync","GitClient","NoVCSClient","getRootPathAsync","spawnAsync","stdout","trim","isFileIgnoredAsync","filePath","cwd","path","normalize","ignore","Ignore","initIgnoreAsync","ignores","error","code","GITIGNORE_FILENAME","DEFAULT_IGNORE","ignoreMapping","rootDir","ignoreFilePaths","findIgnoreFilesAsync","sort","a","b","length","localeCompare","Promise","all","map","slice","createIgnore","add","fs","readFile","join","relativePath","prefix","startsWith","root","Array","fromAsync","glob","exclude","entry","basename"],"mappings":";;;;+BAUA;;;eAA8BA;;;;gEAVP;;;;;;;gEACR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ANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import spawnAsync from '@expo/spawn-async';
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
|
-
import { glob } from 'glob';
|
|
4
3
|
import createIgnore, { Ignore as SingleFileIgnore } from 'ignore';
|
|
5
4
|
import path from 'path';
|
|
6
5
|
|
|
@@ -91,13 +90,7 @@ class Ignore {
|
|
|
91
90
|
constructor(private rootDir: string) {}
|
|
92
91
|
|
|
93
92
|
public async initIgnoreAsync(): Promise<void> {
|
|
94
|
-
const ignoreFilePaths = (
|
|
95
|
-
await glob(`**/${GITIGNORE_FILENAME}`, {
|
|
96
|
-
cwd: this.rootDir,
|
|
97
|
-
ignore: ['node_modules'],
|
|
98
|
-
follow: false,
|
|
99
|
-
})
|
|
100
|
-
)
|
|
93
|
+
const ignoreFilePaths = (await findIgnoreFilesAsync(this.rootDir))
|
|
101
94
|
// ensure that parent dir is before child directories
|
|
102
95
|
.sort((a, b) => a.length - b.length && a.localeCompare(b));
|
|
103
96
|
|
|
@@ -121,3 +114,12 @@ class Ignore {
|
|
|
121
114
|
return false;
|
|
122
115
|
}
|
|
123
116
|
}
|
|
117
|
+
|
|
118
|
+
async function findIgnoreFilesAsync(root: string): Promise<string[]> {
|
|
119
|
+
return Array.fromAsync(
|
|
120
|
+
fs.glob(`**/${GITIGNORE_FILENAME}`, {
|
|
121
|
+
cwd: root,
|
|
122
|
+
exclude: (entry) => path.basename(entry) === 'node_modules',
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|