@tryghost/mg-medium-export 0.15.0 → 0.15.1
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/README.md +3 -0
- package/lib/read-zip.js +10 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -54,6 +54,9 @@ It's possible to pass more options, in order to achieve a better migration file
|
|
|
54
54
|
- **`--mediumAsCanonical`**
|
|
55
55
|
- bool - default: `false`
|
|
56
56
|
- Use medium article as canonical URL
|
|
57
|
+
- **`--removeResponses`**
|
|
58
|
+
- bool - default: `true`
|
|
59
|
+
- Remove response posts such as comments from the output
|
|
57
60
|
- **`--fallBackHTMLCard`**
|
|
58
61
|
- bool - default: `true`
|
|
59
62
|
- Fall back to convert to HTMLCard, if standard Mobiledoc convert fails
|
package/lib/read-zip.js
CHANGED
|
@@ -17,18 +17,25 @@ const contentStats = async (zipPath) => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const readMediumZip = ({content, zipPath, options, skippedFileCount}) => {
|
|
20
|
+
const {removeResponses} = options;
|
|
21
|
+
|
|
20
22
|
fsUtils.zip.read(zipPath, (entryName, zipEntry) => {
|
|
23
|
+
const entryHtml = zipEntry.getData().toString('utf8');
|
|
24
|
+
|
|
21
25
|
// Catch all HTML files inside `profile/`
|
|
22
26
|
if (/^profile\/profile\.html/.test(entryName)) {
|
|
23
|
-
content.profiles.push({data:
|
|
27
|
+
content.profiles.push({data: entryHtml});
|
|
24
28
|
|
|
25
29
|
// Catch all HTML files in `posts/`
|
|
26
30
|
} else if (/^posts\/.*\.html$/.test(entryName)) {
|
|
31
|
+
if (removeResponses && !entryHtml.includes('graf--title')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
content.posts.push({
|
|
28
36
|
name: entryName,
|
|
29
|
-
html:
|
|
37
|
+
html: entryHtml
|
|
30
38
|
});
|
|
31
|
-
|
|
32
39
|
// Skip if not matched above, and report skipped files if `--verbose`
|
|
33
40
|
} else if (/.html$/.test(entryName)) {
|
|
34
41
|
if (options.verbose) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-medium-export",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "tbc",
|
|
5
5
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-medium-export",
|
|
6
6
|
"author": "Ghost Foundation",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"eslint": "8.
|
|
24
|
+
"eslint": "8.42.0",
|
|
25
25
|
"jest": "29.5.0",
|
|
26
26
|
"jest-extended": "3.2.4"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@tryghost/debug": "0.1.25",
|
|
30
|
-
"@tryghost/mg-fs-utils": "^0.12.
|
|
31
|
-
"@tryghost/string": "0.2.
|
|
30
|
+
"@tryghost/mg-fs-utils": "^0.12.13",
|
|
31
|
+
"@tryghost/string": "0.2.7",
|
|
32
32
|
"cheerio": "0.22.0",
|
|
33
33
|
"date-fns": "2.30.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "d1b13f335fbc34448997b548efd04f63d4ba82ff"
|
|
36
36
|
}
|