@tryghost/mg-tinynews 0.0.27 → 0.0.29
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/LICENSE +1 -1
- package/README.md +6 -2
- package/lib/mapper.js +7 -5
- package/package.json +9 -9
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -54,7 +54,11 @@ It's possible to pass more options, in order to achieve a better migration file
|
|
|
54
54
|
- **`--scrape`**
|
|
55
55
|
- Configure scraping tasks
|
|
56
56
|
- string - default: `all`
|
|
57
|
-
- Choices: `all`, `web`, `none`
|
|
57
|
+
- Choices: `all`, `web`, `assets`, `none`
|
|
58
|
+
- `all`: Scrape web metadata and download assets
|
|
59
|
+
- `web`: Only scrape metadata from web pages
|
|
60
|
+
- `assets`: Only download assets (images, media, files)
|
|
61
|
+
- `none`: Skip all scraping tasks
|
|
58
62
|
- **`--addPrimaryTag`**
|
|
59
63
|
- string - default: `null`
|
|
60
64
|
- Provide a tag name which should be added to every post as primary tag
|
|
@@ -100,4 +104,4 @@ yarn dev tinynews [options]
|
|
|
100
104
|
|
|
101
105
|
# Copyright & License
|
|
102
106
|
|
|
103
|
-
Copyright (c) 2013-
|
|
107
|
+
Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
|
package/lib/mapper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {readFile} from 'node:fs/promises';
|
|
2
2
|
import sanitizeHtml from 'sanitize-html';
|
|
3
|
-
import
|
|
3
|
+
import * as cheerio from 'cheerio';
|
|
4
4
|
import {slugify} from '@tryghost/string';
|
|
5
5
|
import {_base as debugFactory} from '@tryghost/debug';
|
|
6
6
|
import {jsonToHtml} from './json-to-html.js';
|
|
@@ -202,19 +202,21 @@ const processNewsletterContent = (html, options) => { // eslint-disable-line no-
|
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
-
const $html =
|
|
206
|
-
|
|
205
|
+
const $html = cheerio.load(cleanedContent, {
|
|
206
|
+
xml: {
|
|
207
|
+
decodeEntities: false
|
|
208
|
+
}
|
|
207
209
|
});
|
|
208
210
|
|
|
209
211
|
$html('p').each((i, el) => {
|
|
210
212
|
const innerHtml = $html(el).html().trim();
|
|
211
213
|
if (!innerHtml.length || innerHtml === '<br>' || innerHtml === '<br/>') {
|
|
212
|
-
$(el).remove();
|
|
214
|
+
$html(el).remove();
|
|
213
215
|
}
|
|
214
216
|
});
|
|
215
217
|
|
|
216
218
|
$html('a:contains("Made with Letterhead")').each((i, el) => {
|
|
217
|
-
$(el).remove();
|
|
219
|
+
$html(el).remove();
|
|
218
220
|
});
|
|
219
221
|
|
|
220
222
|
const cleanedHTML = $html.html().trim();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-tinynews",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-tinynews",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"eslint": "8.57.0",
|
|
24
|
-
"jest": "30.0
|
|
25
|
-
"jest-extended": "
|
|
24
|
+
"jest": "30.2.0",
|
|
25
|
+
"jest-extended": "7.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@tryghost/debug": "0.1.
|
|
28
|
+
"@tryghost/debug": "0.1.36",
|
|
29
29
|
"@tryghost/errors": "1.3.8",
|
|
30
|
-
"@tryghost/kg-default-cards": "10.2.
|
|
31
|
-
"@tryghost/string": "0.2.
|
|
32
|
-
"cheerio": "1.
|
|
33
|
-
"sanitize-html": "2.17.
|
|
30
|
+
"@tryghost/kg-default-cards": "10.2.6",
|
|
31
|
+
"@tryghost/string": "0.2.21",
|
|
32
|
+
"cheerio": "1.2.0",
|
|
33
|
+
"sanitize-html": "2.17.1",
|
|
34
34
|
"simple-dom": "1.4.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "ac9a868976ef5963df7fc2426af9e298bd5d8666"
|
|
37
37
|
}
|