@admin-layout/gluestack-ui-mobile 9.0.4-alpha.11 → 9.0.4-alpha.16
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/CHANGELOG.md +8 -0
- package/lib/components/NavigationComponent.js +3 -1
- package/lib/components/NavigationComponent.js.map +1 -1
- package/lib/utils/generateMobileNavigations.d.ts +3 -10
- package/lib/utils/generateMobileNavigations.js +273 -261
- package/lib/utils/generateMobileNavigations.js.map +1 -1
- package/package.json +3 -3
- package/src/components/NavigationComponent.tsx +3 -1
- package/src/utils/generateMobileNavigations.ts +285 -229
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _GenerateMobileNavigations_instances, _GenerateMobileNavigations_layoutSettings, _GenerateMobileNavigations_appDirPath, _GenerateMobileNavigations_modules, _GenerateMobileNavigations_initialRouteName, _GenerateMobileNavigations_unauthenticatedComponentPath, _GenerateMobileNavigations_customTabBarPath, _GenerateMobileNavigations_customDrawerPath, _GenerateMobileNavigations_customHeaderPath, _GenerateMobileNavigations_i18Options, _GenerateMobileNavigations_readJsonFile, _GenerateMobileNavigations_getLayoutConfig, _GenerateMobileNavigations_execPromise, _GenerateMobileNavigations_renameFile, _GenerateMobileNavigations_writeFile, _GenerateMobileNavigations_makeDir, _GenerateMobileNavigations_getModulesRouteConfig, _GenerateMobileNavigations_resolveImportPath, _GenerateMobileNavigations_generateAppRoutesJson, _GenerateMobileNavigations_generateImportStatements, _GenerateMobileNavigations_generateModulesTsFile, _GenerateMobileNavigations_generateMainRoutesFile, _GenerateMobileNavigations_generateMainRoutes, _GenerateMobileNavigations_generateAppFile, _GenerateMobileNavigations_generateApp, _GenerateMobileNavigations_generateStackNavigations, _GenerateMobileNavigations_generateDrawerNavigationsFile, _GenerateMobileNavigations_generateDrawerNavigations, _GenerateMobileNavigations_generateBottomTabNavigationsFile, _GenerateMobileNavigations_generateBottomTabNavigations, _GenerateMobileNavigations_generateBottomTabDrawerNavigations, _GenerateMobileNavigations_generateAppNavigationFile, _GenerateMobileNavigations_setLayoutAndGenerateNavigation;
|
|
12
|
+
var _GenerateMobileNavigations_instances, _GenerateMobileNavigations_configFileData, _GenerateMobileNavigations_configFilePath, _GenerateMobileNavigations_appPath, _GenerateMobileNavigations_mobileStackPath, _GenerateMobileNavigations_layoutSettings, _GenerateMobileNavigations_appDirPath, _GenerateMobileNavigations_modules, _GenerateMobileNavigations_initialRouteName, _GenerateMobileNavigations_unauthenticatedComponentPath, _GenerateMobileNavigations_customTabBarPath, _GenerateMobileNavigations_customDrawerPath, _GenerateMobileNavigations_customHeaderPath, _GenerateMobileNavigations_i18Options, _GenerateMobileNavigations_readConfigFile, _GenerateMobileNavigations_readJsonFile, _GenerateMobileNavigations_getLayoutConfig, _GenerateMobileNavigations_execPromise, _GenerateMobileNavigations_renameFile, _GenerateMobileNavigations_writeFile, _GenerateMobileNavigations_makeDir, _GenerateMobileNavigations_getModulesRouteConfig, _GenerateMobileNavigations_resolveImportPath, _GenerateMobileNavigations_generateAppRoutesJson, _GenerateMobileNavigations_generateImportStatements, _GenerateMobileNavigations_generateModulesTsFile, _GenerateMobileNavigations_generateMainRoutesFile, _GenerateMobileNavigations_generateMainRoutes, _GenerateMobileNavigations_generateAppFile, _GenerateMobileNavigations_generateApp, _GenerateMobileNavigations_generateStackNavigations, _GenerateMobileNavigations_generateDrawerNavigationsFile, _GenerateMobileNavigations_generateDrawerNavigations, _GenerateMobileNavigations_generateBottomTabNavigationsFile, _GenerateMobileNavigations_generateBottomTabNavigations, _GenerateMobileNavigations_generateBottomTabDrawerNavigations, _GenerateMobileNavigations_generateAppNavigationFile, _GenerateMobileNavigations_setLayoutAndGenerateNavigation, _GenerateMobileNavigations_performCopyOperations, _GenerateMobileNavigations_deleteDirectoryRecursive, _GenerateMobileNavigations_createAppDirectory;
|
|
13
13
|
import * as fs from 'fs';
|
|
14
14
|
import path from 'path';
|
|
15
15
|
import prettier from 'prettier';
|
|
@@ -17,6 +17,7 @@ import { fileURLToPath } from 'url';
|
|
|
17
17
|
import { createRequire } from 'module';
|
|
18
18
|
import { exec as execCallback } from 'child_process';
|
|
19
19
|
import { getSortedNavigations } from '@common-stack/client-react/lib/route/react-navigation/get-navigation-utils.js';
|
|
20
|
+
import { performCopyOperations } from '@common-stack/rollup-vite-utils/lib/preStartup/configLoader/configLoader.js';
|
|
20
21
|
import { getReplacedRouteConfig } from './getReplacedRouteConfig.js';
|
|
21
22
|
const require = createRequire(import.meta.url);
|
|
22
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -68,8 +69,12 @@ export const getLayoutConfig = async () => {
|
|
|
68
69
|
return layoutConfigFileData;
|
|
69
70
|
};
|
|
70
71
|
export class GenerateMobileNavigations {
|
|
71
|
-
constructor({
|
|
72
|
+
constructor({ configFilePath }) {
|
|
72
73
|
_GenerateMobileNavigations_instances.add(this);
|
|
74
|
+
_GenerateMobileNavigations_configFileData.set(this, {});
|
|
75
|
+
_GenerateMobileNavigations_configFilePath.set(this, void 0);
|
|
76
|
+
_GenerateMobileNavigations_appPath.set(this, 'app');
|
|
77
|
+
_GenerateMobileNavigations_mobileStackPath.set(this, 'mobile-stack-react');
|
|
73
78
|
_GenerateMobileNavigations_layoutSettings.set(this, process.env.LAYOUT_SETTINGS ? JSON.parse(process.env.LAYOUT_SETTINGS) : null);
|
|
74
79
|
_GenerateMobileNavigations_appDirPath.set(this, void 0);
|
|
75
80
|
_GenerateMobileNavigations_modules.set(this, void 0);
|
|
@@ -79,21 +84,29 @@ export class GenerateMobileNavigations {
|
|
|
79
84
|
_GenerateMobileNavigations_customDrawerPath.set(this, void 0);
|
|
80
85
|
_GenerateMobileNavigations_customHeaderPath.set(this, void 0);
|
|
81
86
|
_GenerateMobileNavigations_i18Options.set(this, void 0);
|
|
87
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_configFilePath, configFilePath, "f");
|
|
88
|
+
const config = __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_readConfigFile).call(this, configFilePath);
|
|
89
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_configFileData, config, "f");
|
|
82
90
|
__classPrivateFieldSet(this, _GenerateMobileNavigations_layoutSettings, process.env.LAYOUT_SETTINGS ? JSON.parse(process.env.LAYOUT_SETTINGS) : null, "f");
|
|
83
|
-
__classPrivateFieldSet(this,
|
|
84
|
-
__classPrivateFieldSet(this,
|
|
85
|
-
__classPrivateFieldSet(this,
|
|
86
|
-
__classPrivateFieldSet(this,
|
|
87
|
-
__classPrivateFieldSet(this,
|
|
88
|
-
__classPrivateFieldSet(this,
|
|
89
|
-
__classPrivateFieldSet(this,
|
|
90
|
-
__classPrivateFieldSet(this,
|
|
91
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_appPath, config?.appPath ?? 'app', "f");
|
|
92
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_mobileStackPath, config?.mobileStackPath ?? 'mobile-stack-react', "f");
|
|
93
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_appDirPath, path.join(path.dirname(configFilePath), __classPrivateFieldGet(this, _GenerateMobileNavigations_appPath, "f")), "f");
|
|
94
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_modules, config?.modules ?? [], "f");
|
|
95
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_initialRouteName, config?.initialRouteName ?? '', "f");
|
|
96
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_unauthenticatedComponentPath, config?.unauthenticatedComponentPath ?? '', "f");
|
|
97
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_customTabBarPath, config?.customTabBarPath ?? '', "f");
|
|
98
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_customDrawerPath, config?.customDrawerPath ?? '', "f");
|
|
99
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_customHeaderPath, config?.customHeaderPath ?? '', "f");
|
|
100
|
+
__classPrivateFieldSet(this, _GenerateMobileNavigations_i18Options, config?.i18n ?? {}, "f");
|
|
91
101
|
}
|
|
92
102
|
async generateAppNavigations() {
|
|
93
|
-
return __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m",
|
|
103
|
+
return __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_createAppDirectory).call(this);
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
|
-
_GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNavigations_appDirPath = new WeakMap(), _GenerateMobileNavigations_modules = new WeakMap(), _GenerateMobileNavigations_initialRouteName = new WeakMap(), _GenerateMobileNavigations_unauthenticatedComponentPath = new WeakMap(), _GenerateMobileNavigations_customTabBarPath = new WeakMap(), _GenerateMobileNavigations_customDrawerPath = new WeakMap(), _GenerateMobileNavigations_customHeaderPath = new WeakMap(), _GenerateMobileNavigations_i18Options = new WeakMap(), _GenerateMobileNavigations_instances = new WeakSet(),
|
|
106
|
+
_GenerateMobileNavigations_configFileData = new WeakMap(), _GenerateMobileNavigations_configFilePath = new WeakMap(), _GenerateMobileNavigations_appPath = new WeakMap(), _GenerateMobileNavigations_mobileStackPath = new WeakMap(), _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNavigations_appDirPath = new WeakMap(), _GenerateMobileNavigations_modules = new WeakMap(), _GenerateMobileNavigations_initialRouteName = new WeakMap(), _GenerateMobileNavigations_unauthenticatedComponentPath = new WeakMap(), _GenerateMobileNavigations_customTabBarPath = new WeakMap(), _GenerateMobileNavigations_customDrawerPath = new WeakMap(), _GenerateMobileNavigations_customHeaderPath = new WeakMap(), _GenerateMobileNavigations_i18Options = new WeakMap(), _GenerateMobileNavigations_instances = new WeakSet(), _GenerateMobileNavigations_readConfigFile = function _GenerateMobileNavigations_readConfigFile(configFilePath) {
|
|
107
|
+
const jsonData = fs.readFileSync(configFilePath, 'utf-8');
|
|
108
|
+
return JSON.parse(jsonData);
|
|
109
|
+
}, _GenerateMobileNavigations_readJsonFile = async function _GenerateMobileNavigations_readJsonFile(filePath) {
|
|
97
110
|
return readJsonFile(filePath);
|
|
98
111
|
}, _GenerateMobileNavigations_getLayoutConfig = async function _GenerateMobileNavigations_getLayoutConfig() {
|
|
99
112
|
return getLayoutConfig();
|
|
@@ -170,14 +183,16 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
170
183
|
}
|
|
171
184
|
}
|
|
172
185
|
return value;
|
|
173
|
-
}, _GenerateMobileNavigations_generateAppRoutesJson = async function _GenerateMobileNavigations_generateAppRoutesJson(
|
|
174
|
-
const
|
|
186
|
+
}, _GenerateMobileNavigations_generateAppRoutesJson = async function _GenerateMobileNavigations_generateAppRoutesJson() {
|
|
187
|
+
const appDirPath = __classPrivateFieldGet(this, _GenerateMobileNavigations_appDirPath, "f");
|
|
188
|
+
const parentDirPath = path.dirname(__classPrivateFieldGet(this, _GenerateMobileNavigations_configFileData, "f")?.mobileConfig?.computeFilePath ?? __classPrivateFieldGet(this, _GenerateMobileNavigations_configFilePath, "f"));
|
|
175
189
|
const parentDirName = path.basename(parentDirPath);
|
|
176
190
|
const appDirName = path.basename(appDirPath);
|
|
177
191
|
// const tsFile = 'src/compute.ts';
|
|
178
192
|
// const outputDir = 'src/app';
|
|
179
193
|
const tsFile = `${parentDirName}/compute.ts`;
|
|
180
|
-
const outputDir = `${parentDirName}/${appDirName}`;
|
|
194
|
+
// const outputDir = `${parentDirName}/${appDirName}`;
|
|
195
|
+
const outputDir = `${appDirName}`;
|
|
181
196
|
const tscCommand = `tsc ${tsFile} --outDir ${outputDir} --target es6 --module esnext --jsx react --allowSyntheticDefaultImports true --moduleResolution node --esModuleInterop true --forceConsistentCasingInFileNames true --skipLibCheck true`;
|
|
182
197
|
const mainRoutesJsFile = path.join(appDirPath, '/compute.js');
|
|
183
198
|
const mainRoutesMjsFile = path.join(appDirPath, '/compute.mjs');
|
|
@@ -193,17 +208,13 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
193
208
|
const noWhitespaceJsData = noCommentsData.replace(/\s+/g, '');
|
|
194
209
|
if (noWhitespaceJsData?.length == 0) {
|
|
195
210
|
const outPutDirName = path.dirname(outputFile);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
else
|
|
203
|
-
return false;
|
|
211
|
+
try {
|
|
212
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, outPutDirName);
|
|
213
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, outputFile, JSON.stringify(allFilteredRoutes));
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.log('Error directory/file create', error);
|
|
204
217
|
}
|
|
205
|
-
else
|
|
206
|
-
return false;
|
|
207
218
|
}
|
|
208
219
|
else {
|
|
209
220
|
const newFilePath = mainRoutesJsFile.replace('.js', '.mjs');
|
|
@@ -223,52 +234,41 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
223
234
|
return { [routConfig.path]: routConfig };
|
|
224
235
|
}) ?? [];
|
|
225
236
|
allFilteredRoutes.push(...newRoutes);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
237
|
+
try {
|
|
238
|
+
const writeFileResponse = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, outputFile, JSON.stringify(allFilteredRoutes, null, 2));
|
|
239
|
+
if (writeFileResponse)
|
|
240
|
+
fs.unlinkSync(mainRoutesMjsFile);
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
console.log('Error creating main routes file', error);
|
|
230
244
|
}
|
|
231
|
-
else
|
|
232
|
-
return false;
|
|
233
245
|
}
|
|
234
246
|
}
|
|
235
|
-
else
|
|
236
|
-
return false;
|
|
237
247
|
}
|
|
238
|
-
else
|
|
239
|
-
return false;
|
|
240
248
|
}
|
|
241
249
|
}
|
|
242
250
|
else {
|
|
243
251
|
const outPutDirName = path.dirname(outputFile);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
else
|
|
251
|
-
return false;
|
|
252
|
+
try {
|
|
253
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, outPutDirName);
|
|
254
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, outputFile, JSON.stringify(allFilteredRoutes));
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
console.log('Error creating main routes file', error);
|
|
252
258
|
}
|
|
253
|
-
else
|
|
254
|
-
return false;
|
|
255
259
|
}
|
|
256
260
|
// return true;
|
|
257
261
|
}
|
|
258
262
|
catch (error) {
|
|
259
263
|
console.error(`exec error: ${error.message}`);
|
|
260
264
|
const outPutDirName = path.dirname(outputFile);
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
else
|
|
268
|
-
return false;
|
|
265
|
+
try {
|
|
266
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, outPutDirName);
|
|
267
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, outputFile, JSON.stringify(allFilteredRoutes));
|
|
268
|
+
}
|
|
269
|
+
catch (error) {
|
|
270
|
+
console.log('Error creating main routes file', error);
|
|
269
271
|
}
|
|
270
|
-
else
|
|
271
|
-
return false;
|
|
272
272
|
}
|
|
273
273
|
}, _GenerateMobileNavigations_generateImportStatements = async function _GenerateMobileNavigations_generateImportStatements({ modules, initialRouteName }) {
|
|
274
274
|
try {
|
|
@@ -496,20 +496,17 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
496
496
|
}
|
|
497
497
|
catch (err) {
|
|
498
498
|
console.error('Error:', err);
|
|
499
|
-
return false;
|
|
500
499
|
}
|
|
501
500
|
}, _GenerateMobileNavigations_generateMainRoutes = async function _GenerateMobileNavigations_generateMainRoutes({ appDirPath, i18Options, initialRouteName }) {
|
|
502
501
|
const mainRoutesFile = path.join(appDirPath, `/${mainRoutesJsFileName}`);
|
|
503
502
|
const imports = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateMainRoutesFile).call(this, { initialRouteName, i18Options });
|
|
504
503
|
const { appFeatures } = imports;
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
return false;
|
|
504
|
+
try {
|
|
505
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, mainRoutesFile, appFeatures);
|
|
506
|
+
}
|
|
507
|
+
catch (err) {
|
|
508
|
+
console.error('Error generating main routes:', err);
|
|
511
509
|
}
|
|
512
|
-
return false;
|
|
513
510
|
}, _GenerateMobileNavigations_generateAppFile = async function _GenerateMobileNavigations_generateAppFile({ initialRouteName, i18Options }) {
|
|
514
511
|
try {
|
|
515
512
|
let importStatements = '';
|
|
@@ -563,20 +560,17 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
563
560
|
}
|
|
564
561
|
catch (err) {
|
|
565
562
|
console.error('Error:', err);
|
|
566
|
-
return false;
|
|
567
563
|
}
|
|
568
564
|
}, _GenerateMobileNavigations_generateApp = async function _GenerateMobileNavigations_generateApp({ appDirPath, i18Options, initialRouteName }) {
|
|
569
565
|
const mainRoutesFile = path.join(appDirPath, `/${mainAppFileName}`);
|
|
570
566
|
const imports = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateAppFile).call(this, { initialRouteName, i18Options });
|
|
571
567
|
const { appFeatures } = imports;
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
return false;
|
|
568
|
+
try {
|
|
569
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, mainRoutesFile, appFeatures);
|
|
570
|
+
}
|
|
571
|
+
catch (err) {
|
|
572
|
+
console.error('Error generating app:', err);
|
|
578
573
|
}
|
|
579
|
-
return false;
|
|
580
574
|
}, _GenerateMobileNavigations_generateStackNavigations = async function _GenerateMobileNavigations_generateStackNavigations({ appDirPath, modules, initialRouteName, unauthenticatedComponentPath }) {
|
|
581
575
|
const mainRoutes = path.join(appDirPath, `/${mainRoutesFileName}`);
|
|
582
576
|
const stackDirPath = path.join(appDirPath, `/${stacksDirPath}`);
|
|
@@ -700,23 +694,18 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
700
694
|
moduleRender = `export default ({Stack,...rest}) => { return (<>${moduleContent}</>)}`;
|
|
701
695
|
}
|
|
702
696
|
stackNavigator = importStatements + '\n' + moduleRender;
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
697
|
+
let stackNavigation = stackNavigator;
|
|
698
|
+
stackNavigation = prettier.format(stackNavigation, { parser: 'babel' });
|
|
699
|
+
const stackDirName = path.dirname(stackDirPath);
|
|
700
|
+
try {
|
|
707
701
|
const isDirCreated = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, stackDirName);
|
|
708
702
|
if (isDirCreated) {
|
|
709
|
-
|
|
710
|
-
if (writeFileResponse)
|
|
711
|
-
return true;
|
|
712
|
-
else
|
|
713
|
-
return false;
|
|
703
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, stackDirPath, stackNavigation);
|
|
714
704
|
}
|
|
715
|
-
else
|
|
716
|
-
return false;
|
|
717
705
|
}
|
|
718
|
-
|
|
719
|
-
|
|
706
|
+
catch (error) {
|
|
707
|
+
console.log('Error generating stack navigation', error);
|
|
708
|
+
}
|
|
720
709
|
}, _GenerateMobileNavigations_generateDrawerNavigationsFile = async function _GenerateMobileNavigations_generateDrawerNavigationsFile({ drawerConfig, unauthenticatedComponentPath, drawerDirPath }) {
|
|
721
710
|
let moduleNumber = 0;
|
|
722
711
|
let importStatements = '';
|
|
@@ -817,22 +806,18 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
817
806
|
moduleRender = `export default ({Drawer,...rest}) => { return (<>${moduleContent}</>)}`;
|
|
818
807
|
moduleNavigation = importStatements + '\n' + moduleRender;
|
|
819
808
|
const drawerNavigator = moduleNavigation;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
809
|
+
let drawerNavigation = drawerNavigator;
|
|
810
|
+
drawerNavigation = prettier.format(drawerNavigation, { parser: 'babel' });
|
|
811
|
+
const drawerDirName = path.dirname(drawerDirPath);
|
|
812
|
+
try {
|
|
824
813
|
const isDirCreated = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, drawerDirName);
|
|
825
814
|
if (isDirCreated) {
|
|
826
|
-
|
|
827
|
-
if (writeFileResponse)
|
|
828
|
-
return true;
|
|
829
|
-
else
|
|
830
|
-
return false;
|
|
815
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, drawerDirPath, drawerNavigation);
|
|
831
816
|
}
|
|
832
|
-
else
|
|
833
|
-
return false;
|
|
834
817
|
}
|
|
835
|
-
|
|
818
|
+
catch (error) {
|
|
819
|
+
console.log('Error generating drawer navigation file', error);
|
|
820
|
+
}
|
|
836
821
|
}, _GenerateMobileNavigations_generateDrawerNavigations = async function _GenerateMobileNavigations_generateDrawerNavigations({ appDirPath, modules, initialRouteName, unauthenticatedComponentPath }) {
|
|
837
822
|
const mainRoutes = path.join(appDirPath, `/${mainRoutesFileName}`);
|
|
838
823
|
const drawerDirPath = path.join(appDirPath, `/${drawerFilePath}`);
|
|
@@ -875,36 +860,34 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
875
860
|
return -1;
|
|
876
861
|
return a?.props?.options?.priority - b?.props?.options?.priority;
|
|
877
862
|
}) ?? [];
|
|
878
|
-
|
|
879
|
-
if (
|
|
880
|
-
|
|
881
|
-
drawerConfig: drawerConfig,
|
|
882
|
-
unauthenticatedComponentPath,
|
|
883
|
-
drawerDirPath: drawerDirPath,
|
|
884
|
-
});
|
|
885
|
-
if (drawerNavigation)
|
|
863
|
+
try {
|
|
864
|
+
if (layoutSettings?.layout == 'side') {
|
|
865
|
+
if (drawerConfig) {
|
|
886
866
|
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
887
|
-
drawerConfig:
|
|
867
|
+
drawerConfig: drawerConfig,
|
|
888
868
|
unauthenticatedComponentPath,
|
|
889
|
-
drawerDirPath:
|
|
869
|
+
drawerDirPath: drawerDirPath,
|
|
890
870
|
});
|
|
891
|
-
|
|
892
|
-
}
|
|
893
|
-
else {
|
|
894
|
-
if (hostDrawerConfig) {
|
|
895
|
-
const isDrawerGenerated = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
871
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
896
872
|
drawerConfig: hostDrawerConfig,
|
|
897
873
|
unauthenticatedComponentPath,
|
|
898
874
|
drawerDirPath: hostDirPath,
|
|
899
875
|
});
|
|
900
|
-
return isDrawerGenerated;
|
|
901
876
|
}
|
|
902
|
-
else
|
|
903
|
-
|
|
877
|
+
else {
|
|
878
|
+
if (hostDrawerConfig) {
|
|
879
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
880
|
+
drawerConfig: hostDrawerConfig,
|
|
881
|
+
unauthenticatedComponentPath,
|
|
882
|
+
drawerDirPath: hostDirPath,
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
}
|
|
904
886
|
}
|
|
905
887
|
}
|
|
906
|
-
|
|
907
|
-
|
|
888
|
+
catch (error) {
|
|
889
|
+
console.log('Error generating drawer navigation', error);
|
|
890
|
+
}
|
|
908
891
|
}, _GenerateMobileNavigations_generateBottomTabNavigationsFile = async function _GenerateMobileNavigations_generateBottomTabNavigationsFile({ bottomTabConfig, unauthenticatedComponentPath, bottomDirPath, mixLayout = null, }) {
|
|
909
892
|
let moduleNumber = 0;
|
|
910
893
|
let importStatements = '';
|
|
@@ -1012,22 +995,18 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
1012
995
|
moduleRender = `export default ({Tab,...rest}) => { return (<>${moduleContent}</>)}`;
|
|
1013
996
|
moduleNavigation = importStatements + '\n' + moduleRender;
|
|
1014
997
|
const bottomTabNavigator = moduleNavigation;
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
998
|
+
let bottomTabNavigation = bottomTabNavigator;
|
|
999
|
+
bottomTabNavigation = prettier.format(bottomTabNavigation, { parser: 'babel' });
|
|
1000
|
+
const bottomDirName = path.dirname(bottomDirPath);
|
|
1001
|
+
try {
|
|
1019
1002
|
const isDirCreated = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_makeDir).call(this, bottomDirName);
|
|
1020
1003
|
if (isDirCreated) {
|
|
1021
|
-
|
|
1022
|
-
if (writeFileResponse)
|
|
1023
|
-
return true;
|
|
1024
|
-
else
|
|
1025
|
-
return false;
|
|
1004
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, bottomDirPath, bottomTabNavigation);
|
|
1026
1005
|
}
|
|
1027
|
-
else
|
|
1028
|
-
return false;
|
|
1029
1006
|
}
|
|
1030
|
-
|
|
1007
|
+
catch (error) {
|
|
1008
|
+
console.log('Error generating bottom tab navigation file', error);
|
|
1009
|
+
}
|
|
1031
1010
|
}, _GenerateMobileNavigations_generateBottomTabNavigations = async function _GenerateMobileNavigations_generateBottomTabNavigations({ appDirPath, modules, initialRouteName, unauthenticatedComponentPath }) {
|
|
1032
1011
|
const mainRoutes = path.join(appDirPath, `/${mainRoutesFileName}`);
|
|
1033
1012
|
const bottomDirPath = path.join(appDirPath, `/${bottomFilePath}`);
|
|
@@ -1072,39 +1051,37 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
1072
1051
|
return -1;
|
|
1073
1052
|
return a?.props?.options?.priority - b?.props?.options?.priority;
|
|
1074
1053
|
}) ?? [];
|
|
1075
|
-
|
|
1076
|
-
if (
|
|
1077
|
-
|
|
1078
|
-
bottomTabConfig: bottomTabConfig,
|
|
1079
|
-
unauthenticatedComponentPath,
|
|
1080
|
-
bottomDirPath: bottomDirPath,
|
|
1081
|
-
mixLayout,
|
|
1082
|
-
});
|
|
1083
|
-
if (drawerNavigation)
|
|
1054
|
+
try {
|
|
1055
|
+
if (layoutType == 'bottom' || layoutType == 'mixSide') {
|
|
1056
|
+
if (bottomTabConfig) {
|
|
1084
1057
|
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1085
|
-
bottomTabConfig:
|
|
1058
|
+
bottomTabConfig: bottomTabConfig,
|
|
1086
1059
|
unauthenticatedComponentPath,
|
|
1087
|
-
bottomDirPath:
|
|
1060
|
+
bottomDirPath: bottomDirPath,
|
|
1088
1061
|
mixLayout,
|
|
1089
1062
|
});
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
else {
|
|
1093
|
-
if (hostBottomTabConfig) {
|
|
1094
|
-
const isHostGenerated = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1063
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1095
1064
|
bottomTabConfig: hostBottomTabConfig,
|
|
1096
1065
|
unauthenticatedComponentPath,
|
|
1097
1066
|
bottomDirPath: hostBottomDirPath,
|
|
1098
1067
|
mixLayout,
|
|
1099
1068
|
});
|
|
1100
|
-
return isHostGenerated;
|
|
1101
1069
|
}
|
|
1102
|
-
else
|
|
1103
|
-
|
|
1070
|
+
else {
|
|
1071
|
+
if (hostBottomTabConfig) {
|
|
1072
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1073
|
+
bottomTabConfig: hostBottomTabConfig,
|
|
1074
|
+
unauthenticatedComponentPath,
|
|
1075
|
+
bottomDirPath: hostBottomDirPath,
|
|
1076
|
+
mixLayout,
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1104
1080
|
}
|
|
1105
1081
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1082
|
+
catch (error) {
|
|
1083
|
+
console.log('Error generating bottom tab navigation', error);
|
|
1084
|
+
}
|
|
1108
1085
|
}, _GenerateMobileNavigations_generateBottomTabDrawerNavigations = async function _GenerateMobileNavigations_generateBottomTabDrawerNavigations({ appDirPath, modules, initialRouteName, unauthenticatedComponentPath }) {
|
|
1109
1086
|
const mainRoutes = path.join(appDirPath, `/${mainRoutesFileName}`);
|
|
1110
1087
|
const bottomDirPath = path.join(appDirPath, `/${bottomFilePath}`);
|
|
@@ -1174,38 +1151,36 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
1174
1151
|
return a?.props?.options?.priority - b?.props?.options?.priority;
|
|
1175
1152
|
}) ?? [];
|
|
1176
1153
|
if (bottomTabConfig) {
|
|
1177
|
-
|
|
1178
|
-
bottomTabConfig: bottomTabConfig,
|
|
1179
|
-
unauthenticatedComponentPath,
|
|
1180
|
-
bottomDirPath: bottomDirPath,
|
|
1181
|
-
mixLayout,
|
|
1182
|
-
});
|
|
1183
|
-
if (drawerNavigation)
|
|
1154
|
+
try {
|
|
1184
1155
|
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1185
|
-
bottomTabConfig:
|
|
1156
|
+
bottomTabConfig: bottomTabConfig,
|
|
1186
1157
|
unauthenticatedComponentPath,
|
|
1187
|
-
bottomDirPath:
|
|
1158
|
+
bottomDirPath: bottomDirPath,
|
|
1188
1159
|
mixLayout,
|
|
1189
1160
|
});
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
drawerConfig: drawerConfig,
|
|
1161
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigationsFile).call(this, {
|
|
1162
|
+
bottomTabConfig: hostBottomTabConfig,
|
|
1193
1163
|
unauthenticatedComponentPath,
|
|
1194
|
-
|
|
1164
|
+
bottomDirPath: hostBottomDirPath,
|
|
1165
|
+
mixLayout,
|
|
1195
1166
|
});
|
|
1196
|
-
if (
|
|
1167
|
+
if (drawerConfig) {
|
|
1168
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
1169
|
+
drawerConfig: drawerConfig,
|
|
1170
|
+
unauthenticatedComponentPath,
|
|
1171
|
+
drawerDirPath: drawerDirPath,
|
|
1172
|
+
});
|
|
1197
1173
|
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigationsFile).call(this, {
|
|
1198
1174
|
drawerConfig: hostDrawerConfig,
|
|
1199
1175
|
unauthenticatedComponentPath,
|
|
1200
1176
|
drawerDirPath: hostDirPath,
|
|
1201
1177
|
});
|
|
1202
|
-
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
catch (error) {
|
|
1181
|
+
console.log('Error in generating drawer bottom tab navigation', error);
|
|
1203
1182
|
}
|
|
1204
|
-
else
|
|
1205
|
-
return true;
|
|
1206
1183
|
}
|
|
1207
|
-
else
|
|
1208
|
-
return false;
|
|
1209
1184
|
}, _GenerateMobileNavigations_generateAppNavigationFile = async function _GenerateMobileNavigations_generateAppNavigationFile({ appDirPath, customTabBarPath, customDrawerPath, customHeaderPath }) {
|
|
1210
1185
|
const navigationDirPath = path.join(appDirPath, `/${appNavigationFileName}`);
|
|
1211
1186
|
const layoutSettings = __classPrivateFieldGet(this, _GenerateMobileNavigations_layoutSettings, "f");
|
|
@@ -1414,11 +1389,12 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
1414
1389
|
`;
|
|
1415
1390
|
appNavigation = importStatements + '\n' + rootComponent + '\n' + appComponent;
|
|
1416
1391
|
appNavigation = prettier.format(appNavigation, { parser: 'babel' });
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1392
|
+
try {
|
|
1393
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_writeFile).call(this, navigationDirPath, appNavigation);
|
|
1394
|
+
}
|
|
1395
|
+
catch (error) {
|
|
1396
|
+
console.log('Error in generating app navigationfile', error);
|
|
1397
|
+
}
|
|
1422
1398
|
}, _GenerateMobileNavigations_setLayoutAndGenerateNavigation = async function _GenerateMobileNavigations_setLayoutAndGenerateNavigation() {
|
|
1423
1399
|
const appDirPath = __classPrivateFieldGet(this, _GenerateMobileNavigations_appDirPath, "f");
|
|
1424
1400
|
const modules = __classPrivateFieldGet(this, _GenerateMobileNavigations_modules, "f");
|
|
@@ -1431,105 +1407,141 @@ _GenerateMobileNavigations_layoutSettings = new WeakMap(), _GenerateMobileNaviga
|
|
|
1431
1407
|
const layoutSettings = __classPrivateFieldGet(this, _GenerateMobileNavigations_layoutSettings, "f");
|
|
1432
1408
|
const layoutConfigFileData = await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_getLayoutConfig).call(this);
|
|
1433
1409
|
const layoutType = layoutSettings?.layout || 'bottom';
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
// await this.#generateModulesTsFile({
|
|
1437
|
-
// appDirPath,
|
|
1438
|
-
// modules,
|
|
1439
|
-
// initialRouteName,
|
|
1440
|
-
// });
|
|
1410
|
+
try {
|
|
1411
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateAppRoutesJson).call(this);
|
|
1441
1412
|
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateMainRoutes).call(this, {
|
|
1442
1413
|
appDirPath,
|
|
1443
1414
|
i18Options,
|
|
1444
1415
|
initialRouteName,
|
|
1445
1416
|
});
|
|
1446
|
-
|
|
1417
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateApp).call(this, {
|
|
1447
1418
|
appDirPath,
|
|
1448
1419
|
i18Options,
|
|
1449
1420
|
initialRouteName,
|
|
1450
1421
|
});
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
appDirPath,
|
|
1513
|
-
customTabBarPath,
|
|
1514
|
-
customDrawerPath,
|
|
1515
|
-
customHeaderPath,
|
|
1516
|
-
});
|
|
1517
|
-
if (appNavigationGenerated)
|
|
1518
|
-
return appNavigationGenerated;
|
|
1519
|
-
else
|
|
1520
|
-
return true;
|
|
1521
|
-
}
|
|
1522
|
-
else
|
|
1523
|
-
return false;
|
|
1524
|
-
}
|
|
1422
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateStackNavigations).call(this, {
|
|
1423
|
+
appDirPath,
|
|
1424
|
+
modules,
|
|
1425
|
+
initialRouteName,
|
|
1426
|
+
unauthenticatedComponentPath,
|
|
1427
|
+
});
|
|
1428
|
+
if (layoutType == 'side') {
|
|
1429
|
+
try {
|
|
1430
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateDrawerNavigations).call(this, {
|
|
1431
|
+
appDirPath,
|
|
1432
|
+
modules,
|
|
1433
|
+
initialRouteName,
|
|
1434
|
+
unauthenticatedComponentPath,
|
|
1435
|
+
});
|
|
1436
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateAppNavigationFile).call(this, {
|
|
1437
|
+
appDirPath,
|
|
1438
|
+
customTabBarPath,
|
|
1439
|
+
customDrawerPath,
|
|
1440
|
+
customHeaderPath,
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
catch (error) {
|
|
1444
|
+
console.log('Error in generating side navigation', error);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
else if (layoutType == 'bottom' || layoutType == 'host-bottom') {
|
|
1448
|
+
try {
|
|
1449
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabNavigations).call(this, {
|
|
1450
|
+
appDirPath,
|
|
1451
|
+
modules,
|
|
1452
|
+
initialRouteName,
|
|
1453
|
+
unauthenticatedComponentPath,
|
|
1454
|
+
});
|
|
1455
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateAppNavigationFile).call(this, {
|
|
1456
|
+
appDirPath,
|
|
1457
|
+
customTabBarPath,
|
|
1458
|
+
customDrawerPath,
|
|
1459
|
+
customHeaderPath,
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
catch (error) {
|
|
1463
|
+
console.log('Error in generating bottom navigation', error);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
try {
|
|
1468
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateBottomTabDrawerNavigations).call(this, {
|
|
1469
|
+
appDirPath,
|
|
1470
|
+
modules,
|
|
1471
|
+
initialRouteName,
|
|
1472
|
+
unauthenticatedComponentPath,
|
|
1473
|
+
});
|
|
1474
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_generateAppNavigationFile).call(this, {
|
|
1475
|
+
appDirPath,
|
|
1476
|
+
customTabBarPath,
|
|
1477
|
+
customDrawerPath,
|
|
1478
|
+
customHeaderPath,
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
catch (error) {
|
|
1482
|
+
console.log('Error in generating drawer bottom navigation', error);
|
|
1525
1483
|
}
|
|
1526
|
-
else
|
|
1527
|
-
return false;
|
|
1528
1484
|
}
|
|
1529
|
-
else
|
|
1530
|
-
return false;
|
|
1531
1485
|
}
|
|
1532
|
-
|
|
1533
|
-
|
|
1486
|
+
catch (error) {
|
|
1487
|
+
console.log('Error generating app navigations', error);
|
|
1488
|
+
}
|
|
1489
|
+
}, _GenerateMobileNavigations_performCopyOperations = async function _GenerateMobileNavigations_performCopyOperations() {
|
|
1490
|
+
const config = __classPrivateFieldGet(this, _GenerateMobileNavigations_configFileData, "f");
|
|
1491
|
+
try {
|
|
1492
|
+
await performCopyOperations(config);
|
|
1493
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_setLayoutAndGenerateNavigation).call(this);
|
|
1494
|
+
}
|
|
1495
|
+
catch (error) {
|
|
1496
|
+
console.error('PerformCopyOperations error:', error);
|
|
1497
|
+
}
|
|
1498
|
+
}, _GenerateMobileNavigations_deleteDirectoryRecursive = async function _GenerateMobileNavigations_deleteDirectoryRecursive(dirPath) {
|
|
1499
|
+
if (fs.existsSync(dirPath)) {
|
|
1500
|
+
const files = fs.readdirSync(dirPath);
|
|
1501
|
+
for (const file of files) {
|
|
1502
|
+
const curPath = path.join(dirPath, file);
|
|
1503
|
+
if (fs.lstatSync(curPath).isDirectory()) {
|
|
1504
|
+
// Recursively delete subdirectories
|
|
1505
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_deleteDirectoryRecursive).call(this, curPath);
|
|
1506
|
+
}
|
|
1507
|
+
else {
|
|
1508
|
+
// Delete files
|
|
1509
|
+
fs.unlinkSync(curPath);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
// Delete the directory itself
|
|
1513
|
+
fs.rmdirSync(dirPath);
|
|
1514
|
+
}
|
|
1515
|
+
}, _GenerateMobileNavigations_createAppDirectory = async function _GenerateMobileNavigations_createAppDirectory() {
|
|
1516
|
+
const appDir = __classPrivateFieldGet(this, _GenerateMobileNavigations_appDirPath, "f");
|
|
1517
|
+
try {
|
|
1518
|
+
// Check if the directory exists
|
|
1519
|
+
if (fs.existsSync(appDir)) {
|
|
1520
|
+
console.log('Directory exists. Recreating it...');
|
|
1521
|
+
// Delete the directory and its contents
|
|
1522
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_deleteDirectoryRecursive).call(this, appDir);
|
|
1523
|
+
}
|
|
1524
|
+
// Create the directory
|
|
1525
|
+
fs.mkdirSync(appDir);
|
|
1526
|
+
console.log('Directory created');
|
|
1527
|
+
// Add 'app' to .gitignore if not already present
|
|
1528
|
+
const gitignorePath = path.resolve(appDir, '.gitignore');
|
|
1529
|
+
let gitignoreContent = '';
|
|
1530
|
+
if (fs.existsSync(gitignorePath)) {
|
|
1531
|
+
gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
|
|
1532
|
+
}
|
|
1533
|
+
else {
|
|
1534
|
+
fs.writeFileSync(gitignorePath, '');
|
|
1535
|
+
console.log('Created .gitignore file');
|
|
1536
|
+
}
|
|
1537
|
+
if (!gitignoreContent.includes('*')) {
|
|
1538
|
+
fs.appendFileSync(gitignorePath, '*\n');
|
|
1539
|
+
console.log('Added "*" to .gitignore');
|
|
1540
|
+
}
|
|
1541
|
+
await __classPrivateFieldGet(this, _GenerateMobileNavigations_instances, "m", _GenerateMobileNavigations_performCopyOperations).call(this);
|
|
1542
|
+
}
|
|
1543
|
+
catch (error) {
|
|
1544
|
+
console.error('Error creating app directory:', error);
|
|
1545
|
+
}
|
|
1534
1546
|
};
|
|
1535
1547
|
//# sourceMappingURL=generateMobileNavigations.js.map
|