react-native-bootsplash 7.1.0-beta.0 → 7.1.0-beta.1
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/extras/addon/index.js +31 -31
- package/dist/commonjs/extras/addon/index.js.map +1 -1
- package/dist/commonjs/extras/expo.js +2 -9
- package/dist/commonjs/extras/expo.js.map +1 -1
- package/dist/commonjs/extras/utils.js +18 -12
- package/dist/commonjs/extras/utils.js.map +1 -1
- package/dist/module/extras/addon/index.js +31 -31
- package/dist/module/extras/addon/index.js.map +1 -1
- package/dist/module/extras/expo.js +2 -9
- package/dist/module/extras/expo.js.map +1 -1
- package/dist/module/extras/utils.js +18 -12
- package/dist/module/extras/utils.js.map +1 -1
- package/dist/typescript/commonjs/extras/addon/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/extras/expo.d.ts.map +1 -1
- package/dist/typescript/commonjs/extras/utils.d.ts +4 -5
- package/dist/typescript/commonjs/extras/utils.d.ts.map +1 -1
- package/dist/typescript/module/extras/addon/index.d.ts.map +1 -1
- package/dist/typescript/module/extras/expo.d.ts.map +1 -1
- package/dist/typescript/module/extras/utils.d.ts +4 -5
- package/dist/typescript/module/extras/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/extras/expo.ts +2 -10
- package/src/extras/utils.ts +28 -19
package/src/extras/utils.ts
CHANGED
|
@@ -26,17 +26,17 @@ export type BootSplashPluginConfig = {
|
|
|
26
26
|
* Background color (in hexadecimal format)
|
|
27
27
|
* @default #fff
|
|
28
28
|
*/
|
|
29
|
-
background
|
|
29
|
+
background?: string;
|
|
30
30
|
/**
|
|
31
31
|
* Logo width at @1x (in dp - we recommend approximately ~100)
|
|
32
32
|
* @default 100
|
|
33
33
|
*/
|
|
34
|
-
logoWidth
|
|
34
|
+
logoWidth?: number;
|
|
35
35
|
/**
|
|
36
36
|
* Assets output directory path
|
|
37
37
|
* @default assets/bootsplash
|
|
38
38
|
*/
|
|
39
|
-
assetsOutput
|
|
39
|
+
assetsOutput?: string;
|
|
40
40
|
/**
|
|
41
41
|
* License key to enable brand and dark mode assets generation
|
|
42
42
|
*/
|
|
@@ -49,7 +49,7 @@ export type BootSplashPluginConfig = {
|
|
|
49
49
|
* Brand width at @1x (in dp - we recommend approximately ~80)
|
|
50
50
|
* @default 80
|
|
51
51
|
*/
|
|
52
|
-
brandWidth
|
|
52
|
+
brandWidth?: number;
|
|
53
53
|
/**
|
|
54
54
|
* [dark mode] Background color (in hexadecimal format)
|
|
55
55
|
*/
|
|
@@ -119,7 +119,6 @@ export const log = {
|
|
|
119
119
|
export const hfs = {
|
|
120
120
|
buffer: (path: string) => fs.readFileSync(path),
|
|
121
121
|
exists: (path: string) => fs.existsSync(path),
|
|
122
|
-
isDir: (path: string) => fs.lstatSync(path).isDirectory(),
|
|
123
122
|
json: (path: string) => JSON.parse(fs.readFileSync(path, "utf-8")) as unknown,
|
|
124
123
|
readDir: (path: string) => fs.readdirSync(path, "utf-8"),
|
|
125
124
|
realPath: (path: string) => fs.realpathSync(path, "utf-8"),
|
|
@@ -286,24 +285,34 @@ export const transformProps = async (
|
|
|
286
285
|
process.exit(1);
|
|
287
286
|
}
|
|
288
287
|
|
|
289
|
-
const
|
|
290
|
-
|
|
288
|
+
const withDefaults = {
|
|
289
|
+
assetsOutput: "assets/bootsplash",
|
|
290
|
+
background: "#fff",
|
|
291
|
+
brandWidth: 80,
|
|
292
|
+
logoWidth: 100,
|
|
293
|
+
...rawProps,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const assetsOutputPath = path.resolve(rootPath, withDefaults.assetsOutput);
|
|
297
|
+
const logoPath = path.resolve(rootPath, withDefaults.logo);
|
|
291
298
|
|
|
292
299
|
const darkLogoPath =
|
|
293
|
-
|
|
294
|
-
? path.resolve(rootPath,
|
|
300
|
+
withDefaults.darkLogo != null
|
|
301
|
+
? path.resolve(rootPath, withDefaults.darkLogo)
|
|
295
302
|
: undefined;
|
|
296
303
|
|
|
297
304
|
const brandPath =
|
|
298
|
-
|
|
305
|
+
withDefaults.brand != null
|
|
306
|
+
? path.resolve(rootPath, withDefaults.brand)
|
|
307
|
+
: undefined;
|
|
299
308
|
|
|
300
309
|
const darkBrandPath =
|
|
301
|
-
|
|
302
|
-
? path.resolve(rootPath,
|
|
310
|
+
withDefaults.darkBrand != null
|
|
311
|
+
? path.resolve(rootPath, withDefaults.darkBrand)
|
|
303
312
|
: undefined;
|
|
304
313
|
|
|
305
|
-
const logoWidth =
|
|
306
|
-
const brandWidth =
|
|
314
|
+
const logoWidth = withDefaults.logoWidth - (withDefaults.logoWidth % 2);
|
|
315
|
+
const brandWidth = withDefaults.brandWidth - (withDefaults.brandWidth % 2);
|
|
307
316
|
|
|
308
317
|
const [logo, darkLogo, brand, darkBrand] = await Promise.all([
|
|
309
318
|
toAsset(logoPath, logoWidth),
|
|
@@ -312,11 +321,11 @@ export const transformProps = async (
|
|
|
312
321
|
darkBrandPath != null ? toAsset(darkBrandPath, brandWidth) : undefined,
|
|
313
322
|
]);
|
|
314
323
|
|
|
315
|
-
const background = parseColor(
|
|
324
|
+
const background = parseColor(withDefaults.background);
|
|
316
325
|
|
|
317
326
|
const darkBackground =
|
|
318
|
-
|
|
319
|
-
? parseColor(
|
|
327
|
+
withDefaults.darkBackground != null
|
|
328
|
+
? parseColor(withDefaults.darkBackground)
|
|
320
329
|
: undefined;
|
|
321
330
|
|
|
322
331
|
const executeAddon =
|
|
@@ -362,12 +371,12 @@ export const transformProps = async (
|
|
|
362
371
|
process.exit(1);
|
|
363
372
|
}
|
|
364
373
|
|
|
365
|
-
if (logoWidth <
|
|
374
|
+
if (logoWidth < withDefaults.logoWidth) {
|
|
366
375
|
log.warn(
|
|
367
376
|
`Logo width must be a multiple of 2. It has been rounded to ${logoWidth}dp.`,
|
|
368
377
|
);
|
|
369
378
|
}
|
|
370
|
-
if (brandWidth <
|
|
379
|
+
if (brandWidth < withDefaults.brandWidth) {
|
|
371
380
|
log.warn(
|
|
372
381
|
`Brand width must be a multiple of 2. It has been rounded to ${brandWidth}dp.`,
|
|
373
382
|
);
|