codeplay-common 2.1.17 → 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.
|
@@ -1245,6 +1245,44 @@ if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
|
|
|
1245
1245
|
|
|
1246
1246
|
|
|
1247
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/');
|
|
1285
|
+
|
|
1248
1286
|
|
|
1249
1287
|
// Run the validation
|
|
1250
1288
|
(async () => {
|