@wavemaker/rn-codegen 11.14.1-34.647830 → 11.14.1-37.647870

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.
Files changed (54) hide show
  1. package/command.js +6 -0
  2. package/command.js.map +1 -1
  3. package/npm-shrinkwrap.json +249 -217
  4. package/package-lock.json +249 -217
  5. package/package.json +6 -10
  6. package/src/app.generator.js +194 -22
  7. package/src/app.generator.js.map +1 -1
  8. package/src/increment-builder.js +2 -1
  9. package/src/increment-builder.js.map +1 -1
  10. package/src/project.service.js +14 -0
  11. package/src/project.service.js.map +1 -1
  12. package/src/templates/app.template +45 -37
  13. package/src/templates/babel.config.js.template +6 -3
  14. package/src/templates/bootstrap.template +8 -3
  15. package/src/templates/component/component.template +1 -0
  16. package/src/templates/package.web.json +7 -17
  17. package/src/templates/project/app.json +1 -3
  18. package/src/templates/project/esbuild/esbuild.script.js +35 -4
  19. package/src/templates/project/metro.config.js +7 -1
  20. package/src/templates/project/package.json +7 -17
  21. package/src/templates/project/plugins/expo-pull-to-refresh/android/build.gradle +15 -0
  22. package/src/templates/project/plugins/expo-pull-to-refresh/android/src/main/java/expo/modules/pulltorefresh/ExpoPullToRefreshModule.kt +21 -0
  23. package/src/templates/project/plugins/expo-pull-to-refresh/android/src/main/java/expo/modules/pulltorefresh/ExpoPullToRefreshView.kt +221 -0
  24. package/src/templates/project/plugins/expo-pull-to-refresh/expo-module.config.json +16 -0
  25. package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefresh.podspec +24 -0
  26. package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefreshControlModule.swift +17 -0
  27. package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefreshControlView.swift +92 -0
  28. package/src/templates/project/plugins/expo-pull-to-refresh/package.json +15 -0
  29. package/src/templates/project/scripts/wm-babel.transform.plugin.js +1 -11
  30. package/src/theme/components/input/currency.styledef.js +8 -0
  31. package/src/theme/components/input/currency.styledef.js.map +1 -1
  32. package/src/theme/components/input/number.styledef.js +30 -0
  33. package/src/theme/components/input/number.styledef.js.map +1 -1
  34. package/src/theme/components/input/text.styledef.js +121 -2
  35. package/src/theme/components/input/text.styledef.js.map +1 -1
  36. package/src/theme/components/input/textarea.styledef.js +62 -2
  37. package/src/theme/components/input/textarea.styledef.js.map +1 -1
  38. package/src/theme/rn-stylesheet.transpiler.js +30 -6
  39. package/src/theme/rn-stylesheet.transpiler.js.map +1 -1
  40. package/src/transpile/components/container/tabs.transformer.js +9 -1
  41. package/src/transpile/components/container/tabs.transformer.js.map +1 -1
  42. package/src/transpile/components/container/wizard/wizardstep.transformer.js +2 -10
  43. package/src/transpile/components/container/wizard/wizardstep.transformer.js.map +1 -1
  44. package/src/transpile/components/data/form/form-field.transformer.js +23 -1
  45. package/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
  46. package/src/transpile/components/page/page.transformer.js +11 -1
  47. package/src/transpile/components/page/page.transformer.js.map +1 -1
  48. package/src/transpile/property/property-parser.js +10 -0
  49. package/src/transpile/property/property-parser.js.map +1 -1
  50. package/src/transpile/style.transformer.js +1 -0
  51. package/src/transpile/style.transformer.js.map +1 -1
  52. package/src/transpile/transpile.js +10 -1
  53. package/src/transpile/transpile.js.map +1 -1
  54. package/src/templates/project/.npmrc +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/rn-codegen",
3
- "version": "11.14.1-34.647830",
3
+ "version": "11.14.1-37.647870",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -25,8 +25,8 @@
25
25
  "@types/node": "18.11.10",
26
26
  "@types/prettier": "2.7.1",
27
27
  "@types/yargs": "17.0.15",
28
- "adm-zip": "0.6.1",
29
- "axios": "1.20.0",
28
+ "adm-zip": "0.5.9",
29
+ "axios": "1.8.3",
30
30
  "clean-css": "5.1.5",
