-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-native.config.js
More file actions
96 lines (88 loc) · 2.42 KB
/
react-native.config.js
File metadata and controls
96 lines (88 loc) · 2.42 KB
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
/* eslint-disable no-console */
const { spawnSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const declareAssets = require('./scripts/declare-assets');
const initPlugins = require('./scripts/init-plugins');
const installPeers = require('./scripts/install-peers');
const loadFonts = require('./scripts/load-fonts');
const tsStart = require('./scripts/ts-start');
module.exports = {
commands: [
{
name: 'generate-splash-screen',
description: 'Generate a launch screen using info from app.json',
options: [],
func: () => {
const workingPath =
process.env.INIT_CWD || process.env.PWD || process.cwd();
const pathToAppInfo = path.join(workingPath, 'app.json');
if (!fs.existsSync(pathToAppInfo)) {
console.log('❌ File `app.json` not found. Exiting…\n');
process.exit(1);
}
const appFile = JSON.parse(fs.readFileSync(pathToAppInfo));
if (!appFile.splash) {
console.log('⚠️ Missing `splash` info. Skipping generation…\n');
process.exit(1);
}
spawnSync('npx', [
'react-native',
'generate-bootsplash',
appFile.splash.icon,
'--logo-width',
appFile.splash.width || 100,
'--background-color',
appFile.splash.background || '#fff',
]);
},
},
{
name: 'load-fonts',
description: 'Load fonts from assets/fonts and initialize fonts in theme',
options: [],
func: () => {
loadFonts();
console.log('✅ Fonts loaded successfully');
},
},
{
name: 'ts-start',
description: 'Start metro bundle with typescript compiler',
options: [
{
name: '--reset-cache',
description: 'Reset cache',
},
],
func: () => {
tsStart();
},
},
{
name: 'init-plugins',
description: 'Initialize plugins',
options: [],
func: () => {
initPlugins();
},
},
{
name: 'declare-assets',
description:
'Generate TypeScript definitions for icons and images from the assets folder',
options: [],
func: () => {
declareAssets();
},
},
{
name: 'install-peers',
description: 'Install peer dependencies',
options: [],
func: () => {
installPeers();
},
},
],
};