codeplay-common 3.2.12 → 3.2.14

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.
@@ -635,6 +635,11 @@ const SKIP_FILES = [
635
635
  ,'index.browser.js'
636
636
  ];
637
637
 
638
+ const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
639
+
640
+ // Match StatusBar.setStyle (ignore comments)
641
+ const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
642
+
638
643
 
639
644
  function scanDirectory(dir) {
640
645
 
@@ -650,6 +655,19 @@ function scanDirectory(dir) {
650
655
 
651
656
  if (stat.isFile()) {
652
657
 
658
+
659
+ // 🚨 Special check ONLY for common-configuration.js
660
+ if (dir === STATUSBAR_FILE) {
661
+ const content = fs.readFileSync(dir, 'utf8');
662
+
663
+ if (STATUSBAR_REGEX.test(content)) {
664
+ console.error(`\nāŒ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
665
+ console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
666
+ console.error(`šŸ“„ File: ${dir}\n`);
667
+ process.exit(1);
668
+ }
669
+ }
670
+
653
671
  // šŸ”„ Skip files in SKIP_FILES array
654
672
  const baseName = path.basename(dir);
655
673
  if (SKIP_FILES.includes(baseName)) {
@@ -705,14 +723,25 @@ for (let scanPath of SCAN_PATHS) {
705
723
  //scanDirectory(ROOT_DIR);
706
724
 
707
725
  // iOS Checks
708
- if (isMac && !iosImportFound) {
726
+ /* if (isMac && !iosImportFound) {
709
727
  console.warn(`āš ļø WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
710
728
  process.exit(1);
711
729
  } else if (isMac && iosImportFound) {
712
730
  console.log('āœ… iOS version detected for macOS build.');
713
731
  } else if (!iosImportFound) {
714
732
  console.log('āœ… No iOS-specific imports detected for non-macOS.');
715
- }
733
+ } */
734
+
735
+ // āœ… Only care if iOS import is found in NON-mac systems
736
+ if (iosImportFound && !isMac) {
737
+ console.error(`\nāŒ ERROR: iOS-specific file is imported in non-macOS environment.`);
738
+ process.exit(1);
739
+ } else if (iosImportFound && isMac) {
740
+ console.log('āœ… iOS import detected (valid for macOS build).');
741
+ } else {
742
+ console.log('āœ… No iOS-specific imports found (this is totally fine).');
743
+ }
744
+
716
745
 
717
746
  // Android Checks
718
747
  if (androidImportFound) {
@@ -0,0 +1,42 @@
1
+ Note: This changes are added with my old(current) code. Might we need to integrate this features into our new optimized code.
2
+
3
+ 1) If no import(saveToGalleryAndSaveAnyFile) found it through error issue is fixed
4
+ // iOS Checks
5
+ /* if (isMac && !iosImportFound) {
6
+ console.warn(`āš ļø WARNING: You're on macOS but no iOS version (saveToGalleryAndSaveAnyFile-x.x-ios.js) found.`);
7
+ process.exit(1);
8
+ } else if (isMac && iosImportFound) {
9
+ console.log('āœ… iOS version detected for macOS build.');
10
+ } else if (!iosImportFound) {
11
+ console.log('āœ… No iOS-specific imports detected for non-macOS.');
12
+ } */
13
+
14
+ // āœ… Only care if iOS import is found in NON-mac systems
15
+ if (iosImportFound && !isMac) {
16
+ console.error(`\nāŒ ERROR: iOS-specific file is imported in non-macOS environment.`);
17
+ process.exit(1);
18
+ } else if (iosImportFound && isMac) {
19
+ console.log('āœ… iOS import detected (valid for macOS build).');
20
+ } else {
21
+ console.log('āœ… No iOS-specific imports found (this is totally fine).');
22
+ }
23
+
24
+
25
+ 2) Statusbar color set in app startup is checked and through erro
26
+
27
+ const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
28
+
29
+ // Match StatusBar.setStyle (ignore comments)
30
+ const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
31
+ ....
32
+ ....
33
+ if (dir === STATUSBAR_FILE) {
34
+ const content = fs.readFileSync(dir, 'utf8');
35
+
36
+ if (STATUSBAR_REGEX.test(content)) {
37
+ console.error(`\nāŒ ERROR: StatusBar.setStyle should NOT be used in common-configuration.js`);
38
+ console.error(`🚫 iOS status bar is controlled via other methods. Remove this line.`);
39
+ console.error(`šŸ“„ File: ${dir}\n`);
40
+ process.exit(1);
41
+ }
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.12",
3
+ "version": "3.2.14",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",