31
31
  "color": "4.2.3",
32
32
  "css-to-react-native-transform": "1.9.0",
@@ -36,17 +36,13 @@
36
36
  "handlebars": "4.7.10",
37
37
  "html-entities": "2.3.2",
38
38
  "less": "4.1.1",
39
- "lodash": "4.18.1",
39
+ "lodash": "4.17.21",
40
40
  "node-html-parser": "5.0.0",
41
41
  "prettier": "2.3.0",
42
42
  "puppeteer": "5.4.0",
43
43
  "rimraf": "3.0.2",
44
44
  "yargs": "16.2.0",
45
- "@wavemaker/foundation-css": "11.14.1-34.647830"
46
- },
47
- "overrides": {
48
- "debug": "4.4.0",
49
- "inflight": "npm:inflight-lru@1.0.0"
45
+ "@wavemaker/foundation-css": "11.14.1-37.647870"
50
46
  },
51
47
  "devDependencies": {
52
48
  "@types/adm-zip": "0.5.0",
@@ -63,7 +59,7 @@
63
59
  "@types/rimraf": "3.0.2",
64
60
  "@types/semver": "7.3.13",
65
61
  "jest": "29.3.1",
66
- "semver": "7.8.5",
62
+ "semver": "7.5.0",
67
63
  "ts-jest": "29.0.3",
68
64
  "typescript": "4.9.3"
69
65
  },
@@ -136,6 +136,7 @@ class AppGenerator {
136
136
  this.wmxComponents = [];
137
137
  this.jsFileImports = new Set();
138
138
  this.shouldNpmInstall = false;
139
+ this.shouldDoUnwantedPackagesCleanup = false;
139
140
  this.options = options;
140
141
  this.isPrefabApp = !!prefabName;
141
142
  this.wmxComponents = this.projectService.getWMXComponents();
@@ -303,6 +304,29 @@ class AppGenerator {
303
304
  item.servicesStr = servicesStr;
304
305
  item.filePath = this.getFilePath(item.name);
305
306
  });
307
+ const buildCachePath = `${this.projectPath}/.build-cache`;
308
+ if (fs_extra_1.default.existsSync(buildCachePath)) {
309
+ const buildCache = fs_extra_1.default.readJSONSync(buildCachePath);
310
+ if (!buildCache.deviceVariables) {
311
+ buildCache.deviceVariables = [];
312
+ }
313
+ // * Write deviceVariables to build-cache if it's changed compared to previous build
314
+ const excludeVariables = ['Device'];
315
+ const filteredDeviceVariables = pluginOperationConfig.filter((v) => !excludeVariables.includes(v.type)).map((v) => v.method);
316
+ if (!(0, lodash_1.isEqual)(buildCache.deviceVariables, filteredDeviceVariables)) {
317
+ // console.log('<== Project device variables changed ==>');
318
+ buildCache.deviceVariables = filteredDeviceVariables;
319
+ this.shouldDoUnwantedPackagesCleanup = true;
320
+ fs_extra_1.default.writeJSONSync(buildCachePath, buildCache);
321
+ }
322
+ else if (this.incBuilder) {
323
+ // * If device variables are the same, return early
324
+ return;
325
+ }
326
+ }
327
+ else {
328
+ fs_extra_1.default.writeJSONSync(buildCachePath, {});
329
+ }
306
330
  // * get plugin list before generating device operation loader
307
331
  this.pluginsInApp = await this.getListOfPackagesUsedInGeneratedApp();
308
332
  // previously pluginOperationConfig was only having device variables from app.variables.js, not from Page level variables (e.g, Main.variables.js)
@@ -360,12 +384,12 @@ class AppGenerator {
360
384
  (0, utils_1.writeFile)(`${this.projectPath}/src/device-permission-service.js`, permissionService);
361
385
  (0, utils_1.writeFile)(`${this.projectPath}/src/plugin-provider.js`, pluginProvider);
362
386
  }
