codeplay-common 2.1.16 → 2.1.18

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.
@@ -34,7 +34,11 @@ const requiredPlugins = [
34
34
  // New folders
35
35
  { pattern: /editor-(\d+\.\d+)$/, minVersion: '1.8', isFolder: true, required: true, baseDir: 'js' },
36
36
  { pattern: /ffmpeg-(\d+\.\d+)$/, minVersion: '1.3', isFolder: true, required: true, baseDir: 'js' },
37
- { pattern: /theme-(\d+\.\d+)$/, minVersion: '1.6', isFolder: true , required: true, baseDir: 'js' }
37
+ { pattern: /theme-(\d+\.\d+)$/, minVersion: '1.6', isFolder: true , required: true, baseDir: 'js' },
38
+
39
+
40
+ { pattern: /certificatejs-(\d+\.\d+)$/, minVersion: '1.4', isFolder: true , required: true, baseDir: 'certificate' }
41
+
38
42
  ];
39
43
 
40
44
 
@@ -951,99 +955,94 @@ function getSearchRoot(plugin) {
951
955
  }
952
956
 
953
957
  function checkPlugins() {
954
- const files = walkSync(srcDir);
955
-
956
- for (const plugin of requiredPlugins) {
957
-
958
- const searchRoot = getSearchRoot(plugin);
959
-
960
- // ---------- FOLDER PLUGINS ----------
961
- if (plugin.isFolder) {
962
-
963
- if (!fs.existsSync(searchRoot)) continue;
964
-
965
- const subDirs = fs.readdirSync(searchRoot)
966
- .map(name => path.join(searchRoot, name))
967
- .filter(p => fs.statSync(p).isDirectory());
958
+ return new Promise((resolve, reject) => {
959
+ const files = walkSync(srcDir);
960
+
961
+ for (const plugin of requiredPlugins) {
962
+ const searchRoot = getSearchRoot(plugin);
963
+
964
+ if (plugin.isFolder) {
965
+ if (!fs.existsSync(searchRoot)) continue;
966
+
967
+ const subDirs = fs.readdirSync(searchRoot)
968
+ .map(name => path.join(searchRoot, name))
969
+ .filter(p => fs.statSync(p).isDirectory());
970
+
971
+ for (const dir of subDirs) {
972
+ const relativePath = path.relative(searchRoot, dir).replace(/\\/g, '/');
973
+ const match = plugin.pattern.exec(relativePath);
974
+
975
+ if (match) {
976
+ const currentVersion = match[1];
977
+ if (compareVersions(currentVersion, plugin.minVersion) < 0) {
978
+ outdatedPlugins.push({
979
+ name: relativePath,
980
+ currentVersion,
981
+ requiredVersion: plugin.minVersion
982
+ });
983
+ }
984
+ }
985
+ }
986
+ continue;
987
+ }
968
988
 
969
- for (const dir of subDirs) {
970
- const relativePath = path
971
- .relative(searchRoot, dir)
972
- .replace(/\\/g, '/');
989
+ const matchedFile = files.find(file =>
990
+ file.startsWith(searchRoot) && plugin.pattern.test(file)
991
+ );
973
992
 
974
- const match = plugin.pattern.exec(relativePath);
993
+ if (matchedFile) {
994
+ const match = plugin.pattern.exec(matchedFile);
975
995
  if (match) {
976
996
  const currentVersion = match[1];
977
- if (compareVersions(currentVersion, plugin.minVersion) < 0) {
997
+ const isBeta = !!match[2];
998
+
999
+ const cmp = plugin.pattern.source.includes('beta')
1000
+ ? compareWithBeta(currentVersion, plugin.minVersion, isBeta)
1001
+ : compareVersions(currentVersion, plugin.minVersion);
1002
+
1003
+ if (cmp < 0) {
978
1004
  outdatedPlugins.push({
979
- name: relativePath,
980
- currentVersion,
1005
+ name: path.relative(srcDir, matchedFile),
1006
+ currentVersion: isBeta ? `${currentVersion}-beta` : currentVersion,
981
1007
  requiredVersion: plugin.minVersion
982
1008
  });
983
1009
  }
984
1010
  }
985
1011
  }
986
- continue;
987
1012
  }
988
1013
 
989
- // ---------- FILE PLUGINS ----------
990
- const matchedFile = files.find(file =>
991
- file.startsWith(searchRoot) && plugin.pattern.test(file)
992
- );
1014
+ if (outdatedPlugins.length > 0) {
1015
+ console.log('\n❗ The following plugins are outdated:');
1016
+ outdatedPlugins.forEach(p => {
1017
+ console.log(` ❌ - ${p.name} (Current: ${p.currentVersion}, Required: ${p.requiredVersion})`);
1018
+ });
993
1019
 
994
- if (matchedFile) {
995
- const match = plugin.pattern.exec(matchedFile);
996
- if (match) {
997
- const currentVersion = match[1];
998
- const isBeta = !!match[2]; // <-- only common has this
999
-
1000
- const cmp = plugin.pattern.source.includes('beta')
1001
- ? compareWithBeta(currentVersion, plugin.minVersion, isBeta)
1002
- : compareVersions(currentVersion, plugin.minVersion);
1003
-
1004
- if (cmp < 0) {
1005
- outdatedPlugins.push({
1006
- name: path.relative(srcDir, matchedFile),
1007
- currentVersion: isBeta
1008
- ? `${currentVersion}-beta`
1009
- : currentVersion,
1010
- requiredVersion: plugin.minVersion
1011
- });
1012
- }
1013
- }
1014
- }
1015
-
1016
- }
1020
+ const rl = readline.createInterface({
1021
+ input: process.stdin,
1022
+ output: process.stdout
1023
+ });
1017
1024
 
1025
+ rl.question('\nAre you sure you want to continue without updating these plugins? (y/n): ', answer => {
1026
+ rl.close();
1018
1027
 
1019
- if (outdatedPlugins.length > 0) {
1020
- console.log('\n The following plugins are outdated:');
1021
- outdatedPlugins.forEach(p => {
1022
- console.log(` ❌ - ${p.name} (Current: ${p.currentVersion}, Required: ${p.requiredVersion})`);
1023
- });
1028
+ if (answer.toLowerCase() !== 'y') {
1029
+ console.log('\n Build cancelled due to outdated plugins.');
1030
+ process.exit(1);
1031
+ } else {
1032
+ console.log('\n✅ Continuing build...');
1033
+ resolve();
1034
+ }
1035
+ });
1036
+ } else {
1037
+ console.log('✅ All plugin versions are up to date.');
1038
+ resolve();
1039
+ }
1040
+ });
1041
+ }
1024
1042
 
1025
- const rl = readline.createInterface({
1026
- input: process.stdin,
1027
- output: process.stdout
1028
- });
1029
1043
 
1030
- rl.question('\nAre you sure you want to continue without updating these plugins? (y/n): ', answer => {
1031
- if (answer.toLowerCase() !== 'y') {
1032
- console.log('\n❌ Build cancelled due to outdated plugins.');
1033
- process.exit(1);
1034
- } else {
1035
- console.log('\n✅ Continuing build...');
1036
- rl.close();
1037
- }
1038
- });
1039
- } else {
1040
- console.log('✅ All plugin versions are up to date.');
1041
- }
1042
- }
1043
1044
 
1044
1045
 
1045
- // Run the validation
1046
- checkPlugins();
1047
1046
 
1048
1047
 
1049
1048
 
@@ -1128,7 +1127,7 @@ const checkAndupdateDropInViteConfig = () => {
1128
1127
  console.log("✅ vite.config.(m)js Updated successfully.");
1129
1128
  };
1130
1129
 
1131
- checkAndupdateDropInViteConfig();
1130
+
1132
1131
 
1133
1132
 
1134
1133
 
@@ -1245,9 +1244,52 @@ if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
1245
1244
  }
1246
1245
 
1247
1246
 
1248
- checkAdmobConfigurationProperty()
1247
+
1248
+ function ensureGitignoreEntry(entry) {
1249
+ const gitignorePath = path.join(process.cwd(), '.gitignore');
1250
+
1251
+ // If .gitignore doesn't exist, create it
1252
+ if (!fs.existsSync(gitignorePath)) {
1253
+ fs.writeFileSync(gitignorePath, `${entry}\n`, 'utf8');
1254
+ console.log(`✅ .gitignore created and added: ${entry}`);
1255
+ return;
1256
+ }
1257
+
1258
+ const content = fs.readFileSync(gitignorePath, 'utf8');
1259
+
1260
+ // Normalize lines (trim + remove trailing slashes for comparison)
1261
+ const lines = content
1262
+ .split(/\r?\n/)
1263
+ .map(l => l.trim());
1264
+
1265
+ const normalizedEntry = entry.replace(/\/$/, '');
1266
+
1267
+ const exists = lines.some(
1268
+ line => line.replace(/\/$/, '') === normalizedEntry
1269
+ );
1270
+
1271
+ if (exists) {
1272
+ console.log(`ℹ️ .gitignore already contains: ${entry}`);
1273
+ return;
1274
+ }
1275
+
1276
+ // Ensure file ends with newline
1277
+ const separator = content.endsWith('\n') ? '' : '\n';
1278
+
1279
+ fs.appendFileSync(gitignorePath, `${separator}${entry}\n`, 'utf8');
1280
+ console.log(`✅ Added to .gitignore: ${entry}`);
1281
+ }
1282
+
1283
+
1284
+ ensureGitignoreEntry('buildCodeplay/');
1249
1285
 
1250
1286
 
1287
+ // Run the validation
1288
+ (async () => {
1289
+ await checkPlugins();
1290
+ checkAndupdateDropInViteConfig();
1291
+ checkAdmobConfigurationProperty()
1292
+ })();
1251
1293
 
1252
1294
 
1253
1295
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "2.1.16",
3
+ "version": "2.1.18",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",