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.
@@ -26,17 +26,17 @@ export type BootSplashPluginConfig = {
26
26
  * Background color (in hexadecimal format)
27
27
  * @default #fff
28
28
  */
29
- background: string;
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: number;
34
+ logoWidth?: number;
35
35
  /**
36
36
  * Assets output directory path
37
37
  * @default assets/bootsplash
38
38
  */
39
- assetsOutput: string;
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: number;
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 assetsOutputPath = path.resolve(rootPath, rawProps.assetsOutput);
290
- const logoPath = path.resolve(rootPath, rawProps.logo);
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
- rawProps.darkLogo != null
294
- ? path.resolve(rootPath, rawProps.darkLogo)
300
+ withDefaults.darkLogo != null
301
+ ? path.resolve(rootPath, withDefaults.darkLogo)
295
302
  : undefined;
296
303
 
297
304
  const brandPath =
298
- rawProps.brand != null ? path.resolve(rootPath, rawProps.brand) : undefined;
305
+ withDefaults.brand != null
306
+ ? path.resolve(rootPath, withDefaults.brand)
307
+ : undefined;
299
308
 
300
309
  const darkBrandPath =
301
- rawProps.darkBrand != null
302
- ? path.resolve(rootPath, rawProps.darkBrand)
310
+ withDefaults.darkBrand != null
311
+ ? path.resolve(rootPath, withDefaults.darkBrand)
303
312
  : undefined;
304
313
 
305
- const logoWidth = rawProps.logoWidth - (rawProps.logoWidth % 2);
306
- const brandWidth = rawProps.brandWidth - (rawProps.brandWidth % 2);
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(rawProps.background);
324
+ const background = parseColor(withDefaults.background);
316
325
 
317
326
  const darkBackground =
318
- rawProps.darkBackground != null
319
- ? parseColor(rawProps.darkBackground)
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 < rawProps.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 < rawProps.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
  );