@tryghost/mg-fs-utils 0.10.0 → 0.10.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/lib/FileCache.js +15 -0
- package/lib/zip.js +2 -2
- package/package.json +2 -2
package/lib/FileCache.js
CHANGED
|
@@ -413,6 +413,21 @@ class FileCache {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
async emptyCurrentCacheDir() {
|
|
417
|
+
if (!this.cacheKey) {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
let siteCachePath = path.join(this.cacheBaseDir, this.cacheKey);
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
await fs.remove(siteCachePath);
|
|
425
|
+
return true;
|
|
426
|
+
} catch (error) {
|
|
427
|
+
throw new errors.NotFoundError({message: 'Unknown file type'});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
416
431
|
/**
|
|
417
432
|
* Empties the local cache directory
|
|
418
433
|
*/
|
package/lib/zip.js
CHANGED
|
@@ -42,10 +42,10 @@ const read = (zipPath, callback) => {
|
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const write = (zipPath, contentFolder, fileName) => {
|
|
45
|
+
const write = async (zipPath, contentFolder, fileName) => {
|
|
46
46
|
const outputPath = path.join(zipPath, fileName || `ghost-import-${Date.now()}.zip`);
|
|
47
47
|
|
|
48
|
-
return zip.compress(contentFolder, outputPath);
|
|
48
|
+
return await zip.compress(contentFolder, outputPath);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export default {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-fs-utils",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-fs-utils",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"lodash": "4.17.21",
|
|
36
36
|
"sharp": "0.31.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "638b4ec940ed2b8a3fb0acbd9ac7e80b967e346c"
|
|
39
39
|
}
|