@wavemaker/rn-codegen 11.14.1-33.647787 → 11.14.1-34.647830
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/command.js +0 -6
- package/command.js.map +1 -1
- package/npm-shrinkwrap.json +105 -130
- package/package-lock.json +105 -130
- package/package.json +11 -7
- package/src/app.generator.js +22 -194
- package/src/app.generator.js.map +1 -1
- package/src/increment-builder.js +1 -2
- package/src/increment-builder.js.map +1 -1
- package/src/project.service.js +0 -14
- package/src/project.service.js.map +1 -1
- package/src/templates/app.template +37 -45
- package/src/templates/babel.config.js.template +3 -6
- package/src/templates/bootstrap.template +3 -7
- package/src/templates/component/component.template +0 -1
- package/src/templates/package.web.json +17 -7
- package/src/templates/project/.npmrc +1 -0
- package/src/templates/project/app.json +3 -1
- package/src/templates/project/esbuild/esbuild.script.js +4 -35
- package/src/templates/project/metro.config.js +1 -7
- package/src/templates/project/package.json +17 -7
- package/src/templates/project/scripts/wm-babel.transform.plugin.js +11 -1
- package/src/theme/components/input/currency.styledef.js +0 -8
- package/src/theme/components/input/currency.styledef.js.map +1 -1
- package/src/theme/components/input/number.styledef.js +0 -30
- package/src/theme/components/input/number.styledef.js.map +1 -1
- package/src/theme/components/input/text.styledef.js +2 -121
- package/src/theme/components/input/text.styledef.js.map +1 -1
- package/src/theme/components/input/textarea.styledef.js +2 -62
- package/src/theme/components/input/textarea.styledef.js.map +1 -1
- package/src/theme/rn-stylesheet.transpiler.js +6 -30
- package/src/theme/rn-stylesheet.transpiler.js.map +1 -1
- package/src/transpile/components/container/tabs.transformer.js +1 -9
- package/src/transpile/components/container/tabs.transformer.js.map +1 -1
- package/src/transpile/components/container/wizard/wizardstep.transformer.js +10 -2
- package/src/transpile/components/container/wizard/wizardstep.transformer.js.map +1 -1
- package/src/transpile/components/data/form/form-field.transformer.js +1 -12
- package/src/transpile/components/data/form/form-field.transformer.js.map +1 -1
- package/src/transpile/components/page/page.transformer.js +1 -11
- package/src/transpile/components/page/page.transformer.js.map +1 -1
- package/src/transpile/property/property-parser.js +0 -10
- package/src/transpile/property/property-parser.js.map +1 -1
- package/src/transpile/style.transformer.js +0 -1
- package/src/transpile/style.transformer.js.map +1 -1
- package/src/transpile/transpile.js +1 -10
- package/src/transpile/transpile.js.map +1 -1
- package/src/templates/project/plugins/expo-pull-to-refresh/android/build.gradle +0 -15
- package/src/templates/project/plugins/expo-pull-to-refresh/android/src/main/java/expo/modules/pulltorefresh/ExpoPullToRefreshModule.kt +0 -21
- package/src/templates/project/plugins/expo-pull-to-refresh/android/src/main/java/expo/modules/pulltorefresh/ExpoPullToRefreshView.kt +0 -221
- package/src/templates/project/plugins/expo-pull-to-refresh/expo-module.config.json +0 -16
- package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefresh.podspec +0 -24
- package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefreshControlModule.swift +0 -17
- package/src/templates/project/plugins/expo-pull-to-refresh/ios/ExpoPullToRefreshControlView.swift +0 -92
- package/src/templates/project/plugins/expo-pull-to-refresh/package.json +0 -15
package/src/app.generator.js
CHANGED
|
@@ -136,7 +136,6 @@ class AppGenerator {
|
|
|
136
136
|
this.wmxComponents = [];
|
|
137
137
|
this.jsFileImports = new Set();
|
|
138
138
|
this.shouldNpmInstall = false;
|
|
139
|
-
this.shouldDoUnwantedPackagesCleanup = false;
|
|
140
139
|
this.options = options;
|
|
141
140
|
this.isPrefabApp = !!prefabName;
|
|
142
141
|
this.wmxComponents = this.projectService.getWMXComponents();
|
|
@@ -304,29 +303,6 @@ class AppGenerator {
|
|
|
304
303
|
item.servicesStr = servicesStr;
|
|
305
304
|
item.filePath = this.getFilePath(item.name);
|
|
306
305
|
});
|
|
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
|
-
}
|
|
330
306
|
// * get plugin list before generating device operation loader
|
|
331
307
|
this.pluginsInApp = await this.getListOfPackagesUsedInGeneratedApp();
|
|
332
308
|
// previously pluginOperationConfig was only having device variables from app.variables.js, not from Page level variables (e.g, Main.variables.js)
|
|
@@ -384,12 +360,12 @@ class AppGenerator {
|
|
|
384
360
|
(0, utils_1.writeFile)(`${this.projectPath}/src/device-permission-service.js`, permissionService);
|
|
385
361
|
(0, utils_1.writeFile)(`${this.projectPath}/src/plugin-provider.js`, pluginProvider);
|
|
386
362
|
}
|
|
387
|
-
|
|
363
|
+
prepareDeviceOperationLoader() {
|
|
388
364
|
const config = fs_extra_1.default.readJsonSync(`${this.projectPath}/wm_rn_config.json`, {
|
|
389
365
|
encoding: 'utf8'
|
|
390
366
|
});
|
|
391
367
|
appVersion = config.version;
|
|
392
|
-
|
|
368
|
+
this.generatePluginsOperationConfig();
|
|
393
369
|
}
|
|
394
370
|
isPartial(type) {
|
|
395
371
|
return type === 'PARTIAL' || type === 'LEFTNAV' || type === 'POPOVER' || type === 'TEMPLATE';
|
|
@@ -467,26 +443,6 @@ class AppGenerator {
|
|
|
467
443
|
(0, utils_1.writeFile)(`${this.projectPath}/wm_rn_config.json`, JSON.stringify(config, null, 4));
|
|
468
444
|
});
|
|
469
445
|
}
|
|
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
|
-
}
|
|
490
446
|
removeOldKeys(splash) {
|
|
491
447
|
const keysToRemove = ['animationSrc', 'width', 'height', 'modifiedSrc'];
|
|
492
448
|
const filterKeys = (obj) => Object.fromEntries(Object.entries(obj).filter(([key]) => !keysToRemove.includes(key)));
|
|
@@ -538,6 +494,7 @@ class AppGenerator {
|
|
|
538
494
|
const config = JSON.parse(data);
|
|
539
495
|
appConfig['expo']['name'] = config.name;
|
|
540
496
|
appConfig['expo']['slug'] = config.name;
|
|
497
|
+
appConfig['expo']['scheme'] = config.id;
|
|
541
498
|
appConfig['expo']['version'] = config.version;
|
|
542
499
|
appConfig['expo']['android']['package'] = config.id;
|
|
543
500
|
appConfig['expo']['ios']['bundleIdentifier'] = config.id;
|
|
@@ -582,7 +539,7 @@ class AppGenerator {
|
|
|
582
539
|
console.log(`Generating App.js.`);
|
|
583
540
|
}
|
|
584
541
|
return this.projectService.getRNConfig().then(data => {
|
|
585
|
-
var _a, _b, _c
|
|
542
|
+
var _a, _b, _c;
|
|
586
543
|
const config = JSON.parse(data);
|
|
587
544
|
const { animationSrc, dark } = config.splash || {};
|
|
588
545
|
const lightAnimatedSplashExists = animationSrc && fs_extra_1.default.existsSync(this.projectPath + '/assets/' + animationSrc);
|
|
@@ -596,9 +553,7 @@ class AppGenerator {
|
|
|
596
553
|
v.publicKeyHashes.push("NoBackUpKey" + v.publicKeyHashes[0].substring(11));
|
|
597
554
|
}
|
|
598
555
|
});
|
|
599
|
-
const
|
|
600
|
-
const enableWavePulse = enableWavePulseRaw === true || enableWavePulseRaw === "true";
|
|
601
|
-
console.log('WavePulse enabled? ', enableWavePulse);
|
|
556
|
+
const enableWavePulse = (!!config.preferences.enableWavePulse || profile_1.default.targetPlatform === 'web');
|
|
602
557
|
if (!enableWavePulse) {
|
|
603
558
|
if (fs_extra_1.default.existsSync(`${this.projectPath}/wavepulse`)) {
|
|
604
559
|
fs_extra_1.default.rmSync(`${this.projectPath}/wavepulse`, {
|
|
@@ -608,30 +563,21 @@ class AppGenerator {
|
|
|
608
563
|
}
|
|
609
564
|
return this.projectService.getAppVariables().then(variables => {
|
|
610
565
|
return this.projectService.getAppJs().then(script => {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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);
|
|
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
|
|
634
579
|
});
|
|
580
|
+
(0, utils_1.writeFile)(`${this.projectPath}/App.js`, output);
|
|
635
581
|
});
|
|
636
582
|
});
|
|
637
583
|
});
|
|
@@ -672,9 +618,7 @@ class AppGenerator {
|
|
|
672
618
|
return this.themeService.generateStudioStyles(styles);
|
|
673
619
|
}
|
|
674
620
|
async generateComponent(info, type, name) {
|
|
675
|
-
|
|
676
|
-
// pulltorefresh value (page.transformer.ts) comes from that config too.
|
|
677
|
-
if (this.incBuilder && !this.incBuilder.isFragmentModified(name) && !this.incBuilder.isConfigModified()) {
|
|
621
|
+
if (this.incBuilder && !this.incBuilder.isFragmentModified(name)) {
|
|
678
622
|
return Promise.resolve();
|
|
679
623
|
}
|
|
680
624
|
if (this.incBuilder) {
|
|
@@ -715,15 +659,6 @@ class AppGenerator {
|
|
|
715
659
|
});
|
|
716
660
|
}
|
|
717
661
|
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
|
-
]));
|
|
727
662
|
const component = COMPONENT_TEMPLATE({
|
|
728
663
|
name: name,
|
|
729
664
|
type: type,
|
|
@@ -736,7 +671,6 @@ class AppGenerator {
|
|
|
736
671
|
startUpVariables: Object.values(variables).filter((v) => v.startUpdate && v.category !== 'wm.TimerVariable').map((v) => v.name),
|
|
737
672
|
startUpActions: Object.values(variables).filter((v) => v.startUpdate && v.category === 'wm.TimerVariable').map((v) => v.name),
|
|
738
673
|
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,
|
|
740
674
|
eagerImports: imports.filter(i => !i.lazy),
|
|
741
675
|
lazyImports: imports.filter(i => i.lazy)
|
|
742
676
|
});
|
|
@@ -817,28 +751,6 @@ class AppGenerator {
|
|
|
817
751
|
});
|
|
818
752
|
}
|
|
819
753
|
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
|
-
}
|
|
842
754
|
return (0, execa_1.default)('npm', ['install'], {
|
|
843
755
|
cwd: `${this.projectService.path}/extensions/components`
|
|
844
756
|
}).then(() => {
|
|
@@ -1085,30 +997,6 @@ class AppGenerator {
|
|
|
1085
997
|
}
|
|
1086
998
|
});
|
|
1087
999
|
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
|
-
}
|
|
1112
1000
|
}
|
|
1113
1001
|
/**
|
|
1114
1002
|
* @description Get the list of device variables used
|
|
@@ -1308,8 +1196,7 @@ class AppGenerator {
|
|
|
1308
1196
|
packageToOveride.description = config.description;
|
|
1309
1197
|
if (profile_1.default.targetPlatform === 'web') {
|
|
1310
1198
|
const webPackageJson = fs_extra_1.default.readJSONSync(`${__dirname}/templates/package.web.json`, { encoding: 'utf-8' });
|
|
1311
|
-
|
|
1312
|
-
packageToOveride.scripts = (0, lodash_1.merge)(packageToOveride.scripts, webPackageJson.scripts);
|
|
1199
|
+
packageToOveride = (0, lodash_1.merge)(packageToOveride, webPackageJson);
|
|
1313
1200
|
}
|
|
1314
1201
|
if (this.wmxComponents.length > 0) {
|
|
1315
1202
|
packageToOveride.scripts.postinstall = [
|
|
@@ -1526,50 +1413,6 @@ class AppGenerator {
|
|
|
1526
1413
|
}
|
|
1527
1414
|
fs_extra_1.default.writeJsonSync(appJsonPath, appJson, { spaces: 2 });
|
|
1528
1415
|
}
|
|
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
|
-
}
|
|
1573
1416
|
async addCustomPluginsToPackageJson() {
|
|
1574
1417
|
if (this.incBuilder) {
|
|
1575
1418
|
console.log(`Adding custom plugins.`);
|
|
@@ -1730,10 +1573,6 @@ class AppGenerator {
|
|
|
1730
1573
|
async generateApp() {
|
|
1731
1574
|
this.rnConfig = await this.projectService.getRNConfig().then(data => JSON.parse(data));
|
|
1732
1575
|
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
|
-
}
|
|
1737
1576
|
return this.generatePagesAndPartials()
|
|
1738
1577
|
.then(() => this.incBuilder && this.generateAllPrefabComponents())
|
|
1739
1578
|
.then(() => !this.incBuilder || this.incBuilder.isResourceModified())
|
|
@@ -1756,8 +1595,6 @@ class AppGenerator {
|
|
|
1756
1595
|
.then((build) => (build && this.generateFonts()))
|
|
1757
1596
|
.then(() => !this.incBuilder || this.incBuilder.isConfigModified())
|
|
1758
1597
|
.then((build) => (build && this.generateRNConfig()))
|
|
1759
|
-
.then(() => !this.incBuilder || this.incBuilder.isConfigModified() || this.incBuilder.isResourceModified())
|
|
1760
|
-
.then((build) => (build && this.generateGlobalConfig()))
|
|
1761
1598
|
.then(() => !this.incBuilder || this.incBuilder.isFormatterModified())
|
|
1762
1599
|
.then((build) => (build && this.generateFormatters()))
|
|
1763
1600
|
.then(() => !this.incBuilder || this.incBuilder.isConfigModified())
|
|
@@ -1785,20 +1622,11 @@ class AppGenerator {
|
|
|
1785
1622
|
.then(() => this.copyPackageLockJson())
|
|
1786
1623
|
.then(() => this.checkWidgetUsageInComponentFiles())
|
|
1787
1624
|
.then(() => this.checkPackageUsageInJSFiles())
|
|
1788
|
-
.then(() =>
|
|
1789
|
-
.then((removePackages) => {
|
|
1790
|
-
if (removePackages) {
|
|
1791
|
-
return this.removeUnusedPackages();
|
|
1792
|
-
}
|
|
1793
|
-
else {
|
|
1794
|
-
return Promise.resolve();
|
|
1795
|
-
}
|
|
1796
|
-
})
|
|
1625
|
+
.then(() => this.removeUnusedPackages())
|
|
1797
1626
|
.then(() => !this.incBuilder)
|
|
1798
1627
|
.then((build) => (build && this.prettify()))
|
|
1799
1628
|
.then(() => this.projectService.copyNpmPackages(this.projectPath))
|
|
1800
1629
|
.then(() => this.copyScreenCapturePluginIfNeeded())
|
|
1801
|
-
.then(() => this.copyPullToRefreshPluginIfNeeded())
|
|
1802
1630
|
.then(() => console.log('code generated at ' + this.projectPath));
|
|
1803
1631
|
}
|
|
1804
1632
|
generateFragment(name) {
|