forked from zoontek/react-native-bootsplash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-native.config.js
96 lines (91 loc) · 2.76 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
const path = require("path");
const { generate } = require("./dist/commonjs/generate");
module.exports = {
commands: [
{
name: "generate-bootsplash <logoPath>",
description:
"Generate a launch screen using an original logo file (PNG or SVG)",
options: [
{
name: "--background-color <color>",
description:
"color used as launch screen background (in hexadecimal format)",
default: "#fff",
},
{
name: "--logo-width <width>",
description:
"logo width at @1x (in dp - we recommend approximately ~100)",
default: 100,
parse: (value) => parseInt(value, 10),
},
{
name: "--assets-path [path]",
description:
"path to your static assets directory (useful to require the logo file in JS)",
},
{
name: "--flavor <flavor>",
description:
'[android only] flavor build variant (outputs in an android resource directory other than "main")',
default: "main",
},
{
name: "--dark-logo [path]",
description:
"path to logo that should be used in dark mode (dark logos are not generated by default)",
default: "",
},
{
name: "--dark-background-color <color>",
description:
"color used as launch screen background for dark theme (in hexadecimal format). Only used if --dark-logo is specified",
default: "#000",
},
],
func: (
[logoPath],
{ project: { android, ios } },
{
backgroundColor,
logoWidth,
assetsPath,
flavor,
darkLogo,
darkBackgroundColor,
},
) => {
const workingPath =
process.env.INIT_CWD || process.env.PWD || process.cwd();
return generate({
android,
ios: ios
? {
...ios,
// Fix to support previous CLI versions
projectPath: (ios.xcodeProject
? path.resolve(ios.sourceDir, ios.xcodeProject.name)
: ios.projectPath
).replace(/\.(xcodeproj|xcworkspace)$/, ""),
}
: null,
workingPath,
logoPath: path.resolve(workingPath, logoPath),
darkLogoPath: darkLogo
? path.resolve(workingPath, darkLogo)
: undefined,
assetsPath: assetsPath
? path.resolve(workingPath, assetsPath)
: undefined,
backgroundColor,
darkBackgroundColor,
flavor,
logoWidth,
}).catch((error) => {
console.error(error);
});
},
},
],
};