codeplay-common 3.2.15 → 3.2.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.
@@ -635,12 +635,17 @@ 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
638
 
640
- // Match StatusBar.setStyle (ignore comments)
639
+
640
+ const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
641
641
  const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
642
642
 
643
643
 
644
+ const ONESIGNAL_OLD_FILES = [
645
+ path.resolve(__dirname, '../src/js/onesignal-settings.js')
646
+ ];
647
+ const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
648
+
644
649
  function scanDirectory(dir) {
645
650
 
646
651
  /*
@@ -656,6 +661,32 @@ function scanDirectory(dir) {
656
661
  if (stat.isFile()) {
657
662
 
658
663
 
664
+
665
+ const baseName = path.basename(dir);
666
+
667
+ const JS_ROOT = path.resolve(__dirname, '../src/js');
668
+ const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
669
+
670
+ // 🚨 Block old OneSignal file locations (ONLY in src/js root)
671
+ if (path.dirname(dir) === JS_ROOT) {
672
+
673
+ // āŒ onesignal-settings.js
674
+ if (ONESIGNAL_OLD_FILES.includes(dir)) {
675
+ console.error(`\nāŒ ERROR: onesignal-settings.js should not be in src/js/`);
676
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
677
+ console.error(`šŸ“„ File: ${dir}\n`);
678
+ process.exit(1);
679
+ }
680
+
681
+ // āŒ onesignal-x.x.js
682
+ if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
683
+ console.error(`\nāŒ ERROR: ${baseName} should not be in src/js/`);
684
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
685
+ console.error(`šŸ“„ File: ${dir}\n`);
686
+ process.exit(1);
687
+ }
688
+ }
689
+
659
690
  // 🚨 Special check ONLY for common-configuration.js
660
691
  if (dir === STATUSBAR_FILE) {
661
692
  let content = fs.readFileSync(dir, 'utf8');
@@ -675,7 +706,7 @@ function scanDirectory(dir) {
675
706
  }
676
707
 
677
708
  // šŸ”„ Skip files in SKIP_FILES array
678
- const baseName = path.basename(dir);
709
+
679
710
  if (SKIP_FILES.includes(baseName)) {
680
711
  // Just skip silently
681
712
  return;
@@ -25,11 +25,42 @@ Note: This changes are added with my old(current) code. Might we need to integra
25
25
  2) Statusbar color set in app startup is checked and through erro
26
26
 
27
27
  const STATUSBAR_FILE = path.resolve(__dirname, '../src/js/common-configuration.js');
28
-
29
- // Match StatusBar.setStyle (ignore comments)
30
28
  const STATUSBAR_REGEX = /^(?!\s*\/\/).*Capacitor\.Plugins\.StatusBar\.setStyle/m;
29
+
30
+
31
+ const ONESIGNAL_OLD_FILES = [
32
+ path.resolve(__dirname, '../src/js/onesignal-settings.js')
33
+ ];
34
+ const ONESIGNAL_VERSION_REGEX = /^onesignal-\d+(\.\d+)*\.js$/;
35
+
36
+ ....
31
37
  ....
32
38
  ....
39
+
40
+
41
+ const JS_ROOT = path.resolve(__dirname, '../src/js');
42
+ const ONESIGNAL_DIR = path.join(JS_ROOT, 'onesignal');
43
+
44
+ // 🚨 Block old OneSignal file locations (ONLY in src/js root)
45
+ if (path.dirname(dir) === JS_ROOT) {
46
+
47
+ // āŒ onesignal-settings.js
48
+ if (ONESIGNAL_OLD_FILES.includes(dir)) {
49
+ console.error(`\nāŒ ERROR: onesignal-settings.js should not be in src/js/`);
50
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
51
+ console.error(`šŸ“„ File: ${dir}\n`);
52
+ process.exit(1);
53
+ }
54
+
55
+ // āŒ onesignal-x.x.js
56
+ if (ONESIGNAL_VERSION_REGEX.test(baseName)) {
57
+ console.error(`\nāŒ ERROR: ${baseName} should not be in src/js/`);
58
+ console.error(`šŸ“ Move it to: src/js/onesignal/`);
59
+ console.error(`šŸ“„ File: ${dir}\n`);
60
+ process.exit(1);
61
+ }
62
+ }
63
+
33
64
  // 🚨 Special check ONLY for common-configuration.js
34
65
  if (dir === STATUSBAR_FILE) {
35
66
  let content = fs.readFileSync(dir, 'utf8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.15",
3
+ "version": "3.2.16",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",