codeplay-common 3.2.2 → 3.2.3

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.
@@ -568,231 +568,6 @@ else {
568
568
 
569
569
 
570
570
 
571
- const localizationBaseDir = path.join(__dirname, "..", "src", "js", "localization");
572
-
573
- // ======================================================
574
- // 🌐 LOCALIZATION CHECK (FULLY DYNAMIC)
575
- // ======================================================
576
-
577
-
578
- const jsRootDir = path.join(__dirname, "..", "src", "js");
579
-
580
- // 🔍 Detect OLD localization files in root js/
581
- const oldLocalizationFiles = fs.readdirSync(jsRootDir)
582
- .filter(name =>
583
- /^localization-\d+(\.\d+)*\.js$/.test(name) ||
584
- /^localization_settings-\d+(\.\d+)*\.js$/.test(name)
585
- );
586
-
587
- // ❌ If old structure found → STOP
588
- if (oldLocalizationFiles.length > 0) {
589
-
590
- console.error(`
591
- ❌ OLD LOCALIZATION STRUCTURE DETECTED
592
-
593
- You are using outdated file structure:
594
- src/js/localization-x.x.js
595
- src/js/localization_settings-x.x.js
596
-
597
- 🚨 This is no longer supported.
598
-
599
- đŸ“Ļ Found files:
600
- ${oldLocalizationFiles.map(f => " - " + f).join("\n")}
601
-
602
- 👉 Please move them to new structure:
603
-
604
- src/js/localization/localization_settings-x.x.js
605
- src/js/localization/localization-x.x/
606
-
607
- âš ī¸ Example:
608
-
609
- OLD:
610
- src/js/localization-x.x.js
611
- src/js/localization_settings-x.x.js
612
-
613
- NEW:
614
- src/js/localization/localization_settings-1.1.js
615
- src/js/localization/localization-x.x/localization-x.x.js
616
-
617
- ❌ Build stopped.
618
- `);
619
-
620
- process.exit(1);
621
- }
622
-
623
-
624
- if (fs.existsSync(localizationBaseDir)) {
625
-
626
- // 🔍 Find localization-x.x folders
627
- const localizationVersions = fs.readdirSync(localizationBaseDir)
628
- .filter(name => /^localization-\d+(\.\d+)+$/.test(name));
629
-
630
- if (localizationVersions.length === 0) {
631
- console.log("â„šī¸ No localization-x.x folder found. Skipping...");
632
- } else {
633
-
634
- // đŸ”Ĩ Get latest version (supports 1.6, 1.6.1, etc.)
635
- const latestLocalizationDir = localizationVersions.sort((a, b) => {
636
- const vA = a.split('-')[1].split('.').map(Number);
637
- const vB = b.split('-')[1].split('.').map(Number);
638
-
639
- for (let i = 0; i < Math.max(vA.length, vB.length); i++) {
640
- const diff = (vB[i] || 0) - (vA[i] || 0);
641
- if (diff !== 0) return diff;
642
- }
643
- return 0;
644
- })[0];
645
-
646
- const localizationPath = path.join(localizationBaseDir, latestLocalizationDir);
647
-
648
- // ======================================================
649
- // 🔍 Find settings file dynamically
650
- // ======================================================
651
-
652
- const settingsFile = fs.readdirSync(localizationBaseDir)
653
- .find(name => /^localization_settings-.*\.js$/.test(name));
654
-
655
- if (!settingsFile) {
656
- console.error(`
657
- ❌ MISSING LOCALIZATION SETTINGS FILE
658
-
659
- Expected:
660
- src/js/localization/localization_settings-x.x.js
661
-
662
- ❌ Build stopped.
663
- `);
664
- process.exit(1);
665
- }
666
-
667
- // ======================================================
668
- // 🔍 Find run.js INSIDE version folder
669
- // ======================================================
670
-
671
- const runJsPath = path.join(localizationPath, "run.js");
672
-
673
- if (!fs.existsSync(runJsPath)) {
674
- console.error(`
675
- ❌ LOCALIZATION run.js NOT FOUND
676
-
677
- Expected:
678
- ${runJsPath}
679
-
680
- ❌ Build stopped.
681
- `);
682
- process.exit(1);
683
- }
684
-
685
- console.log(`🌐 Localization detected: ${latestLocalizationDir}`);
686
- console.log(`âš™ī¸ Using settings: ${settingsFile}`);
687
- console.log(`🚀 Executing: ${runJsPath}`);
688
-
689
- // ======================================================
690
- // 🚀 Execute run.js
691
- // ======================================================
692
-
693
- execSync(`node "${runJsPath}"`, { stdio: "inherit" });
694
- }
695
-
696
- } else {
697
- console.log("â„šī¸ Localization not used in this project. Skipping...");
698
- }
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
- //editor-x.x import old style check and stop execution START
719
-
720
-
721
-
722
- // Match: editor/editor-2.3, editor/editor-2.3.1, etc.
723
- const FORBIDDEN_REGEX = /editor\/editor-\d+(\.\d+)+/;
724
-
725
- let hasError = false;
726
-
727
- const ERROR_MESSAGE = `const ERROR_MESSAGE = ❌ Invalid import detected!
728
-
729
- You are using a direct version-based path like: editor/editor-x.x/editor.js
730
-
731
- đŸšĢ This is NOT allowed.
732
-
733
- 👉 Please use the proper alias or updated import method.
734
- Example: import { ... } from '@editor'
735
-
736
- âš ī¸ Do not use version-based paths in imports.
737
- 👉 Please add this manually in vite.config.js:
738
-
739
- alias: {
740
- '@editor': path.resolve(__dirname, './src/js/editor/editor-x.x')
741
- }`
742
-
743
- function scanDir(dir) {
744
- const files = fs.readdirSync(dir);
745
-
746
- for (const file of files) {
747
- const fullPath = path.join(dir, file);
748
- const stat = fs.statSync(fullPath);
749
-
750
- if (stat.isDirectory()) {
751
- scanDir(fullPath);
752
- } else if (file.endsWith(".js") || file.endsWith(".ts") || file.endsWith(".f7")) {
753
- const content = fs.readFileSync(fullPath, "utf-8");
754
-
755
- const lines = content.split("\n");
756
-
757
- lines.forEach((line, index) => {
758
- if (FORBIDDEN_REGEX.test(line)) {
759
- console.error(
760
- `❌ Forbidden import found:\nFile: ${fullPath}\nLine: ${index + 1}\nCode: ${line.trim()}\n`,
761
- ERROR_MESSAGE
762
- );
763
- hasError = true;
764
- }
765
- });
766
- }
767
- }
768
- }
769
-
770
- // Run scan
771
- scanDir(ROOT_DIR);
772
-
773
- // Throw error (exit process)
774
- if (hasError) {
775
- console.error("đŸšĢ Build failed due to forbidden editor imports.");
776
- process.exit(1);
777
- } else {
778
- console.log("✅ No forbidden imports found.");
779
- }
780
-
781
-
782
-
783
-
784
-
785
-
786
- //editor-x.x import old style check and stop execution START
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
571
 
797
572
  // saveToGalleryAndSaveAnyFile-x.x-ios.js file check for android and return error if exists START
798
573
 
@@ -2122,6 +1897,192 @@ if (hasMandatoryUpdate) {
2122
1897
 
2123
1898
 
2124
1899
 
1900
+
1901
+
1902
+ const localizationBaseDir = path.join(__dirname, "..", "src", "js", "localization");
1903
+
1904
+ // ======================================================
1905
+ // 🌐 LOCALIZATION CHECK (FULLY DYNAMIC)
1906
+ // ======================================================
1907
+
1908
+
1909
+ const jsRootDir = path.join(__dirname, "..", "src", "js");
1910
+
1911
+ // 🔍 Detect OLD localization files in root js/
1912
+ const oldLocalizationFiles = fs.readdirSync(jsRootDir)
1913
+ .filter(name =>
1914
+ /^localization-\d+(\.\d+)*\.js$/.test(name) ||
1915
+ /^localization_settings-\d+(\.\d+)*\.js$/.test(name)
1916
+ );
1917
+
1918
+ // ❌ If old structure found → STOP
1919
+ if (oldLocalizationFiles.length > 0) {
1920
+
1921
+ console.error(`
1922
+ ❌ OLD LOCALIZATION STRUCTURE DETECTED
1923
+
1924
+ You are using outdated file structure:
1925
+ src/js/localization-x.x.js
1926
+ src/js/localization_settings-x.x.js
1927
+
1928
+ 🚨 This is no longer supported.
1929
+
1930
+ đŸ“Ļ Found files:
1931
+ ${oldLocalizationFiles.map(f => " - " + f).join("\n")}
1932
+
1933
+ 👉 Please move them to new structure:
1934
+
1935
+ src/js/localization/localization_settings-x.x.js
1936
+ src/js/localization/localization-x.x/
1937
+
1938
+ âš ī¸ Example:
1939
+
1940
+ OLD:
1941
+ src/js/localization-x.x.js
1942
+ src/js/localization_settings-x.x.js
1943
+
1944
+ NEW:
1945
+ src/js/localization/localization_settings-1.1.js
1946
+ src/js/localization/localization-x.x/localization-x.x.js
1947
+
1948
+ ❌ Build stopped.
1949
+ `);
1950
+
1951
+ process.exit(1);
1952
+ }
1953
+
1954
+
1955
+
1956
+
1957
+ if (fs.existsSync(localizationBaseDir)) {
1958
+
1959
+ // ❌ Block localization-x.x.js directly inside localization folder
1960
+ const invalidFiles = fs.readdirSync(localizationBaseDir)
1961
+ .filter(name => /^localization-\d+(\.\d+)*\.js$/.test(name));
1962
+
1963
+ if (invalidFiles.length > 0) {
1964
+ console.error(`
1965
+ ❌ INVALID LOCALIZATION FILE LOCATION
1966
+
1967
+ đŸšĢ localization-x.x.js must NOT be directly inside:
1968
+ src/js/localization/
1969
+
1970
+ đŸ“Ļ Found:
1971
+ ${invalidFiles.map(f => " - " + f).join("\n")}
1972
+
1973
+ ✅ Move it to:
1974
+
1975
+ src/js/localization/localization-x.x/localization-x.x.js
1976
+
1977
+ ❌ Build stopped.
1978
+ `);
1979
+ process.exit(1);
1980
+ }
1981
+
1982
+ // 🔍 Find localization-x.x folders
1983
+ const localizationVersions = fs.readdirSync(localizationBaseDir)
1984
+ .filter(name => /^localization-\d+(\.\d+)+$/.test(name));
1985
+ } else {
1986
+ console.log("â„šī¸ Localization not used in this project. Skipping...");
1987
+ }
1988
+
1989
+
1990
+
1991
+
1992
+
1993
+
1994
+
1995
+
1996
+
1997
+
1998
+
1999
+
2000
+
2001
+
2002
+
2003
+
2004
+
2005
+
2006
+
2007
+ //editor-x.x import old style check and stop execution START
2008
+
2009
+
2010
+
2011
+ // Match: editor/editor-2.3, editor/editor-2.3.1, etc.
2012
+ const FORBIDDEN_REGEX = /editor\/editor-\d+(\.\d+)+/;
2013
+
2014
+ let hasError = false;
2015
+
2016
+ const ERROR_MESSAGE = `const ERROR_MESSAGE = ❌ Invalid import detected!
2017
+
2018
+ You are using a direct version-based path like: editor/editor-x.x/editor.js
2019
+
2020
+ đŸšĢ This is NOT allowed.
2021
+
2022
+ 👉 Please use the proper alias or updated import method.
2023
+ Example: import { ... } from '@editor'
2024
+
2025
+ âš ī¸ Do not use version-based paths in imports.
2026
+ 👉 Please add this manually in vite.config.js:
2027
+
2028
+ alias: {
2029
+ '@editor': path.resolve(__dirname, './src/js/editor/editor-x.x')
2030
+ }`
2031
+
2032
+ function scanDir(dir) {
2033
+ const files = fs.readdirSync(dir);
2034
+
2035
+ for (const file of files) {
2036
+ const fullPath = path.join(dir, file);
2037
+ const stat = fs.statSync(fullPath);
2038
+
2039
+ if (stat.isDirectory()) {
2040
+ scanDir(fullPath);
2041
+ } else if (file.endsWith(".js") || file.endsWith(".ts") || file.endsWith(".f7")) {
2042
+ const content = fs.readFileSync(fullPath, "utf-8");
2043
+
2044
+ const lines = content.split("\n");
2045
+
2046
+ lines.forEach((line, index) => {
2047
+ if (FORBIDDEN_REGEX.test(line)) {
2048
+ console.error(
2049
+ `❌ Forbidden import found:\nFile: ${fullPath}\nLine: ${index + 1}\nCode: ${line.trim()}\n`,
2050
+ ERROR_MESSAGE
2051
+ );
2052
+ hasError = true;
2053
+ }
2054
+ });
2055
+ }
2056
+ }
2057
+ }
2058
+
2059
+ // Run scan
2060
+ scanDir(ROOT_DIR);
2061
+
2062
+ // Throw error (exit process)
2063
+ if (hasError) {
2064
+ console.error("đŸšĢ Build failed due to forbidden editor imports.");
2065
+ process.exit(1);
2066
+ } else {
2067
+ console.log("✅ No forbidden imports found.");
2068
+ }
2069
+
2070
+
2071
+
2072
+
2073
+
2074
+
2075
+ //editor-x.x import old style check and stop execution START
2076
+
2077
+
2078
+
2079
+
2080
+
2081
+
2082
+
2083
+
2084
+
2085
+
2125
2086
  // Check all the codeplays plugins version START
2126
2087
 
2127
2088
 
@@ -2227,6 +2188,12 @@ const compareVersion = (v1, v2) => {
2227
2188
 
2228
2189
 
2229
2190
 
2191
+
2192
+
2193
+
2194
+
2195
+
2196
+
2230
2197
  const admobConfigPath = path.join('src', 'js','Ads', 'admob-ad-configuration.json');
2231
2198
 
2232
2199
  const checkAdmobConfigurationProperty=()=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",