@tryghost/mg-fs-utils 0.11.2 → 0.11.4
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/zip.js +10 -3
- package/package.json +8 -8
package/lib/zip.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {join} from 'node:path';
|
|
2
2
|
import AdmZip from 'adm-zip';
|
|
3
|
-
import {ensureDirSync} from 'fs-extra';
|
|
3
|
+
import {ensureDirSync, remove, ensureFileSync} from 'fs-extra';
|
|
4
4
|
import zip from '@tryghost/zip';
|
|
5
5
|
import errors from '@tryghost/errors';
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ const read = (zipPath, callback) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const write = async (zipPath, contentFolder, fileName) => {
|
|
47
|
-
// Ensure the directory we want to
|
|
47
|
+
// Ensure the directory we want to write to exists
|
|
48
48
|
ensureDirSync(zipPath);
|
|
49
49
|
|
|
50
50
|
const outputPath = join(zipPath, fileName || `ghost-import-${Date.now()}.zip`);
|
|
@@ -52,8 +52,15 @@ const write = async (zipPath, contentFolder, fileName) => {
|
|
|
52
52
|
return await zip.compress(contentFolder, outputPath);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
+
const deleteFile = async (fileToDelete) => {
|
|
56
|
+
ensureFileSync(fileToDelete);
|
|
57
|
+
|
|
58
|
+
return await remove(fileToDelete);
|
|
59
|
+
};
|
|
60
|
+
|
|
55
61
|
export default {
|
|
56
62
|
read,
|
|
57
63
|
write,
|
|
58
|
-
_private
|
|
64
|
+
_private,
|
|
65
|
+
deleteFile
|
|
59
66
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-fs-utils",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-fs-utils",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,21 +20,21 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"eslint": "8.
|
|
24
|
-
"jest": "29.
|
|
25
|
-
"jest-extended": "3.
|
|
23
|
+
"eslint": "8.29.0",
|
|
24
|
+
"jest": "29.3.1",
|
|
25
|
+
"jest-extended": "3.2.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tryghost/errors": "1.2.18",
|
|
29
|
-
"@tryghost/image-transform": "1.2.
|
|
30
|
-
"@tryghost/zip": "1.1.
|
|
29
|
+
"@tryghost/image-transform": "1.2.3",
|
|
30
|
+
"@tryghost/zip": "1.1.30",
|
|
31
31
|
"adm-zip": "0.5.9",
|
|
32
|
-
"csv-parse": "5.3.
|
|
32
|
+
"csv-parse": "5.3.3",
|
|
33
33
|
"date-fns": "2.29.3",
|
|
34
34
|
"fs-extra": "10.1.0",
|
|
35
35
|
"lodash": "4.17.21",
|
|
36
36
|
"sharp": "0.31.2",
|
|
37
37
|
"transliteration": "2.3.5"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "367c689a814c6ad2bc948a94ca995e1ec8187c76"
|
|
40
40
|
}
|