@verdnatura/myt 1.5.25 → 1.5.26
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/myt-clean.js +18 -5
- package/package.json +1 -1
package/myt-clean.js
CHANGED
|
@@ -52,11 +52,24 @@ class Clean extends Command {
|
|
|
52
52
|
if (!await fs.pathExists(archiveDir))
|
|
53
53
|
await fs.mkdir(archiveDir);
|
|
54
54
|
|
|
55
|
-
for (const oldVersion of oldVersions)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
55
|
+
for (const oldVersion of oldVersions) {
|
|
56
|
+
const srcDir = path.join(opts.versionsDir, oldVersion);
|
|
57
|
+
const dstDir = path.join(archiveDir, oldVersion);
|
|
58
|
+
|
|
59
|
+
if (!await fs.pathExists(dstDir))
|
|
60
|
+
await fs.mkdir(dstDir);
|
|
61
|
+
|
|
62
|
+
const scripts = await fs.readdir(srcDir);
|
|
63
|
+
for (const script of scripts) {
|
|
64
|
+
await fs.move(
|
|
65
|
+
path.join(srcDir, script),
|
|
66
|
+
path.join(dstDir, script),
|
|
67
|
+
{overwrite: true}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await fs.rmdir(srcDir);
|
|
72
|
+
}
|
|
60
73
|
|
|
61
74
|
console.log(`Old versions archived: ${oldVersions.length}`);
|
|
62
75
|
} else
|