363
- prepareDeviceOperationLoader() {
387
+ async prepareDeviceOperationLoader() {
364
388
  const config = fs_extra_1.default.readJsonSync(`${this.projectPath}/wm_rn_config.json`, {
365
389
  encoding: 'utf8'
366
390
  });
367
391
  appVersion = config.version;
368
- this.generatePluginsOperationConfig();
392
+ await this.generatePluginsOperationConfig();
369
393
  }
370
394
  isPartial(type) {
371
395
  return type === 'PARTIAL' || type === 'LEFTNAV' || type === 'POPOVER' || type === 'TEMPLATE';
@@ -443,6 +467,26 @@ class AppGenerator {
443
467
  (0, utils_1.writeFile)(`${this.projectPath}/wm_rn_config.json`, JSON.stringify(config, null, 4));
444
468
  });
445
469
  }
470
+ // Copies each enabled profile's pre-built <profile>.json into the generated app, and removes stale ones.
471
+ generateGlobalConfig() {
472
+ if (this.incBuilder) {
473
+ console.log(`Copying Global config.`);
474
+ }
475
+ return this.projectService.getRNConfig().then(data => {
476
+ const config = JSON.parse(data);
477
+ const enabledProfiles = config.enabledProfiles || [];
478
+ // Tracks profiles generated last time, so one removed (or whose file was deleted outright) still gets cleaned up.
479
+ const manifestPath = `${this.projectPath}/.profiles-manifest.json`;
480
+ const previousProfiles = fs_extra_1.default.existsSync(manifestPath) ? JSON.parse(fs_extra_1.default.readFileSync(manifestPath, 'utf8')) : [];
481
+ previousProfiles
482
+ .filter((profileName) => !enabledProfiles.includes(profileName))
483
+ .forEach((profileName) => fs_extra_1.default.removeSync(`${this.projectPath}/${profileName}.json`));
484
+ (0, utils_1.writeFile)(manifestPath, JSON.stringify(enabledProfiles));
485
+ return Promise.all(enabledProfiles.map(profileName => this.projectService.getGlobalConfig(profileName).then(data => {
486
+ (0, utils_1.writeFile)(`${this.projectPath}/${profileName}.json`, data);
487
+ })));
488
+ });
489
+ }
446
490
  removeOldKeys(splash) {
447
491
  const keysToRemove = ['animationSrc', 'width', 'height', 'modifiedSrc'];
448
492
  const filterKeys = (obj) => Object.fromEntries(Object.entries(obj).filter(([key]) => !keysToRemove.includes(key)));
@@ -494,7 +538,6 @@ class AppGenerator {
494
538
  const config = JSON.parse(data);
495
539
  appConfig['expo']['name'] = config.name;
496
540
  appConfig['expo']['slug'] = config.name;
497
- appConfig['expo']['scheme'] = config.id;
498
541
  appConfig['expo']['version'] = config.version;
499
542
  appConfig['expo']['android']['package'] = config.id;
500
543
  appConfig['expo']['ios']['bundleIdentifier'] = config.id;
@@ -539,7 +582,7 @@ class AppGenerator {
539
582
  console.log(`Generating App.js.`);
540
583
  }
541
584
  return this.projectService.getRNConfig().then(data => {
542
- var _a, _b, _c;
585
+ var _a, _b, _c, _d;
543
586
  const config = JSON.parse(data);
544
587
  const { animationSrc, dark } = config.splash || {};
545
588
  const lightAnimatedSplashExists = animationSrc && fs_extra_1.default.existsSync(this.projectPath + '/assets/' + animationSrc);
@@ -553,7 +596,9 @@ class AppGenerator {
553
596
  v.publicKeyHashes.push("NoBackUpKey" + v.publicKeyHashes[0].substring(11));
554
597
  }
555
598
  });
556
- const enableWavePulse = (!!config.preferences.enableWavePulse || profile_1.default.targetPlatform === 'web');
599
+ const enableWavePulseRaw = (_d = config.preferences.enableWavePulse) !== null && _d !== void 0 ? _d : profile_1.default.targetPlatform === 'web';
600
+ const enableWavePulse = enableWavePulseRaw === true || enableWavePulseRaw === "true";
601
+ console.log('WavePulse enabled? ', enableWavePulse);
557
602
  if (!enableWavePulse) {
558
603
  if (fs_extra_1.default.existsSync(`${this.projectPath}/wavepulse`)) {
559
604
  fs_extra_1.default.rmSync(`${this.projectPath}/wavepulse`, {
@@ -563,21 +608,30 @@ class AppGenerator {
563
608
  }
564
609
  return this.projectService.getAppVariables().then(variables => {
565
610
  return this.projectService.getAppJs().then(script => {
566
- var _a;
567
- const supportedLocaleVariable = (_a = Object.values(variables).filter((v) => (v.startUpdate || v.category === 'wm.Variable') && v.name === 'supportedLocale')) === null || _a === void 0 ? void 0 : _a[0];
568
- const localeDataset = Object.keys(supportedLocaleVariable === null || supportedLocaleVariable === void 0 ? void 0 : supportedLocaleVariable.dataSet);
569
- const supportedLocales = localeDataset.filter(utils_1.isValidLocale);
570
- const output = APP_TEMPLATE({
571
- script: script,
572
- startUpVariables: Object.values(variables).filter((v) => (v.startUpdate || v.category === 'wm.Variable') && v.category !== 'wm.TimerVariable').map((v) => v.name),
573
- startUpActions: Object.values(variables).filter((v) => v.startUpdate && v.category === 'wm.TimerVariable').map((v) => v.name),
574
- autoUpdateVariables: Object.values(variables).filter((v) => v.autoUpdate || ((v.category === 'wm.Variable' || v.category === 'wm.LiveVariable') && v.dataBinding && v.dataBinding.length)).map((v) => v.name),
575
- supportedLocales: supportedLocales,
576
- animatedSplash: animatedSplash,
577
- sslPinning: sslPinning,
578
- enableWavePulse: enableWavePulse
611
+ return this.projectService.getAppWrapperJs().then(appWrapperJs => {
612
+ var _a;
613
+ const supportedLocaleVariable = (_a = Object.values(variables).filter((v) => (v.startUpdate || v.category === 'wm.Variable') && v.name === 'supportedLocale')) === null || _a === void 0 ? void 0 : _a[0];
614
+ const localeDataset = Object.keys(supportedLocaleVariable === null || supportedLocaleVariable === void 0 ? void 0 : supportedLocaleVariable.dataSet);
615
+ const supportedLocales = localeDataset.filter(utils_1.isValidLocale);
616
+ if (appWrapperJs) {
617
+ (0, utils_1.writeFile)(`${this.projectPath}/src/customapp.wrapper.js`, appWrapperJs);
618
+ }
619
+ const output = APP_TEMPLATE({
620
+ script: script,
621
+ startUpVariables: Object.values(variables).filter((v) => (v.startUpdate || v.category === 'wm.Variable') && v.category !== 'wm.TimerVariable').map((v) => v.name),
622
+ startUpActions: Object.values(variables).filter((v) => v.startUpdate && v.category === 'wm.TimerVariable').map((v) => v.name),
623
+ autoUpdateVariables: Object.values(variables).filter((v) => v.autoUpdate || ((v.category === 'wm.Variable' || v.category === 'wm.LiveVariable') && v.dataBinding && v.dataBinding.length)).map((v) => v.name),
624
+ supportedLocales: supportedLocales,
625
+ animatedSplash: animatedSplash,
626
+ sslPinning: sslPinning,
627
+ enableWavePulse: enableWavePulse,
628
+ enableDesignTokens: !!config.preferences.enableDesignTokens,
629
+ enableAdaptiveColorMode: !!config.enableAdaptiveColorMode,
630
+ enabledProfiles: config.enabledProfiles || [],
631
+ customAppWrapper: !!appWrapperJs
632
+ });
633
+ (0, utils_1.writeFile)(`${this.projectPath}/App.js`, output);
579
634
  });
580
- (0, utils_1.writeFile)(`${this.projectPath}/App.js`, output);
581
635
  });
582
636
  });
583
637
  });
@@ -618,7 +672,9 @@ class AppGenerator {
618
672
  return this.themeService.generateStudioStyles(styles);
619
673
  }
620
674
  async generateComponent(info, type, name) {
621
- if (this.incBuilder && !this.incBuilder.isFragmentModified(name)) {
675
+ // Also regenerate on an app-config change, not just a page edit: a page's cascaded
676
+ // pulltorefresh value (page.transformer.ts) comes from that config too.
677
+ if (this.incBuilder && !this.incBuilder.isFragmentModified(name) && !this.incBuilder.isConfigModified()) {
622
678
  return Promise.resolve();
623
679
  }
624
680
  if (this.incBuilder) {
@@ -659,6 +715,15 @@ class AppGenerator {
659
715
  });
660
716
  }
661
717
  const imports = (0, lodash_1.sortBy)((0, lodash_1.uniqBy)(transpiledOutput.imports, i => i.name + i.from), i => i.name);
718
+ // Pull-to-refresh invokes this page's flagged variables plus the flagged app variables it references.
719
+ const appVariables = await Promise.resolve(this.projectService.getAppVariables()).catch(() => ({}));
720
+ const pageSource = `${info.markup || ''}\n${info.script || ''}`;
721
+ const pullToRefreshVariables = Array.from(new Set([
722
+ ...Object.values(variables).filter((v) => v.pullToRefreshUpdate).map((v) => v.name),
723
+ ...Object.values(appVariables || {})
724
+ .filter((v) => v.pullToRefreshUpdate && new RegExp(`\\bVariables\\.${(0, lodash_1.escapeRegExp)(v.name)}\\b`).test(pageSource))
725
+ .map((v) => v.name),
726
+ ]));
662
727
  const component = COMPONENT_TEMPLATE({
663
728
  name: name,
664
729
  type: type,
@@ -671,6 +736,7 @@ class AppGenerator {
671
736
  startUpVariables: Object.values(variables).filter((v) => v.startUpdate && v.category !== 'wm.TimerVariable').map((v) => v.name),
672
737
  startUpActions: Object.values(variables).filter((v) => v.startUpdate && v.category === 'wm.TimerVariable').map((v) => v.name),
673
738
  autoUpdateVariables: Object.values(variables).filter((v) => v.autoUpdate || ((v.category === 'wm.Variable' || v.category === 'wm.LiveVariable') && v.dataBinding && v.dataBinding.length)).map((v) => v.name),
739
+ pullToRefreshVariables: pullToRefreshVariables,
674
740
  eagerImports: imports.filter(i => !i.lazy),
675
741
  lazyImports: imports.filter(i => i.lazy)
676
742
  });
@@ -751,6 +817,28 @@ class AppGenerator {
751
817
  });
752
818
  }
753
819
  compileXComponentLib() {
820
+ var _a, _b;
821
+ if (!this.incBuilder) {
822
+ const projectPackages = fs_extra_1.default.readJsonSync(`${__dirname}/templates/project/package.json`, {
823
+ encoding: 'utf8'
824
+ });
825
+ const reactVersion = (_a = projectPackages === null || projectPackages === void 0 ? void 0 : projectPackages.dependencies) === null || _a === void 0 ? void 0 : _a['react'];
826
+ const reactNativeVersion = (_b = projectPackages === null || projectPackages === void 0 ? void 0 : projectPackages.dependencies) === null || _b === void 0 ? void 0 : _b['react-native'];
827
+ const wmxComponentPackage = fs_extra_1.default.readJsonSync(`${this.projectService.path}/extensions/components/package.json`, {
828
+ encoding: 'utf8'
829
+ });
830
+ // semver considers ^x.x.x and ~x.x.x as invalid package versions.
831
+ if (semver_1.default.lt(`${wmxComponentPackage.devDependencies['@types/react']}`.replace('^', '').replace('~', ''), reactVersion) ||
832
+ semver_1.default.lt(`${wmxComponentPackage.devDependencies['react-native']}`.replace('^', '').replace('~', ''), reactNativeVersion)) {
833
+ wmxComponentPackage.devDependencies['@types/react'] = `${reactVersion}`;
834
+ wmxComponentPackage.devDependencies['react-native'] = `${reactNativeVersion}`;
835
+ }
836
+ fs_extra_1.default.writeJSONSync(`${this.projectService.path}/extensions/components/package.json`, wmxComponentPackage);
837
+ if (fs_extra_1.default.existsSync(`${this.projectService.path}/extensions/components/package-lock.json`)) {
838
+ fs_extra_1.default.removeSync(`${this.projectService.path}/extensions/components/package-lock.json`);
839
+ fs_extra_1.default.emptyDirSync(`${this.projectService.path}/extensions/components/node_modules`);
840
+ }
841
+ }
754
842
  return (0, execa_1.default)('npm', ['install'], {
755
843
  cwd: `${this.projectService.path}/extensions/components`
756
844
  }).then(() => {
@@ -997,6 +1085,30 @@ class AppGenerator {
997
1085
  }
998
1086
  });
999
1087
  this.projectPackageDependencies = projectDependencies;
1088
+ // * Write widgetImports to build-cache if it's changed compared to previous build
1089
+ const widgetImports = projectDependencies.filter((dep) => !dep.removePlugin);
1090
+ const buildCachePath = `${this.projectPath}/.build-cache`;
1091
+ if (fs_extra_1.default.existsSync(buildCachePath)) {
1092
+ const buildCache = fs_extra_1.default.readJSONSync(buildCachePath);
1093
+ if (!buildCache.widgetImports) {
1094
+ buildCache.widgetImports = [];
1095
+ }
1096
+ const excludeVariables = ['Device'];
1097
+ const filteredWidgetImports = widgetImports.filter((v) => !excludeVariables.includes(v.name));
1098
+ if (!(0, lodash_1.isEqual)(buildCache.widgetImports, filteredWidgetImports)) {
1099
+ // console.log('<== Project widget imports changed ==>');
1100
+ this.shouldDoUnwantedPackagesCleanup = true;
1101
+ buildCache.widgetImports = filteredWidgetImports;
1102
+ fs_extra_1.default.writeJSONSync(buildCachePath, buildCache);
1103
+ }
1104
+ else if (this.incBuilder) {
1105
+ // * If widget imports are the same, return early
1106
+ return;
1107
+ }
1108
+ }
1109
+ else {
1110
+ fs_extra_1.default.writeJSONSync(buildCachePath, {});
1111
+ }
1000
1112
  }
1001
1113
  /**
1002
1114
  * @description Get the list of device variables used
@@ -1196,7 +1308,8 @@ class AppGenerator {
1196
1308
  packageToOveride.description = config.description;
1197
1309
  if (profile_1.default.targetPlatform === 'web') {
1198
1310
  const webPackageJson = fs_extra_1.default.readJSONSync(`${__dirname}/templates/package.web.json`, { encoding: 'utf-8' });
1199
- packageToOveride = (0, lodash_1.merge)(packageToOveride, webPackageJson);
1311
+ // * only merge scripts from package.web.json
1312
+ packageToOveride.scripts = (0, lodash_1.merge)(packageToOveride.scripts, webPackageJson.scripts);
1200
1313
  }
1201
1314
  if (this.wmxComponents.length > 0) {
1202
1315
  packageToOveride.scripts.postinstall = [
@@ -1413,6 +1526,50 @@ class AppGenerator {
1413
1526
  }
1414
1527
  fs_extra_1.default.writeJsonSync(appJsonPath, appJson, { spaces: 2 });
1415
1528
  }
1529
+ // Registered as a file: dependency (a native module, unlike expo-screen-capture-plugin's config plugin) so Expo autolinking discovers it.
1530
+ async copyPullToRefreshPluginIfNeeded() {
1531
+ const config = this.rnConfig;
1532
+ const packageJsonPath = `${this.projectPath}/package.json`;
1533
+ const pluginName = '@wavemaker/expo-pull-to-refresh';
1534
+ const pluginDestPath = `${this.projectPath}/plugins/expo-pull-to-refresh`;
1535
+ if (!fs_extra_1.default.existsSync(packageJsonPath)) {
1536
+ console.warn(`Warning: package.json not found at ${packageJsonPath}`);
1537
+ return;
1538
+ }
1539
+ const packageJson = fs_extra_1.default.readJsonSync(packageJsonPath);
1540
+ // Both flags: an animation alone with the feature off shouldn't ship the plugin.
1541
+ if ((config === null || config === void 0 ? void 0 : config.pulltorefresh) && (config === null || config === void 0 ? void 0 : config.pulltorefreshsource)) {
1542
+ const pluginSourcePath = __dirname + '/templates/project/plugins/expo-pull-to-refresh';
1543
+ if (!fs_extra_1.default.existsSync(pluginSourcePath)) {
1544
+ console.warn(`Warning: Pull to refresh plugin source not found at ${pluginSourcePath}`);
1545
+ return;
1546
+ }
1547
+ fs_extra_1.default.mkdirsSync(`${this.projectPath}/plugins`);
1548
+ fs_extra_1.default.copySync(pluginSourcePath, pluginDestPath);
1549
+ console.log(`Copied pull to refresh plugin to ${pluginDestPath}`);
1550
+ if (!packageJson.dependencies) {
1551
+ packageJson.dependencies = {};
1552
+ }
1553
+ if (packageJson.dependencies[pluginName] !== 'file:./plugins/expo-pull-to-refresh') {
1554
+ packageJson.dependencies[pluginName] = 'file:./plugins/expo-pull-to-refresh';
1555
+ console.log(`Added ${pluginName} to package.json`);
1556
+ }
1557
+ }
1558
+ else {
1559
+ if (fs_extra_1.default.existsSync(pluginDestPath)) {
1560
+ fs_extra_1.default.removeSync(pluginDestPath);
1561
+ const pluginsDir = `${this.projectPath}/plugins`;
1562
+ if (fs_extra_1.default.existsSync(pluginsDir) && fs_extra_1.default.readdirSync(pluginsDir).length === 0) {
1563
+ fs_extra_1.default.removeSync(pluginsDir);
1564
+ }
1565
+ }
1566
+ if (packageJson.dependencies && packageJson.dependencies[pluginName]) {
1567
+ delete packageJson.dependencies[pluginName];
1568
+ console.log(`Removed ${pluginName} from package.json`);
1569
+ }
1570
+ }
1571
+ fs_extra_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 4));
1572
+ }
1416
1573
  async addCustomPluginsToPackageJson() {
1417
1574
  if (this.incBuilder) {
1418
1575
  console.log(`Adding custom plugins.`);
@@ -1573,6 +1730,10 @@ class AppGenerator {
1573
1730
  async generateApp() {
1574
1731
  this.rnConfig = await this.projectService.getRNConfig().then(data => JSON.parse(data));
1575
1732
  this.incBuilder || fs_extra_1.default.copySync(__dirname + '/templates/project', this.projectPath);
1733
+ const customMetroConfig = await this.projectService.getCustomMetroConfig();
1734
+ if (customMetroConfig) {
1735
+ (0, utils_1.writeFile)(`${this.projectPath}/custommetro.config.js`, customMetroConfig);
1736
+ }
1576
1737
  return this.generatePagesAndPartials()
1577
1738
  .then(() => this.incBuilder && this.generateAllPrefabComponents())
1578
1739
  .then(() => !this.incBuilder || this.incBuilder.isResourceModified())
@@ -1595,6 +1756,8 @@ class AppGenerator {
1595
1756
  .then((build) => (build && this.generateFonts()))
1596
1757
  .then(() => !this.incBuilder || this.incBuilder.isConfigModified())
1597
1758
  .then((build) => (build && this.generateRNConfig()))
1759
+ .then(() => !this.incBuilder || this.incBuilder.isConfigModified() || this.incBuilder.isResourceModified())
1760
+ .then((build) => (build && this.generateGlobalConfig()))
1598
1761
  .then(() => !this.incBuilder || this.incBuilder.isFormatterModified())
1599
1762
  .then((build) => (build && this.generateFormatters()))
1600
1763
  .then(() => !this.incBuilder || this.incBuilder.isConfigModified())
@@ -1622,11 +1785,20 @@ class AppGenerator {
1622
1785
  .then(() => this.copyPackageLockJson())
1623
1786
  .then(() => this.checkWidgetUsageInComponentFiles())
1624
1787
  .then(() => this.checkPackageUsageInJSFiles())
1625
- .then(() => this.removeUnusedPackages())
1788
+ .then(() => !this.incBuilder || this.shouldDoUnwantedPackagesCleanup)
1789
+ .then((removePackages) => {
1790
+ if (removePackages) {
1791
+ return this.removeUnusedPackages();
1792
+ }
1793
+ else {
1794
+ return Promise.resolve();
1795
+ }
1796
+ })
1626
1797
  .then(() => !this.incBuilder)
1627
1798
  .then((build) => (build && this.prettify()))
1628
1799
  .then(() => this.projectService.copyNpmPackages(this.projectPath))
1629
1800
  .then(() => this.copyScreenCapturePluginIfNeeded())
1801
+ .then(() => this.copyPullToRefreshPluginIfNeeded())
1630
1802
  .then(() => console.log('code generated at ' + this.projectPath));
1631
1803
  }
1632
1804
  generateFragment(name) {