codeplay-common 2.1.11 → 2.1.12

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.
@@ -10,24 +10,28 @@ const configPath = path.join(process.cwd(), 'capacitor.config.json');
10
10
 
11
11
  // Expected plugin list with minimum versions
12
12
  const requiredPlugins = [
13
- { pattern: /backbutton-(\d+\.\d+)\.js$/, minVersion: '1.6', required: true },
14
- { pattern: /common-(\d+\.\d+)\.js$/, minVersion: '5.1', required: true },
15
- { pattern: /localization_settings-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true },
16
- { pattern: /localization-(\d+\.\d+)\.js$/, minVersion: '1.3', required: true },
17
- { pattern: /localNotification-(\d+\.\d+)\.js$/, minVersion: '2.2', required: true },
18
- { pattern: /localNotification_AppSettings-(\d+\.\d+)\.js$/, minVersion: '1.0', required: true },
19
- { pattern: /onesignal-(\d+\.\d+)\.js$/, minVersion: '2.2', required: true },
20
- { pattern: /saveToGalleryAndSaveAnyFile-(\d+\.\d+)(-ios)?\.js$/, minVersion: '3.0', required: true },
21
- { pattern: /Ads[\/\\]IAP-(\d+\.\d+)$/, minVersion: '2.5', isFolder: true , required: true },
22
- { pattern: /Ads[\/\\]admob-emi-(\d+\.\d+)\.js$/, minVersion: '3.3', required: true },
13
+ { pattern: /backbutton-(\d+\.\d+)\.js$/, minVersion: '1.6', required: true, baseDir: 'js' },
14
+ { pattern: /common-(\d+\.\d+)\.js$/, minVersion: '5.1', required: true, baseDir: 'js' },
15
+ { pattern: /localization_settings-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true, baseDir: 'js' },
16
+ { pattern: /localization-(\d+\.\d+)\.js$/, minVersion: '1.3', required: true, baseDir: 'js' },
17
+ { pattern: /localNotification-(\d+\.\d+)\.js$/, minVersion: '2.2', required: true, baseDir: 'js' },
18
+ { pattern: /localNotification_AppSettings-(\d+\.\d+)\.js$/, minVersion: '1.0', required: true, baseDir: 'js' },
19
+ { pattern: /onesignal-(\d+\.\d+)\.js$/, minVersion: '2.2', required: true, baseDir: 'js' },
20
+ { pattern: /saveToGalleryAndSaveAnyFile-(\d+\.\d+)(-ios)?\.js$/, minVersion: '3.0', required: true, baseDir: 'js' },
21
+ { pattern: /Ads[\/\\]IAP-(\d+\.\d+)$/, minVersion: '2.5', isFolder: true , required: true, baseDir: 'js' },
22
+ { pattern: /Ads[\/\\]admob-emi-(\d+\.\d+)\.js$/, minVersion: '3.3', required: true, baseDir: 'js' },
23
23
 
24
24
  // New added plugins
25
- { pattern: /video-player-(\d+\.\d+)\.js$/, minVersion: '1.5', required: true },
26
- { pattern: /image-cropper-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true },
25
+ { pattern: /video-player-(\d+\.\d+)\.js$/, minVersion: '1.5', required: true, baseDir: 'js' },
26
+ { pattern: /image-cropper-(\d+\.\d+)\.js$/, minVersion: '1.1', required: true, baseDir: 'js' },
27
27
 
28
+ { pattern: /common-(\d+\.\d+)\.less$/, minVersion: '1.4', required: true, baseDir: 'assets/css' },
29
+
30
+
28
31
  // New folders
29
- { pattern: /editor-(\d+\.\d+)$/, minVersion: '1.8', isFolder: true, required: true },
30
- { pattern: /ffmpeg-(\d+\.\d+)$/, minVersion: '1.3', isFolder: true, required: true }
32
+ { pattern: /editor-(\d+\.\d+)$/, minVersion: '1.8', isFolder: true, required: true, baseDir: 'js' },
33
+ { pattern: /ffmpeg-(\d+\.\d+)$/, minVersion: '1.3', isFolder: true, required: true, baseDir: 'js' },
34
+ { pattern: /theme-(\d+\.\d+)$/, minVersion: '1.3', isFolder: true , required: true, baseDir: 'js' }
31
35
  ];
32
36
 
33
37
 
@@ -921,45 +925,60 @@ function walkSync(dir, filelist = []) {
921
925
  return filelist;
922
926
  }
923
927
 
