react-native-bootsplash 6.1.1 → 6.1.3
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/dist/commonjs/addon/index.js +31 -31
- package/dist/commonjs/generate.js +30 -16
- package/dist/commonjs/generate.js.map +1 -1
- package/dist/module/addon/index.js +31 -31
- package/dist/module/generate.js +30 -16
- package/dist/module/generate.js.map +1 -1
- package/dist/typescript/generate.d.ts +1 -1
- package/dist/typescript/generate.d.ts.map +1 -1
- package/ios/RNBootSplash.mm +1 -1
- package/package.json +1 -1
- package/src/generate.ts +32 -16
package/src/generate.ts
CHANGED
|
@@ -185,23 +185,40 @@ export const hfs = {
|
|
|
185
185
|
},
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
// Adapted from https://github.com/square/find-yarn-workspace-root
|
|
189
|
+
export const getExpoConfig = (from: string): { isExpo: boolean } => {
|
|
190
|
+
let previous: string | undefined;
|
|
191
|
+
let current = path.normalize(from);
|
|
192
|
+
|
|
193
|
+
do {
|
|
194
|
+
const pkgPath = path.resolve(
|
|
195
|
+
current,
|
|
196
|
+
"node_modules",
|
|
197
|
+
"expo",
|
|
198
|
+
"package.json",
|
|
199
|
+
);
|
|
193
200
|
|
|
194
|
-
|
|
201
|
+
if (fs.existsSync(pkgPath)) {
|
|
202
|
+
try {
|
|
203
|
+
const pkg = hfs.json(pkgPath) as { version?: string };
|
|
204
|
+
const version = pkg.version;
|
|
205
|
+
|
|
206
|
+
if (version == null || semver.lt(version, "51.0.20")) {
|
|
207
|
+
log.error("Requires Expo 51.0.20 (or higher)");
|
|
208
|
+
process.exit(1);
|
|
209
|
+
}
|
|
195
210
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
return { isExpo: true };
|
|
212
|
+
} catch {
|
|
213
|
+
return { isExpo: false };
|
|
214
|
+
}
|
|
199
215
|
}
|
|
200
216
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
217
|
+
previous = current;
|
|
218
|
+
current = path.dirname(current);
|
|
219
|
+
} while (current !== previous);
|
|
220
|
+
|
|
221
|
+
return { isExpo: false };
|
|
205
222
|
};
|
|
206
223
|
|
|
207
224
|
export const writeJson = (filePath: string, content: object) => {
|
|
@@ -612,9 +629,8 @@ export const generate = async ({
|
|
|
612
629
|
darkBrand?: string;
|
|
613
630
|
}) => {
|
|
614
631
|
const isExpo =
|
|
615
|
-
projectType === "
|
|
616
|
-
|
|
617
|
-
: false;
|
|
632
|
+
projectType === "expo" ||
|
|
633
|
+
(projectType === "detect" && getExpoConfig(workingPath).isExpo);
|
|
618
634
|
|
|
619
635
|
if (semver.lt(process.versions.node, "18.0.0")) {
|
|
620
636
|
log.error("Requires Node 18 (or higher)");
|