@tryghost/mg-jekyll-export 0.1.10 → 0.2.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 +2 -2
- package/index.js +3 -7
- package/lib/process-html.js +2 -2
- package/lib/process-post.js +7 -6
- package/lib/process.js +2 -2
- package/lib/read-zip.js +4 -4
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -49,8 +49,8 @@ It's possible to pass more options, in order to achieve a better migration file
|
|
|
49
49
|
- **`-s` `--scrape`**
|
|
50
50
|
- Configure scraping tasks
|
|
51
51
|
- string - default: `all`
|
|
52
|
-
- Choices: `all`, `img`, `web`, `media`, `none`
|
|
53
|
-
- **`--
|
|
52
|
+
- Choices: `all`, `img`, `web`, `media`, `files`, `none`
|
|
53
|
+
- **`--sizeLimit`**
|
|
54
54
|
- number - default: `false`
|
|
55
55
|
- Media files larger than this size (defined in MB [i.e. `5`]) will be flagged as oversize
|
|
56
56
|
- **`-u` `--url`**
|
package/index.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import readZip from './lib/read-zip.js';
|
|
2
|
+
import process from './lib/process.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default (pathToZip, options) => {
|
|
5
5
|
let input = readZip(pathToZip, options);
|
|
6
6
|
let output = process(input, options);
|
|
7
7
|
|
|
8
8
|
return output;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
if (require.main === module && process.argv[2]) {
|
|
12
|
-
console.log(JSON.stringify(jekyllExport(process.argv[2]), null, 2)); // eslint-disable-line
|
|
13
|
-
}
|
package/lib/process-html.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import $ from 'cheerio';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
Process the HTML of a single Jekyll Post.
|
|
@@ -6,7 +6,7 @@ Process the HTML of a single Jekyll Post.
|
|
|
6
6
|
Receives raw HTML, returns processed HTML
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export default (rawHtml, options = {}) => {
|
|
10
10
|
const $html = $.load(rawHtml, {
|
|
11
11
|
decodeEntities: false
|
|
12
12
|
});
|
package/lib/process-post.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import MarkdownIt from 'markdown-it';
|
|
2
|
+
import string from '@tryghost/string';
|
|
3
|
+
import errors from '@tryghost/errors';
|
|
4
|
+
import fm from 'front-matter';
|
|
5
|
+
import processHtml from './process-html.js';
|
|
6
|
+
|
|
2
7
|
const md = new MarkdownIt({
|
|
3
8
|
html: true
|
|
4
9
|
});
|
|
5
|
-
const string = require('@tryghost/string');
|
|
6
|
-
const errors = require('@tryghost/errors');
|
|
7
|
-
const fm = require('front-matter');
|
|
8
|
-
const processHtml = require('./process-html');
|
|
9
10
|
|
|
10
11
|
// The frontmatter date may be a Date object or a string
|
|
11
12
|
function _parseFrontMatterDate(fmDate) {
|
|
@@ -200,7 +201,7 @@ const processMeta = (fileName, fileContents, options) => {
|
|
|
200
201
|
return post;
|
|
201
202
|
};
|
|
202
203
|
|
|
203
|
-
|
|
204
|
+
export default (fileName, fileContents, globalUser = false, options = {}) => {
|
|
204
205
|
const post = processMeta(fileName, fileContents, options);
|
|
205
206
|
|
|
206
207
|
// The post body may be in Markdown or HTML.
|
package/lib/process.js
CHANGED
package/lib/read-zip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import errors from '@tryghost/errors';
|
|
2
|
+
import fsUtils from '@tryghost/mg-fs-utils';
|
|
3
|
+
import {ui} from '@tryghost/pretty-cli';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default (zipPath, options) => {
|
|
6
6
|
let content = {
|
|
7
7
|
posts: []
|
|
8
8
|
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-jekyll-export",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "tbc",
|
|
5
5
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-jekyll-export",
|
|
6
6
|
"author": "Ghost Foundation",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "index.js",
|
|
9
|
+
"type": "module",
|
|
9
10
|
"scripts": {
|
|
10
11
|
"dev": "echo \"Implement me!\"",
|
|
11
|
-
"test": "
|
|
12
|
+
"test": "node --experimental-vm-modules $(yarn bin jest)",
|
|
12
13
|
"lint": "eslint . --ext .js --cache",
|
|
13
14
|
"posttest": "yarn lint"
|
|
14
15
|
},
|
|
@@ -20,17 +21,17 @@
|
|
|
20
21
|
"access": "public"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"eslint": "8.25.0",
|
|
25
|
+
"jest": "29.1.2",
|
|
26
|
+
"jest-extended": "3.1.0"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@tryghost/errors": "^1.2.14",
|
|
29
|
-
"@tryghost/mg-fs-utils": "^0.
|
|
30
|
+
"@tryghost/mg-fs-utils": "^0.10.1",
|
|
30
31
|
"@tryghost/string": "^0.2.0",
|
|
31
32
|
"cheerio": "0.22.0",
|
|
32
33
|
"front-matter": "4.0.2",
|
|
33
34
|
"markdown-it": "13.0.1"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "8f119b6c370337a90aa51dfbdb8d46ed7f5d154c"
|
|
36
37
|
}
|