928
+
929
+
930
+ function getSearchRoot(plugin) {
931
+ return path.join(srcDir, plugin.baseDir || 'js');
932
+ }
933
+
924
934
  function checkPlugins() {
925
935
  const files = walkSync(srcDir);
926
936
 
927
937
  for (const plugin of requiredPlugins) {
928
- if (plugin.isFolder) {
929
938
 
930
- let baseFolder = path.join(srcDir,'js', 'Ads'); // <- use known folder name
939
+ const searchRoot = getSearchRoot(plugin);
931
940
 
932
- if (fs.existsSync(baseFolder)) {
933
- const subDirs = fs.readdirSync(baseFolder)
934
- .map(name => path.join(baseFolder, name))
935
- .filter(p => fs.statSync(p).isDirectory());
941
+ // ---------- FOLDER PLUGINS ----------
942
+ if (plugin.isFolder) {
936
943
 
937
- for (const dir of subDirs) {
938
- const relativePath = path.relative(srcDir, dir).replace(/\\/g, '/'); // e.g. Ads/IAP-2.0
939
- const match = plugin.pattern.exec(relativePath);
940
- if (match) {
941
- const currentVersion = match[1];
942
- if (compareVersions(currentVersion, plugin.minVersion) < 0) {
943
- outdatedPlugins.push({
944
- name: relativePath,
945
- currentVersion,
946
- requiredVersion: plugin.minVersion
947
- });
944
+ if (!fs.existsSync(searchRoot)) continue;
945
+
946
+ const subDirs = fs.readdirSync(searchRoot)
947
+ .map(name => path.join(searchRoot, name))
948
+ .filter(p => fs.statSync(p).isDirectory());
949
+
950
+ for (const dir of subDirs) {
951
+ const relativePath = path
952
+ .relative(searchRoot, dir)
953
+ .replace(/\\/g, '/');
954
+
955
+ const match = plugin.pattern.exec(relativePath);
956
+ if (match) {
957
+ const currentVersion = match[1];
958
+ if (compareVersions(currentVersion, plugin.minVersion) < 0) {
959
+ outdatedPlugins.push({
960
+ name: relativePath,
961
+ currentVersion,
962
+ requiredVersion: plugin.minVersion
963
+ });
964
+ }
948
965
  }
949
966
  }
967
+ continue;
950
968
  }
951
- }
952
- continue;
953
- }
954
969
 
955
- const matchedFile = files.find(file => plugin.pattern.test(file));
970
+ // ---------- FILE PLUGINS ----------
971
+ const matchedFile = files.find(file =>
972
+ file.startsWith(searchRoot) && plugin.pattern.test(file)
973
+ );
974
+
956
975
  if (matchedFile) {
957
976
  const match = plugin.pattern.exec(matchedFile);
958
977
  if (match) {
959
978
  const currentVersion = match[1];
960
979
  if (compareVersions(currentVersion, plugin.minVersion) < 0) {
961
980
  outdatedPlugins.push({
962
- name: path.relative(__dirname, matchedFile),
981
+ name: path.relative(srcDir, matchedFile),
963
982
  currentVersion,
964
983
  requiredVersion: plugin.minVersion
965
984
  });
@@ -968,6 +987,7 @@ if (plugin.isFolder) {
968
987
  }
969
988
  }
970
989
 
990
+
971
991
  if (outdatedPlugins.length > 0) {
972
992
  console.log('\n❗ The following plugins are outdated:');
973
993
  outdatedPlugins.forEach(p => {
@@ -993,6 +1013,7 @@ if (plugin.isFolder) {
993
1013
  }
994
1014
  }
995
1015
 
1016
+
996
1017
  // Run the validation
997
1018
  checkPlugins();
998
1019
 
@@ -440,12 +440,15 @@ if (!existsSync(aabOutputDir)) {
440
440
  }
441
441
 
442
442
  if (existsSync(aabOutputDir)) {
443
- const files = readdirSync(aabOutputDir).filter(file => file.endsWith('.aab'));
444
- files.forEach(file => {
445
- const filePath = join(aabOutputDir, file);
446
- unlinkSync(filePath);
447
- console.log(`Deleted existing AAB file: ${file}`);
448
- });
443
+ const files = readdirSync(aabOutputDir).filter(
444
+ file => file.endsWith('.aab') || file.endsWith('.apk')
445
+ );
446
+
447
+ files.forEach(file => {
448
+ const filePath = join(aabOutputDir, file);
449
+ unlinkSync(filePath);
450
+ console.log(`Deleted existing build file: ${file}`);
451
+ });
449
452
  }
450
453
 
451
454
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "2.1.11",
3
+ "version": "2.1.12",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",