@intecoag/inteco-cli 1.5.1 → 1.5.2
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.
- package/package.json +4 -4
- package/src/modules/syncConfig.js +35 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intecoag/inteco-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "CLI-Tools for Inteco",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"fast-glob": "^3.3.3",
|
|
25
25
|
"fuzzysort": "^3.1.0",
|
|
26
26
|
"graphql": "^16.6.0",
|
|
27
|
-
"meow": "^14.
|
|
27
|
+
"meow": "^14.1.0",
|
|
28
28
|
"mysql-await": "^2.1.8",
|
|
29
29
|
"n-readlines": "^3.4.0",
|
|
30
30
|
"node-7z": "^3.0.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"inteco": "src/index.js"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@commitlint/cli": "^20.4.
|
|
43
|
-
"@commitlint/config-conventional": "^20.4.
|
|
42
|
+
"@commitlint/cli": "^20.4.2",
|
|
43
|
+
"@commitlint/config-conventional": "^20.4.2",
|
|
44
44
|
"husky": "^9.1.7",
|
|
45
45
|
"semantic-release": "^25.0.3"
|
|
46
46
|
},
|
|
@@ -265,7 +265,7 @@ function processMultiple(responses, dryRun, sourcePaths, destPaths) {
|
|
|
265
265
|
let deletedCount = 0;
|
|
266
266
|
for(let i = 0; i < sourcePaths.length && i < destPaths.length; i++) {
|
|
267
267
|
if (existsSync(destPaths[i])) {
|
|
268
|
-
deletedCount += countAndDeleteDir(destPaths[i], dryRun);
|
|
268
|
+
deletedCount += countAndDeleteDir(destPaths[i], dryRun, ["wegas.properties", "path.yaml"]);
|
|
269
269
|
if (!dryRun) {
|
|
270
270
|
console.log(chalk.gray(`Deleted existing folder: ${destPaths[i]}`));
|
|
271
271
|
}
|
|
@@ -293,27 +293,47 @@ function processMultiple(responses, dryRun, sourcePaths, destPaths) {
|
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
function countAndDeleteDir(dirPath, dryRun = false) {
|
|
296
|
+
function countAndDeleteDir(dirPath, dryRun = false, filenameBlacklist = []) {
|
|
297
297
|
let deletedCount = 0;
|
|
298
298
|
|
|
299
299
|
if (existsSync(dirPath)) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
300
|
+
|
|
301
|
+
let shouldKeepDirectory = false;
|
|
302
|
+
|
|
303
|
+
// For dry run, recursively count files/directories without deleting
|
|
304
|
+
const entries = readdirSync(dirPath, { withFileTypes: true });
|
|
305
|
+
for (const entry of entries) {
|
|
306
|
+
if(filenameBlacklist.includes(entry.name)){
|
|
307
|
+
shouldKeepDirectory = true; // Directory will not empty
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const entryPath = path.join(dirPath, entry.name);
|
|
312
|
+
if (entry.isDirectory()) {
|
|
313
|
+
deletedCount += countAndDeleteDir(entryPath, dryRun, filenameBlacklist);
|
|
314
|
+
shouldKeepDirectory |= deletedCount != 0;
|
|
315
|
+
} else {
|
|
316
|
+
deletedCount++;
|
|
317
|
+
if(dryRun) {
|
|
310
318
|
console.log(chalk.red(`[DryRun] Would delete file: ${entryPath}`));
|
|
311
319
|
}
|
|
320
|
+
else {
|
|
321
|
+
console.log(chalk.red(`Deleting file: ${entryPath}`));
|
|
322
|
+
rmSync(entryPath, { recursive: false, force: true });
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if(!shouldKeepDirectory) {
|
|
328
|
+
if(dryRun) {
|
|
329
|
+
console.log(chalk.red(`[DryRun] Would delete directory: ${dirPath}`));
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
console.log(chalk.red(`Deleting directory: ${dirPath}`));
|
|
333
|
+
rmSync(dirPath, { recursive: true, force: true });
|
|
312
334
|
}
|
|
335
|
+
|
|
313
336
|
deletedCount++; // counting the directory itself
|
|
314
|
-
} else {
|
|
315
|
-
rmSync(dirPath, { recursive: true, force: true });
|
|
316
|
-
// Can't count after delete, so you may skip or count before if desired
|
|
317
337
|
}
|
|
318
338
|
}
|
|
319
339
|
return deletedCount;
|