@tryghost/mg-html-lexical 0.0.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/LICENSE +21 -0
- package/README.md +73 -0
- package/build/index.d.ts +7 -0
- package/build/index.js +8 -0
- package/build/index.js.map +1 -0
- package/build/lib/convert-post.d.ts +8 -0
- package/build/lib/convert-post.js +23 -0
- package/build/lib/convert-post.js.map +1 -0
- package/build/lib/convert-to-html-card.d.ts +15 -0
- package/build/lib/convert-to-html-card.js +21 -0
- package/build/lib/convert-to-html-card.js.map +1 -0
- package/build/lib/convert.d.ts +2 -0
- package/build/lib/convert.js +56 -0
- package/build/lib/convert.js.map +1 -0
- package/build/test/convert-post.test.d.ts +1 -0
- package/build/test/convert-post.test.js +374 -0
- package/build/test/convert-post.test.js.map +1 -0
- package/build/test/convert.test.d.ts +1 -0
- package/build/test/convert.test.js +212 -0
- package/build/test/convert.test.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013-2023 Ghost Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Migrate HTML -> Lexical
|
|
2
|
+
|
|
3
|
+
A little wrapper tool for migrating all HTML fields of posts to Lexical
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
`npm install @tryghost/mg-html-lexical --save`
|
|
9
|
+
|
|
10
|
+
or
|
|
11
|
+
|
|
12
|
+
`yarn add @tryghost/mg-html-lexical`
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
var mgHtmlLexical = require('tryghost/mg-html-lexical');
|
|
19
|
+
var convertedData = mgHtmlLexical.convert(myData);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Data structure passed in can be either
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
let myData = {
|
|
26
|
+
logger: yourLoggingInstance,
|
|
27
|
+
posts: [
|
|
28
|
+
{
|
|
29
|
+
html: '<h2>Good stuff here</h2>'
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
or
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
let myData = {
|
|
39
|
+
logger: yourLoggingInstance,
|
|
40
|
+
data: {
|
|
41
|
+
posts: [
|
|
42
|
+
{
|
|
43
|
+
html: '<h2>Good stuff here</h2>'
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Develop
|
|
52
|
+
|
|
53
|
+
This is a mono repository, managed with [lerna](https://lernajs.io/).
|
|
54
|
+
|
|
55
|
+
Follow the instructions for the top-level repo.
|
|
56
|
+
1. `git clone` this repo & `cd` into it as usual
|
|
57
|
+
2. Run `yarn` to install top-level dependencies.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## Run
|
|
61
|
+
|
|
62
|
+
- `yarn dev`
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Test
|
|
66
|
+
|
|
67
|
+
- `yarn lint` run just eslint
|
|
68
|
+
- `yarn test` run lint and tests
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# Copyright & License
|
|
72
|
+
|
|
73
|
+
Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { convert } from './lib/convert.js';
|
|
2
|
+
import { convertPost } from './lib/convert-post.js';
|
|
3
|
+
// Understands the data formats, so knows where to look for posts to convert
|
|
4
|
+
export default {
|
|
5
|
+
convert
|
|
6
|
+
};
|
|
7
|
+
export { convert, convertPost };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElD,4EAA4E;AAC5E,eAAe;IACX,OAAO;CACV,CAAC;AAEF,OAAO,EACH,OAAO,EACP,WAAW,EACd,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import converter from '@tryghost/kg-html-to-lexical';
|
|
2
|
+
import errors from '@tryghost/errors';
|
|
3
|
+
import { convertToHTMLCard } from './convert-to-html-card.js';
|
|
4
|
+
const convertPost = (post, htmlCard = false, logger) => {
|
|
5
|
+
if (typeof post.html === 'undefined' || !post.html || post.html === 'undefined') {
|
|
6
|
+
throw new errors.InternalServerError({ message: 'Post has no html field to convert' });
|
|
7
|
+
}
|
|
8
|
+
if (htmlCard) {
|
|
9
|
+
post.lexical = JSON.stringify(convertToHTMLCard(post.html));
|
|
10
|
+
logger.warn({
|
|
11
|
+
message: `Post converted to HTML Card "${post.title}"`,
|
|
12
|
+
src: post.slug,
|
|
13
|
+
reference: post.title,
|
|
14
|
+
html: post.html
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
post.lexical = JSON.stringify(converter.htmlToLexical(post.html));
|
|
19
|
+
}
|
|
20
|
+
delete post.html;
|
|
21
|
+
};
|
|
22
|
+
export { convertPost };
|
|
23
|
+
//# sourceMappingURL=convert-post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-post.js","sourceRoot":"","sources":["../../src/lib/convert-post.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAS5D,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAQ,GAAG,KAAK,EAAE,MAAY,EAAE,EAAE;IACtE,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE;QAC7E,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,EAAC,OAAO,EAAE,mCAAmC,EAAC,CAAC,CAAC;KACxF;IAED,IAAI,QAAQ,EAAE;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC;YACR,OAAO,EAAE,gCAAgC,IAAI,CAAC,KAAK,GAAG;YACtD,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,SAAS,EAAE,IAAI,CAAC,KAAK;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC,CAAC;KACN;SAAM;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACrE;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EACH,WAAW,EACd,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const convertToHTMLCard: (htmlString: string) => {
|
|
2
|
+
root: {
|
|
3
|
+
children: {
|
|
4
|
+
type: string;
|
|
5
|
+
version: number;
|
|
6
|
+
html: string;
|
|
7
|
+
}[];
|
|
8
|
+
direction: null;
|
|
9
|
+
format: string;
|
|
10
|
+
indent: number;
|
|
11
|
+
type: string;
|
|
12
|
+
version: number;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export { convertToHTMLCard };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const convertToHTMLCard = (htmlString) => {
|
|
2
|
+
let structure = {
|
|
3
|
+
root: {
|
|
4
|
+
children: [
|
|
5
|
+
{
|
|
6
|
+
type: 'html',
|
|
7
|
+
version: 1,
|
|
8
|
+
html: htmlString
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
direction: null,
|
|
12
|
+
format: '',
|
|
13
|
+
indent: 0,
|
|
14
|
+
type: 'root',
|
|
15
|
+
version: 1
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return structure;
|
|
19
|
+
};
|
|
20
|
+
export { convertToHTMLCard };
|
|
21
|
+
//# sourceMappingURL=convert-to-html-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-to-html-card.js","sourceRoot":"","sources":["../../src/lib/convert-to-html-card.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC7C,IAAI,SAAS,GAAG;QACZ,IAAI,EAAE;YACF,QAAQ,EAAE;gBACN;oBACI,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,CAAC;oBACV,IAAI,EAAE,UAAU;iBACnB;aACJ;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,CAAC;SACb;KACJ,CAAC;IAEF,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEF,OAAO,EACH,iBAAiB,EACpB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { convertPost } from './convert-post.js';
|
|
2
|
+
// TODO: Add proper types
|
|
3
|
+
const convert = (ctx, htmlCard) => {
|
|
4
|
+
const { logger } = ctx;
|
|
5
|
+
let { options } = ctx;
|
|
6
|
+
let res = ctx.result;
|
|
7
|
+
let posts = res.posts;
|
|
8
|
+
if (!posts && res.data && res.data.posts) {
|
|
9
|
+
posts = res.data.posts;
|
|
10
|
+
}
|
|
11
|
+
if (!posts && res.db && res.db[0] && res.db[0].data && res.db[0].data.posts) {
|
|
12
|
+
posts = res.db[0].data.posts;
|
|
13
|
+
}
|
|
14
|
+
// TODO: Add listr tasks types
|
|
15
|
+
let tasks = [];
|
|
16
|
+
posts.forEach((post) => {
|
|
17
|
+
tasks.push({
|
|
18
|
+
title: `Converting ${post.title}`,
|
|
19
|
+
task: async () => {
|
|
20
|
+
try {
|
|
21
|
+
convertPost(post, htmlCard, logger);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (options.fallBackHTMLCard) {
|
|
25
|
+
try {
|
|
26
|
+
convertPost(post, true, logger);
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
logger.warn({
|
|
30
|
+
message: `Unable to convert post HTMLCard "${post.title}"`,
|
|
31
|
+
src: post.slug,
|
|
32
|
+
reference: post.title,
|
|
33
|
+
originalError: err,
|
|
34
|
+
html: post.html
|
|
35
|
+
});
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
logger.warn({
|
|
41
|
+
message: `Unable to convert post to Lexical "${post.title}"`,
|
|
42
|
+
src: post.slug,
|
|
43
|
+
reference: post.title,
|
|
44
|
+
originalError: error,
|
|
45
|
+
html: post.html
|
|
46
|
+
});
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return tasks;
|
|
54
|
+
};
|
|
55
|
+
export { convert };
|
|
56
|
+
//# sourceMappingURL=convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/lib/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAG9C,yBAAyB;AACzB,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,QAAiB,EAAE,EAAE;IAC5C,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAC;IACrB,IAAI,EAAC,OAAO,EAAC,GAAG,GAAG,CAAC;IACpB,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;IACrB,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IAEtB,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE;QACtC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;KAC1B;IAED,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAA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SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EACH,OAAO,EACV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import assert from 'assert/strict';
|
|
2
|
+
import { convertPost } from '../index.js';
|
|
3
|
+
let fakeLogger = {
|
|
4
|
+
warn: () => { },
|
|
5
|
+
error: () => { },
|
|
6
|
+
debug: () => { }
|
|
7
|
+
};
|
|
8
|
+
describe('Convert Tasks', function () {
|
|
9
|
+
test('Can convert to a HTML card', function () {
|
|
10
|
+
let post = {
|
|
11
|
+
title: 'title',
|
|
12
|
+
slug: 'slug',
|
|
13
|
+
html: '<h2>Good stuff here</h2>'
|
|
14
|
+
};
|
|
15
|
+
convertPost(post, true, fakeLogger);
|
|
16
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
17
|
+
assert.equal(post.html, undefined);
|
|
18
|
+
assert.deepEqual(lexical, {
|
|
19
|
+
root: {
|
|
20
|
+
children: [
|
|
21
|
+
{
|
|
22
|
+
type: 'html',
|
|
23
|
+
version: 1,
|
|
24
|
+
html: '<h2>Good stuff here</h2>'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
direction: null,
|
|
28
|
+
format: '',
|
|
29
|
+
indent: 0,
|
|
30
|
+
type: 'root',
|
|
31
|
+
version: 1
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
test('Covert to Lexical section', function () {
|
|
36
|
+
let post = {
|
|
37
|
+
title: 'title',
|
|
38
|
+
slug: 'slug',
|
|
39
|
+
html: '<h2>Good stuff here</h2>'
|
|
40
|
+
};
|
|
41
|
+
convertPost(post, false);
|
|
42
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
43
|
+
assert.deepEqual(lexical.root, {
|
|
44
|
+
children: [
|
|
45
|
+
{
|
|
46
|
+
children: [
|
|
47
|
+
{
|
|
48
|
+
detail: 0,
|
|
49
|
+
format: 0,
|
|
50
|
+
mode: 'normal',
|
|
51
|
+
style: '',
|
|
52
|
+
text: 'Good stuff here',
|
|
53
|
+
type: 'extended-text',
|
|
54
|
+
version: 1
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
direction: null,
|
|
58
|
+
format: '',
|
|
59
|
+
indent: 0,
|
|
60
|
+
type: 'extended-heading',
|
|
61
|
+
version: 1,
|
|
62
|
+
tag: 'h2'
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
direction: null,
|
|
66
|
+
format: '',
|
|
67
|
+
indent: 0,
|
|
68
|
+
type: 'root',
|
|
69
|
+
version: 1
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
test('Can catch an error', function () {
|
|
73
|
+
// `convertPost` will not be expecting the `wrong_key` property, so it will throw an error
|
|
74
|
+
let post = {
|
|
75
|
+
title: 'Title',
|
|
76
|
+
slug: 'slug',
|
|
77
|
+
wrong_key: '<h2>Good stuff here</h2>'
|
|
78
|
+
};
|
|
79
|
+
try {
|
|
80
|
+
convertPost(post, false);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
assert.equal(error.name, 'InternalServerError');
|
|
84
|
+
assert.equal(error.message, 'Post has no html field to convert');
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe('HTML handling', function () {
|
|
89
|
+
test('Covert full content to Lexical', function () {
|
|
90
|
+
let post = {
|
|
91
|
+
title: 'Title',
|
|
92
|
+
slug: 'slug',
|
|
93
|
+
html: '\
|
|
94
|
+
<h2>Lorem</h2>\
|
|
95
|
+
<img src="https://example.com/image.jpg" alt="Hello" />\
|
|
96
|
+
<p>Ipsum <i>dolor</i></p>\
|
|
97
|
+
<hr>\
|
|
98
|
+
<p>Link to <a href="https://example.com">Example</a></p>\
|
|
99
|
+
<p>Sit <br><b><i>amet</i></b></p>\
|
|
100
|
+
'
|
|
101
|
+
};
|
|
102
|
+
convertPost(post, false);
|
|
103
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
104
|
+
assert.deepEqual(lexical.root, {
|
|
105
|
+
children: [
|
|
106
|
+
{
|
|
107
|
+
children: [
|
|
108
|
+
{
|
|
109
|
+
detail: 0,
|
|
110
|
+
format: 0,
|
|
111
|
+
mode: 'normal',
|
|
112
|
+
style: '',
|
|
113
|
+
text: 'Lorem',
|
|
114
|
+
type: 'extended-text',
|
|
115
|
+
version: 1
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
direction: null,
|
|
119
|
+
format: '',
|
|
120
|
+
indent: 0,
|
|
121
|
+
type: 'extended-heading',
|
|
122
|
+
version: 1,
|
|
123
|
+
tag: 'h2'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'image',
|
|
127
|
+
version: 1,
|
|
128
|
+
src: 'https://example.com/image.jpg',
|
|
129
|
+
width: null,
|
|
130
|
+
height: null,
|
|
131
|
+
title: '',
|
|
132
|
+
alt: 'Hello',
|
|
133
|
+
caption: '',
|
|
134
|
+
cardWidth: 'regular',
|
|
135
|
+
href: ''
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
children: [
|
|
139
|
+
{
|
|
140
|
+
detail: 0,
|
|
141
|
+
format: 0,
|
|
142
|
+
mode: 'normal',
|
|
143
|
+
style: '',
|
|
144
|
+
text: 'Ipsum ',
|
|
145
|
+
type: 'extended-text',
|
|
146
|
+
version: 1
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
detail: 0,
|
|
150
|
+
format: 2,
|
|
151
|
+
mode: 'normal',
|
|
152
|
+
style: '',
|
|
153
|
+
text: 'dolor',
|
|
154
|
+
type: 'extended-text',
|
|
155
|
+
version: 1
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
direction: null,
|
|
159
|
+
format: '',
|
|
160
|
+
indent: 0,
|
|
161
|
+
type: 'paragraph',
|
|
162
|
+
version: 1
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'horizontalrule',
|
|
166
|
+
version: 1
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
children: [
|
|
170
|
+
{
|
|
171
|
+
detail: 0,
|
|
172
|
+
format: 0,
|
|
173
|
+
mode: 'normal',
|
|
174
|
+
style: '',
|
|
175
|
+
text: 'Link to ',
|
|
176
|
+
type: 'extended-text',
|
|
177
|
+
version: 1
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
children: [
|
|
181
|
+
{
|
|
182
|
+
detail: 0,
|
|
183
|
+
format: 0,
|
|
184
|
+
mode: 'normal',
|
|
185
|
+
style: '',
|
|
186
|
+
text: 'Example',
|
|
187
|
+
type: 'extended-text',
|
|
188
|
+
version: 1
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
direction: null,
|
|
192
|
+
format: '',
|
|
193
|
+
indent: 0,
|
|
194
|
+
type: 'link',
|
|
195
|
+
version: 1,
|
|
196
|
+
rel: null,
|
|
197
|
+
target: null,
|
|
198
|
+
title: null,
|
|
199
|
+
url: 'https://example.com'
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
direction: null,
|
|
203
|
+
format: '',
|
|
204
|
+
indent: 0,
|
|
205
|
+
type: 'paragraph',
|
|
206
|
+
version: 1
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
children: [
|
|
210
|
+
{
|
|
211
|
+
detail: 0,
|
|
212
|
+
format: 0,
|
|
213
|
+
mode: 'normal',
|
|
214
|
+
style: '',
|
|
215
|
+
text: 'Sit',
|
|
216
|
+
type: 'extended-text',
|
|
217
|
+
version: 1
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: 'linebreak',
|
|
221
|
+
version: 1
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
detail: 0,
|
|
225
|
+
format: 3,
|
|
226
|
+
mode: 'normal',
|
|
227
|
+
style: '',
|
|
228
|
+
text: 'amet',
|
|
229
|
+
type: 'extended-text',
|
|
230
|
+
version: 1
|
|
231
|
+
}
|
|
232
|
+
],
|
|
233
|
+
direction: null,
|
|
234
|
+
format: '',
|
|
235
|
+
indent: 0,
|
|
236
|
+
type: 'paragraph',
|
|
237
|
+
version: 1
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
direction: null,
|
|
241
|
+
format: '',
|
|
242
|
+
indent: 0,
|
|
243
|
+
type: 'root',
|
|
244
|
+
version: 1
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
test('Correctly transforms relative Portal links that start with #', function () {
|
|
248
|
+
let post = {
|
|
249
|
+
title: 'Title',
|
|
250
|
+
slug: 'slug',
|
|
251
|
+
html: '\
|
|
252
|
+
<div class="kg-card kg-button-card kg-align-center"><a href="#/portal/signup" class="kg-btn kg-btn-accent">Subscribe 1</a></div>\
|
|
253
|
+
<p>Please <a href="#/portal/signup">Subscribe 2</a></p>\
|
|
254
|
+
<div class="kg-card kg-button-card kg-align-center"><a href="#/portal/signup" class="kg-btn kg-btn-accent">Subscribe 3</a></div>\
|
|
255
|
+
<p>Please <a href="#/portal/signup">Subscribe 4</a></p>\
|
|
256
|
+
<div class="kg-card kg-button-card kg-align-center"><a href="/#/portal/signup" class="kg-btn kg-btn-accent">Subscribe 5</a></div>\
|
|
257
|
+
<p>Please <a href="/#/portal/signup">Subscribe 6</a></p>\
|
|
258
|
+
<div class="kg-card kg-button-card kg-align-center"><a href="https://example.com/#/portal/signup/free" class="kg-btn kg-btn-accent">Subscribe 7</a></div>\
|
|
259
|
+
<p>Please <a href="https://example.com/#/portal/signup/free">Subscribe 8</a></p>\
|
|
260
|
+
'
|
|
261
|
+
};
|
|
262
|
+
convertPost(post, false);
|
|
263
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
264
|
+
assert.deepEqual(lexical.root.children[0].buttonUrl, '#/portal/signup');
|
|
265
|
+
assert.deepEqual(lexical.root.children[1].children[1].url, '#/portal/signup');
|
|
266
|
+
assert.deepEqual(lexical.root.children[2].buttonUrl, '#/portal/signup');
|
|
267
|
+
assert.deepEqual(lexical.root.children[3].children[1].url, '#/portal/signup');
|
|
268
|
+
assert.deepEqual(lexical.root.children[4].buttonUrl, '/#/portal/signup');
|
|
269
|
+
assert.deepEqual(lexical.root.children[5].children[1].url, '/#/portal/signup');
|
|
270
|
+
assert.deepEqual(lexical.root.children[6].buttonUrl, 'https://example.com/#/portal/signup/free');
|
|
271
|
+
assert.deepEqual(lexical.root.children[7].children[1].url, 'https://example.com/#/portal/signup/free');
|
|
272
|
+
});
|
|
273
|
+
test('Correctly converts a linked image', function () {
|
|
274
|
+
let post = {
|
|
275
|
+
title: 'Title',
|
|
276
|
+
slug: 'slug',
|
|
277
|
+
html: '<a href="https://example.com"><img src="https://example.com/images/photo.jpg" /> Hello</a>'
|
|
278
|
+
};
|
|
279
|
+
convertPost(post, false);
|
|
280
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
281
|
+
assert.equal(lexical.root.children[0].children[0].type, 'link');
|
|
282
|
+
assert.equal(lexical.root.children[0].children[0].url, 'https://example.com');
|
|
283
|
+
assert.equal(lexical.root.children[0].children[0].children[0].type, 'image');
|
|
284
|
+
assert.equal(lexical.root.children[0].children[0].children[0].src, 'https://example.com/images/photo.jpg');
|
|
285
|
+
assert.equal(lexical.root.children[0].children[0].children[1].type, 'extended-text');
|
|
286
|
+
assert.equal(lexical.root.children[0].children[0].children[1].text, 'Hello');
|
|
287
|
+
});
|
|
288
|
+
test('Correctly converts a linked image with img alt', function () {
|
|
289
|
+
let post = {
|
|
290
|
+
title: 'Title',
|
|
291
|
+
slug: 'slug',
|
|
292
|
+
html: '<a href="https://example.com"><img src="https://example.com/images/photo.jpg" alt="Image alt" /> Hello</a>'
|
|
293
|
+
};
|
|
294
|
+
convertPost(post, false);
|
|
295
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
296
|
+
assert.equal(lexical.root.children[0].children[0].type, 'link');
|
|
297
|
+
assert.equal(lexical.root.children[0].children[0].url, 'https://example.com');
|
|
298
|
+
assert.equal(lexical.root.children[0].children[0].children[0].type, 'image');
|
|
299
|
+
assert.equal(lexical.root.children[0].children[0].children[0].src, 'https://example.com/images/photo.jpg');
|
|
300
|
+
assert.equal(lexical.root.children[0].children[0].children[0].alt, 'Image alt');
|
|
301
|
+
assert.equal(lexical.root.children[0].children[0].children[1].type, 'extended-text');
|
|
302
|
+
assert.equal(lexical.root.children[0].children[0].children[1].text, 'Hello');
|
|
303
|
+
});
|
|
304
|
+
test('Correctly converts a WordPress flavoured image', function () {
|
|
305
|
+
let post = {
|
|
306
|
+
title: 'Title',
|
|
307
|
+
slug: 'slug',
|
|
308
|
+
html: '<figure class="wp-block-image alignwide size-large"><img loading="lazy" width="1024" height="683" src="https://example.com/wp-content/uploads/2021/12/photo-1024x683.jpg" alt="" class="wp-image-9438"><figcaption>My awesome page</figcaption></figure>'
|
|
309
|
+
};
|
|
310
|
+
convertPost(post, false);
|
|
311
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
312
|
+
assert.equal(lexical.root.children[0].type, 'image');
|
|
313
|
+
assert.equal(lexical.root.children[0].src, 'https://example.com/wp-content/uploads/2021/12/photo-1024x683.jpg');
|
|
314
|
+
assert.equal(lexical.root.children[0].caption, 'My awesome page');
|
|
315
|
+
assert.equal(lexical.root.children[0].width, 1024);
|
|
316
|
+
assert.equal(lexical.root.children[0].height, 683);
|
|
317
|
+
});
|
|
318
|
+
test('Correctly converts a WordPress flavoured linked image', function () {
|
|
319
|
+
let post = {
|
|
320
|
+
title: 'Title',
|
|
321
|
+
slug: 'slug',
|
|
322
|
+
html: '<figure class="wp-block-image alignwide size-large"><a href="https://example.com/2021/12/13/compare/"><img loading="lazy" width="1024" height="683" src="https://example.com/wp-content/uploads/2021/12/photo-1024x683.jpg" alt="" class="wp-image-9438"></a><figcaption>My awesome page</figcaption></figure>'
|
|
323
|
+
};
|
|
324
|
+
convertPost(post, false);
|
|
325
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
326
|
+
assert.equal(lexical.root.children[0].type, 'image');
|
|
327
|
+
assert.equal(lexical.root.children[0].src, 'https://example.com/wp-content/uploads/2021/12/photo-1024x683.jpg');
|
|
328
|
+
assert.equal(lexical.root.children[0].caption, 'My awesome page');
|
|
329
|
+
assert.equal(lexical.root.children[0].width, 1024);
|
|
330
|
+
assert.equal(lexical.root.children[0].height, 683);
|
|
331
|
+
assert.equal(lexical.root.children[0].href, 'https://example.com/2021/12/13/compare/');
|
|
332
|
+
});
|
|
333
|
+
test('Converts a nested list', function () {
|
|
334
|
+
let post = {
|
|
335
|
+
title: 'Title',
|
|
336
|
+
slug: 'slug',
|
|
337
|
+
html: '\
|
|
338
|
+
<ul>\
|
|
339
|
+
<li>Lorem</li>\
|
|
340
|
+
<li>Ipsum\
|
|
341
|
+
<ol>\
|
|
342
|
+
<li>One</li>\
|
|
343
|
+
<li>Two</li>\
|
|
344
|
+
</ol>\
|
|
345
|
+
</li>\
|
|
346
|
+
</ul>'
|
|
347
|
+
};
|
|
348
|
+
convertPost(post, false);
|
|
349
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
350
|
+
assert.equal(lexical.root.children[0].children[0].type, 'listitem');
|
|
351
|
+
assert.equal(lexical.root.children[0].children[0].children[0].text, 'Lorem');
|
|
352
|
+
assert.equal(lexical.root.children[0].children[1].type, 'listitem');
|
|
353
|
+
assert.equal(lexical.root.children[0].children[1].children[0].text, 'Ipsum');
|
|
354
|
+
assert.equal(lexical.root.children[0].children[2].children[0].children[0].type, 'listitem');
|
|
355
|
+
assert.equal(lexical.root.children[0].children[2].children[0].children[0].children[0].text, 'One');
|
|
356
|
+
assert.equal(lexical.root.children[0].children[2].children[0].children[1].type, 'listitem');
|
|
357
|
+
assert.equal(lexical.root.children[0].children[2].children[0].children[1].children[0].text, 'Two');
|
|
358
|
+
});
|
|
359
|
+
test('Converts paywall card', function () {
|
|
360
|
+
let post = {
|
|
361
|
+
title: 'Title',
|
|
362
|
+
slug: 'slug',
|
|
363
|
+
html: '<p>Public content</p><!--members-only--><p>Premium content</p>'
|
|
364
|
+
};
|
|
365
|
+
convertPost(post, false);
|
|
366
|
+
const lexical = JSON.parse(post.lexical ? post.lexical : '');
|
|
367
|
+
assert.equal(lexical.root.children[0].children[0].type, 'extended-text');
|
|
368
|
+
assert.equal(lexical.root.children[0].children[0].text, 'Public content');
|
|
369
|
+
assert.equal(lexical.root.children[1].type, 'paywall');
|
|
370
|
+
assert.equal(lexical.root.children[2].children[0].type, 'extended-text');
|
|
371
|
+
assert.equal(lexical.root.children[2].children[0].text, 'Premium content');
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
//# sourceMappingURL=convert-post.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-post.test.js","sourceRoot":"","sources":["../../src/test/convert-post.test.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAGxC,IAAI,UAAU,GAAG;IACb,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC;AAOF,QAAQ,CAAC,eAAe,EAAE;IACtB,IAAI,CAAC,4BAA4B,EAAE;QAC/B,IAAI,IAAI,GAAgB;YACpB,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,0BAA0B;SACnC,CAAC;QAEF,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAEpC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAE7D,MAAM,CA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,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAE7D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACzE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAE1E,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAEvD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACzE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import assert from 'assert/strict';
|
|
2
|
+
import { makeTaskRunner } from '@tryghost/listr-smart-renderer';
|
|
3
|
+
import { convert } from '../index.js';
|
|
4
|
+
let fakeLogger = {
|
|
5
|
+
warn: () => { },
|
|
6
|
+
error: () => { },
|
|
7
|
+
debug: () => { }
|
|
8
|
+
};
|
|
9
|
+
class fakeLoggerClass {
|
|
10
|
+
#warnings;
|
|
11
|
+
#errors;
|
|
12
|
+
#debugs;
|
|
13
|
+
constructor() {
|
|
14
|
+
this.#warnings = [];
|
|
15
|
+
this.#errors = [];
|
|
16
|
+
this.#debugs = [];
|
|
17
|
+
}
|
|
18
|
+
warn(msg) {
|
|
19
|
+
this.#warnings.push(msg);
|
|
20
|
+
}
|
|
21
|
+
get warnings() {
|
|
22
|
+
return this.#warnings;
|
|
23
|
+
}
|
|
24
|
+
error(msg) {
|
|
25
|
+
this.#errors.push(msg);
|
|
26
|
+
}
|
|
27
|
+
get errors() {
|
|
28
|
+
return this.#errors;
|
|
29
|
+
}
|
|
30
|
+
debug(msg) {
|
|
31
|
+
this.#debugs.push(msg);
|
|
32
|
+
}
|
|
33
|
+
get debugs() {
|
|
34
|
+
return this.#debugs;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
describe('Convert', function () {
|
|
38
|
+
test('Can convert a list of posts', async function () {
|
|
39
|
+
const ctx = {
|
|
40
|
+
logger: fakeLogger,
|
|
41
|
+
options: {
|
|
42
|
+
fallBackHTMLCard: false
|
|
43
|
+
},
|
|
44
|
+
result: {
|
|
45
|
+
posts: [
|
|
46
|
+
{
|
|
47
|
+
title: 'Title 1',
|
|
48
|
+
slug: 'slug-1',
|
|
49
|
+
html: '<p>Content 1</p>'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: 'Title 2',
|
|
53
|
+
slug: 'slug-2',
|
|
54
|
+
html: '<p>Content 2</p>'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'Title 3',
|
|
58
|
+
slug: 'slug-3',
|
|
59
|
+
html: '<p>Content 3</p>'
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const tasks = convert(ctx, false);
|
|
65
|
+
const taskRunner = makeTaskRunner(tasks, {
|
|
66
|
+
renderer: 'silent'
|
|
67
|
+
});
|
|
68
|
+
await taskRunner.run();
|
|
69
|
+
assert.equal(ctx.result.posts.length, 3);
|
|
70
|
+
assert.deepEqual(Object.keys(ctx.result.posts[0]), ['title', 'slug', 'lexical']);
|
|
71
|
+
assert.deepEqual(ctx.result.posts[0].title, 'Title 1');
|
|
72
|
+
assert.deepEqual(ctx.result.posts[0].slug, 'slug-1');
|
|
73
|
+
assert.deepEqual(ctx.result.posts[0].lexical.startsWith('{"root":{"children"'), true);
|
|
74
|
+
assert.deepEqual(Object.keys(ctx.result.posts[1]), ['title', 'slug', 'lexical']);
|
|
75
|
+
assert.deepEqual(ctx.result.posts[1].title, 'Title 2');
|
|
76
|
+
assert.deepEqual(ctx.result.posts[1].slug, 'slug-2');
|
|
77
|
+
assert.deepEqual(ctx.result.posts[1].lexical.startsWith('{"root":{"children"'), true);
|
|
78
|
+
assert.deepEqual(Object.keys(ctx.result.posts[2]), ['title', 'slug', 'lexical']);
|
|
79
|
+
assert.deepEqual(ctx.result.posts[2].title, 'Title 3');
|
|
80
|
+
assert.deepEqual(ctx.result.posts[2].slug, 'slug-3');
|
|
81
|
+
assert.deepEqual(ctx.result.posts[2].lexical.startsWith('{"root":{"children"'), true);
|
|
82
|
+
});
|
|
83
|
+
test('Log warning if post failed to convert to HTML card', async function () {
|
|
84
|
+
let theFakeLogger = new fakeLoggerClass();
|
|
85
|
+
const ctx = {
|
|
86
|
+
logger: theFakeLogger,
|
|
87
|
+
options: {
|
|
88
|
+
fallBackHTMLCard: true
|
|
89
|
+
},
|
|
90
|
+
result: {
|
|
91
|
+
posts: [
|
|
92
|
+
{
|
|
93
|
+
title: 'Title 1',
|
|
94
|
+
slug: 'slug-1',
|
|
95
|
+
html: '<p>Content 1</p>'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
title: 'Title 2',
|
|
99
|
+
slug: 'slug-2'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
title: 'Title 3',
|
|
103
|
+
slug: 'slug-3',
|
|
104
|
+
html: '<p>Content 3</p>'
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const tasks = convert(ctx, false);
|
|
110
|
+
const taskRunner = makeTaskRunner(tasks, {
|
|
111
|
+
renderer: 'silent'
|
|
112
|
+
});
|
|
113
|
+
await taskRunner.run();
|
|
114
|
+
assert.deepEqual(Object.keys(ctx.result.posts[0]), ['title', 'slug', 'lexical']);
|
|
115
|
+
assert.deepEqual(Object.keys(ctx.result.posts[1]), ['title', 'slug']);
|
|
116
|
+
assert.deepEqual(Object.keys(ctx.result.posts[2]), ['title', 'slug', 'lexical']);
|
|
117
|
+
assert.deepEqual(theFakeLogger.warnings.length, 1);
|
|
118
|
+
assert.deepEqual(theFakeLogger.warnings[0].message, 'Unable to convert post HTMLCard "Title 2"');
|
|
119
|
+
});
|
|
120
|
+
test('Log warning if post failed to convert to Lexical', async function () {
|
|
121
|
+
let theFakeLogger = new fakeLoggerClass();
|
|
122
|
+
const ctx = {
|
|
123
|
+
logger: theFakeLogger,
|
|
124
|
+
options: {
|
|
125
|
+
fallBackHTMLCard: false
|
|
126
|
+
},
|
|
127
|
+
result: {
|
|
128
|
+
posts: [
|
|
129
|
+
{
|
|
130
|
+
title: 'Title 1',
|
|
131
|
+
slug: 'slug-1',
|
|
132
|
+
html: '<p>Content 1</p>'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
title: 'Title 2',
|
|
136
|
+
slug: 'slug-2'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
title: 'Title 3',
|
|
140
|
+
slug: 'slug-3',
|
|
141
|
+
html: '<p>Content 3</p>'
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const tasks = convert(ctx, false);
|
|
147
|
+
const taskRunner = makeTaskRunner(tasks, {
|
|
148
|
+
renderer: 'silent'
|
|
149
|
+
});
|
|
150
|
+
await taskRunner.run();
|
|
151
|
+
assert.deepEqual(Object.keys(ctx.result.posts[0]), ['title', 'slug', 'lexical']);
|
|
152
|
+
assert.deepEqual(Object.keys(ctx.result.posts[1]), ['title', 'slug']);
|
|
153
|
+
assert.deepEqual(Object.keys(ctx.result.posts[2]), ['title', 'slug', 'lexical']);
|
|
154
|
+
assert.deepEqual(theFakeLogger.warnings.length, 1);
|
|
155
|
+
assert.deepEqual(theFakeLogger.warnings[0].message, 'Unable to convert post to Lexical "Title 2"');
|
|
156
|
+
});
|
|
157
|
+
test('Finds posts in ctx.results.data.posts', async function () {
|
|
158
|
+
const ctx = {
|
|
159
|
+
logger: fakeLogger,
|
|
160
|
+
options: {
|
|
161
|
+
fallBackHTMLCard: false
|
|
162
|
+
},
|
|
163
|
+
result: {
|
|
164
|
+
data: {
|
|
165
|
+
posts: [
|
|
166
|
+
{
|
|
167
|
+
title: 'Title 1',
|
|
168
|
+
slug: 'slug-1',
|
|
169
|
+
html: '<p>Content 1</p>'
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const tasks = convert(ctx, false);
|
|
176
|
+
const taskRunner = makeTaskRunner(tasks, {
|
|
177
|
+
renderer: 'silent'
|
|
178
|
+
});
|
|
179
|
+
await taskRunner.run();
|
|
180
|
+
assert.equal(ctx.result.data.posts.length, 1);
|
|
181
|
+
});
|
|
182
|
+
test('Finds posts in ctx.db[0].data.posts', async function () {
|
|
183
|
+
const ctx = {
|
|
184
|
+
logger: fakeLogger,
|
|
185
|
+
options: {
|
|
186
|
+
fallBackHTMLCard: false
|
|
187
|
+
},
|
|
188
|
+
result: {
|
|
189
|
+
db: [
|
|
190
|
+
{
|
|
191
|
+
data: {
|
|
192
|
+
posts: [
|
|
193
|
+
{
|
|
194
|
+
title: 'Title 1',
|
|
195
|
+
slug: 'slug-1',
|
|
196
|
+
html: '<p>Content 1</p>'
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const tasks = convert(ctx, false);
|
|
205
|
+
const taskRunner = makeTaskRunner(tasks, {
|
|
206
|
+
renderer: 'silent'
|
|
207
|
+
});
|
|
208
|
+
await taskRunner.run();
|
|
209
|
+
assert.equal(ctx.result.db[0].data.posts.length, 1);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
//# sourceMappingURL=convert.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.test.js","sourceRoot":"","sources":["../../src/test/convert.test.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAEpC,IAAI,UAAU,GAAG;IACb,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAClB,CAAC;AAEF,MAAM,eAAe;IACjB,SAAS,CAAQ;IACjB,OAAO,CAAQ;IACf,OAAO,CAAQ;IAEf;QACI,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,GAAQ;QACT,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,GAAQ;QACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,GAAQ;QACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;C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ACH;oCACI,KAAK,EAAE,SAAS;oCAChB,IAAI,EAAE,QAAQ;oCACd,IAAI,EAAE,kBAAkB;iCAC3B;6BACJ;yBACJ;qBACJ;iBACJ;aACJ;SACJ,CAAC;QAEF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAElC,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,EAAE;YACrC,QAAQ,EAAE,QAAQ;SACrB,CAAC,CAAC;QAEH,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC;QAEvB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tryghost/mg-html-lexical",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-html-lexical",
|
|
5
|
+
"author": "Ghost Foundation",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "build/index.js",
|
|
9
|
+
"types": "build/types.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "echo \"Implement me!\"",
|
|
12
|
+
"build:watch": "tsc --watch --preserveWatchOutput --sourceMap",
|
|
13
|
+
"build": "rm -rf build && rm -rf tsconfig.tsbuildinfo && tsc --build --sourceMap",
|
|
14
|
+
"prepare": "yarn build",
|
|
15
|
+
"lint": "eslint src/ --ext .ts --cache",
|
|
16
|
+
"posttest": "yarn lint",
|
|
17
|
+
"test": "rm -rf build && yarn build --force && NODE_OPTIONS=--experimental-vm-modules c8 --src src --all --check-coverage --100 --reporter text --reporter cobertura jest build/test"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"build"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@tryghost/listr-smart-renderer": "0.5.12",
|
|
27
|
+
"@types/jest": "29.5.5",
|
|
28
|
+
"@types/sinon": "10.0.18",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "6.7.4",
|
|
30
|
+
"@typescript-eslint/parser": "6.7.4",
|
|
31
|
+
"c8": "8.0.1",
|
|
32
|
+
"eslint": "8.50.0",
|
|
33
|
+
"jest": "29.7.0",
|
|
34
|
+
"sinon": "16.1.0",
|
|
35
|
+
"typescript": "5.2.2"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@tryghost/errors": "1.2.26",
|
|
39
|
+
"@tryghost/kg-html-to-lexical": "0.1.14"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "87eac9f1a90b9e8935ce70d9459db6f8ffec6133"
|
|
42
|
+
}
|