forked from zoontek/react-native-bootsplash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-native.config.js
101 lines (98 loc) · 2.85 KB
/
react-native.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
const platforms = ["android", "ios", "web"];
const projectTypes = ["detect", "bare", "expo"];
/** @type {import("@react-native-community/cli-types").Command} */
const generateBootSplash = {
name: "generate-bootsplash <logo>",
description: "Generate a launch screen using a logo file path (PNG or SVG)",
options: [
{
name: "--project-type <string>",
description: 'Project type ("detect", "bare" or "expo")',
default: "detect",
parse: (value) => {
const type = value.toLowerCase();
return projectTypes.includes(type) ? type : "detect";
},
},
{
name: "--platforms <list>",
description: "Platforms to generate for, separated by a comma",
default: platforms.join(","),
parse: (value) => [
...new Set(
value
.toLowerCase()
.split(/[ ,;|]/)
.map((platform) => platform.trim())
.filter((item) => platforms.includes(item)),
),
],
},
{
name: "--background <string>",
description: "Background color (in hexadecimal format)",
default: "#fff",
},
{
name: "--logo-width <number>",
description:
"Logo width at @1x (in dp - we recommend approximately ~100)",
default: 100,
parse: (value) => Number.parseInt(value, 10),
},
{
name: "--assets-output <string>",
description: "Assets output directory path",
default: "assets/bootsplash",
},
{
name: "--flavor <string>",
description:
"Android flavor build variant (where your resource directory is)",
default: "main",
},
{
name: "--html <string>",
description: "HTML template file path (your web app entry point)",
default: "public/index.html",
},
{
name: "--license-key <string>",
description:
"License key to enable brand and dark mode assets generation",
},
{
name: "--brand <string>",
description: "Brand file path (PNG or SVG)",
},
{
name: "--brand-width <number>",
description:
"Brand width at @1x (in dp - we recommend approximately ~80)",
default: 80,
parse: (value) => Number.parseInt(value, 10),
},
{
name: "--dark-background <string>",
description: "[dark mode] Background color (in hexadecimal format)",
},
{
name: "--dark-logo <string>",
description: "[dark mode] Logo file path (PNG or SVG)",
},
{
name: "--dark-brand <string>",
description: "[dark mode] Brand file path (PNG or SVG)",
},
],
func: ([logo], { project: { android, ios } }, args) => {
const { generate } = require("./dist/commonjs/generate");
generate({ android, ios, logo, ...args }).catch((error) => {
console.error(error);
process.exit(1);
});
},
};
module.exports = {
commands: [generateBootSplash],
};