@tryghost/mg-chorus 0.1.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/LICENSE +21 -0
- package/README.md +95 -0
- package/index.js +10 -0
- package/lib/json-to-html.js +187 -0
- package/lib/processor.js +125 -0
- package/lib/read-zip.js +59 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013-2022 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,95 @@
|
|
|
1
|
+
# Migrate Chorus
|
|
2
|
+
|
|
3
|
+
Export content from Chorus using their exports, and generate a `zip` file you can import into a Ghost installation.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
To install the CLI, which is required for the Usage commands below:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install --global @tryghost/migrate
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
To use this package in your own project:
|
|
15
|
+
|
|
16
|
+
`npm install @tryghost/mg-chorus --save`
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
`yarn add @tryghost/mg-chorus`
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
To run a Ghost API migration, the required command is:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
migrate chorus --entries /path/to/file.zip --url http://example.com
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
It's possible to pass more options, in order to achieve a better migration file for Ghost:
|
|
33
|
+
|
|
34
|
+
- **`--entries`**
|
|
35
|
+
- array - default: `null`
|
|
36
|
+
- Path(s) to Chorus exports ZIPs
|
|
37
|
+
- **`--url`**
|
|
38
|
+
- string - default: `null`
|
|
39
|
+
- URL to live site
|
|
40
|
+
- **`--verbose`**
|
|
41
|
+
- bool - default: `false`
|
|
42
|
+
- Show verbose output
|
|
43
|
+
- **`--zip`**
|
|
44
|
+
- bool - default: `true`
|
|
45
|
+
- Create a zip file
|
|
46
|
+
- **`--scrape`**
|
|
47
|
+
- Configure scraping tasks
|
|
48
|
+
- string - default: `all`
|
|
49
|
+
- Choices: `all`, `web`, `none`
|
|
50
|
+
- **`--addPrimaryTag`**
|
|
51
|
+
- string - default: `null`
|
|
52
|
+
- Provide a tag name which should be added to every post as primary tag
|
|
53
|
+
- **`--fallBackHTMLCard`**
|
|
54
|
+
- bool - default: `true`
|
|
55
|
+
- Fall back to convert to HTMLCard, if standard Mobiledoc convert fails
|
|
56
|
+
- **`--cache`**
|
|
57
|
+
- Persist local cache after migration is complete (Only if `--zip` is `true`)
|
|
58
|
+
- bool - default: `true`
|
|
59
|
+
|
|
60
|
+
A more complex migration command could look like this:
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
migrate chorus --entries /path/to/file.zip, /path/to/other.zip --url http://example.com --addPrimaryTag News
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This will get all posts, apply the tag 'News'
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Develop
|
|
70
|
+
|
|
71
|
+
This is a mono repository, managed with [lerna](https://lerna.js.org).
|
|
72
|
+
|
|
73
|
+
Follow the instructions for the top-level repo.
|
|
74
|
+
1. `git clone` this repo & `cd` into it as usual
|
|
75
|
+
2. Run `yarn` to install top-level dependencies.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Run
|
|
79
|
+
|
|
80
|
+
To run a local development copy, `cd` into this directory, and use `yarn dev` instead of `migrate` like so:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
yarn dev chorus <API token>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## Test
|
|
88
|
+
|
|
89
|
+
- `yarn lint` run just eslint
|
|
90
|
+
- `yarn test` run lint and tests
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# Copyright & License
|
|
94
|
+
|
|
95
|
+
Copyright (c) 2013-2022 Ghost Foundation - Released under the [MIT license](LICENSE).
|
package/index.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
const EntryBodyList = (block) => {
|
|
2
|
+
let html = [];
|
|
3
|
+
html.push((block.ordered) ? '<ol>' : '<ul>');
|
|
4
|
+
block.items.forEach((item) => {
|
|
5
|
+
html.push(`<li>${item.line.html}</li>`);
|
|
6
|
+
});
|
|
7
|
+
html.push((block.ordered) ? '</ol>' : '/<ul>');
|
|
8
|
+
return html.join('');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const EntryBodyParagraph = (block) => {
|
|
12
|
+
let html = [];
|
|
13
|
+
html.push(`<p>${block.contents.html}</p>`);
|
|
14
|
+
return html.join('');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const EntryBodyEmbed = (block) => {
|
|
18
|
+
let html = [];
|
|
19
|
+
html.push(`<!--kg-card-begin: html-->${block.embed.embedHtml}<!--kg-card-end: html-->`);
|
|
20
|
+
return html.join('');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const EntryBodyHeading = (block) => {
|
|
24
|
+
let html = [];
|
|
25
|
+
|
|
26
|
+
html.push(`<h${block.level}>`);
|
|
27
|
+
html.push(block.contents.html.replace(/<strong>|<\/strong>|<b>|<\/b>/, '')); // Remove bold tags form header, leave italics alone
|
|
28
|
+
html.push(`</h${block.level}>`);
|
|
29
|
+
|
|
30
|
+
return html.join('');
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const EntryBodyHTML = (block) => {
|
|
34
|
+
let html = [];
|
|
35
|
+
html.push(`<!--kg-card-begin: html-->${block.rawHtml}<!--kg-card-end: html-->`);
|
|
36
|
+
return html.join('');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const EntryBodyPoll = (block) => {
|
|
40
|
+
let html = [];
|
|
41
|
+
if (block?.poll?.title) {
|
|
42
|
+
html.push(`<h3>${block.poll.title}</h3>`);
|
|
43
|
+
}
|
|
44
|
+
html.push(`<!--kg-card-begin: html-->`);
|
|
45
|
+
html.push('<table>');
|
|
46
|
+
html.push('<tbody>');
|
|
47
|
+
block.poll.options.forEach((row) => {
|
|
48
|
+
html.push(`<tr>`);
|
|
49
|
+
html.push(`<td>${row.label}</td>`);
|
|
50
|
+
html.push(`<td>${row.votes}</td>`);
|
|
51
|
+
html.push(`</tr>`);
|
|
52
|
+
});
|
|
53
|
+
html.push('</tbody>');
|
|
54
|
+
html.push('</table>');
|
|
55
|
+
html.push(`<!--kg-card-end: html-->`);
|
|
56
|
+
return html.join('');
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const EntryBodyPullquote = (block) => {
|
|
60
|
+
let html = [];
|
|
61
|
+
html.push(`<blockquote class="kg-blockquote-alt">${block.quote.html}</blockquote>`);
|
|
62
|
+
return html.join('');
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const EntryBodyTable = (block) => {
|
|
66
|
+
let html = [];
|
|
67
|
+
if (block?.table?.title) {
|
|
68
|
+
html.push(`<h3>${block.table.title}</h3>`);
|
|
69
|
+
}
|
|
70
|
+
html.push(`<!--kg-card-begin: html-->`);
|
|
71
|
+
html.push('<table>');
|
|
72
|
+
html.push('<thead>');
|
|
73
|
+
block.table.columns.forEach((col) => {
|
|
74
|
+
html.push(`<th>${col}</th>`);
|
|
75
|
+
});
|
|
76
|
+
html.push('</thead>');
|
|
77
|
+
html.push('<tbody>');
|
|
78
|
+
block.table.rows.forEach((row) => {
|
|
79
|
+
html.push(`<tr>`);
|
|
80
|
+
row.forEach((cell) => {
|
|
81
|
+
html.push(`<td>${cell}</td>`);
|
|
82
|
+
});
|
|
83
|
+
html.push(`</tr>`);
|
|
84
|
+
});
|
|
85
|
+
html.push('</tbody>');
|
|
86
|
+
html.push('</table>');
|
|
87
|
+
html.push(`<!--kg-card-end: html-->`);
|
|
88
|
+
return html.join('');
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const EntryBodyBlockquote = (block) => {
|
|
92
|
+
let html = [];
|
|
93
|
+
html.push('<blockuote>');
|
|
94
|
+
block.paragraphs.forEach((paragraph) => {
|
|
95
|
+
html.push(`<p>${paragraph.contents.html}</p>`);
|
|
96
|
+
});
|
|
97
|
+
html.push('</blockuote>');
|
|
98
|
+
return html.join('');
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const EntryBodyHorizontalRule = () => {
|
|
102
|
+
let html = [];
|
|
103
|
+
html.push('<hr>');
|
|
104
|
+
return html.join('');
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const EntryBodyRelatedList = (block) => {
|
|
108
|
+
let html = [];
|
|
109
|
+
html.push('<hr>');
|
|
110
|
+
html.push('<h4>Related</h4>');
|
|
111
|
+
html.push('<p>');
|
|
112
|
+
block.items.forEach((item, indexIndex) => {
|
|
113
|
+
html.push(`${indexIndex !== 0 ? '<br>' : ''}<a href="${item.url}">${item.title}</a>`);
|
|
114
|
+
});
|
|
115
|
+
html.push('</p>');
|
|
116
|
+
html.push('<hr>');
|
|
117
|
+
return html.join('');
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const jsonToHtml = (blocks) => {
|
|
121
|
+
let html = [];
|
|
122
|
+
|
|
123
|
+
blocks.forEach((block) => {
|
|
124
|
+
const itemType = block.__typename;
|
|
125
|
+
|
|
126
|
+
switch (itemType) {
|
|
127
|
+
case 'EntryBodyParagraph':
|
|
128
|
+
html.push(EntryBodyParagraph(block));
|
|
129
|
+
break;
|
|
130
|
+
case 'EntryBodyEmbed':
|
|
131
|
+
html.push(EntryBodyEmbed(block));
|
|
132
|
+
break;
|
|
133
|
+
case 'EntryBodyList':
|
|
134
|
+
html.push(EntryBodyList(block));
|
|
135
|
+
break;
|
|
136
|
+
case 'EntryBodyHeading':
|
|
137
|
+
html.push(EntryBodyHeading(block));
|
|
138
|
+
break;
|
|
139
|
+
case 'EntryBodyHTML':
|
|
140
|
+
html.push(EntryBodyHTML(block));
|
|
141
|
+
break;
|
|
142
|
+
case 'EntryBodyPoll':
|
|
143
|
+
html.push(EntryBodyPoll(block));
|
|
144
|
+
break;
|
|
145
|
+
case 'EntryBodyPullquote':
|
|
146
|
+
html.push(EntryBodyPullquote(block));
|
|
147
|
+
break;
|
|
148
|
+
case 'EntryBodyTable':
|
|
149
|
+
html.push(EntryBodyTable(block));
|
|
150
|
+
break;
|
|
151
|
+
case 'EntryBodyBlockquote':
|
|
152
|
+
html.push(EntryBodyBlockquote(block));
|
|
153
|
+
break;
|
|
154
|
+
case 'EntryBodyHorizontalRule':
|
|
155
|
+
html.push(EntryBodyHorizontalRule());
|
|
156
|
+
break;
|
|
157
|
+
case 'EntryBodyRelatedList':
|
|
158
|
+
html.push(EntryBodyRelatedList(block));
|
|
159
|
+
break;
|
|
160
|
+
case 'EntryBodySidebar':
|
|
161
|
+
case 'EntryBodyImage':
|
|
162
|
+
case 'EntryBodyGallery':
|
|
163
|
+
// Not used
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
// console.log(`Unhandled type: ${itemType}`);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
return html.join('');
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export default jsonToHtml;
|
|
174
|
+
|
|
175
|
+
export {
|
|
176
|
+
EntryBodyList,
|
|
177
|
+
EntryBodyParagraph,
|
|
178
|
+
EntryBodyEmbed,
|
|
179
|
+
EntryBodyHeading,
|
|
180
|
+
EntryBodyHTML,
|
|
181
|
+
EntryBodyPoll,
|
|
182
|
+
EntryBodyPullquote,
|
|
183
|
+
EntryBodyTable,
|
|
184
|
+
EntryBodyBlockquote,
|
|
185
|
+
EntryBodyHorizontalRule,
|
|
186
|
+
EntryBodyRelatedList
|
|
187
|
+
};
|
package/lib/processor.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {slugify} from '@tryghost/string';
|
|
2
|
+
import {_base as debugFactory} from '@tryghost/debug';
|
|
3
|
+
import jsonToHtml from './json-to-html.js';
|
|
4
|
+
|
|
5
|
+
const debug = debugFactory('migrate:chorus:processor');
|
|
6
|
+
|
|
7
|
+
const processContent = (groups) => {
|
|
8
|
+
if (!groups) {
|
|
9
|
+
debug(`Post has no content`);
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return jsonToHtml(groups);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const processPost = (data, options) => {
|
|
17
|
+
const {addPrimaryTag} = options;
|
|
18
|
+
|
|
19
|
+
const postUrl = data.source.url;
|
|
20
|
+
const postSlug = data.source.url.match(/([a-zA-Z0-9-_]+)$/)[1];
|
|
21
|
+
|
|
22
|
+
const post = {
|
|
23
|
+
url: postUrl,
|
|
24
|
+
data: {
|
|
25
|
+
slug: postSlug,
|
|
26
|
+
title: data?.source?.title || '(Untitled)',
|
|
27
|
+
custom_excerpt: data?.source?.dek?.html || null,
|
|
28
|
+
status: 'published',
|
|
29
|
+
created_at: data.source.createdAt,
|
|
30
|
+
updated_at: data.source.updatedAt,
|
|
31
|
+
published_at: data.source.createdAt,
|
|
32
|
+
tags: [],
|
|
33
|
+
authors: []
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (data?.source?.authorProfile?.name) {
|
|
38
|
+
let authorSlug = slugify(data.source.authorProfile.name);
|
|
39
|
+
let authorObject = {
|
|
40
|
+
url: `/author/${authorSlug}`,
|
|
41
|
+
data: {
|
|
42
|
+
email: `${authorSlug}@example.com`,
|
|
43
|
+
slug: authorSlug,
|
|
44
|
+
name: data.source.authorProfile.name
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
post.data.authors.push(authorObject);
|
|
48
|
+
debug(`Adding author to ${data.slug} post object`, authorObject);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (data?.source?.contributors) {
|
|
52
|
+
data?.source?.contributors.forEach((contributor) => {
|
|
53
|
+
let authorSlug = slugify(contributor.fullOrUserName);
|
|
54
|
+
let authorObject = {
|
|
55
|
+
url: `/author/${authorSlug}`,
|
|
56
|
+
data: {
|
|
57
|
+
email: `${authorSlug}@example.com`,
|
|
58
|
+
slug: authorSlug,
|
|
59
|
+
name: contributor.fullOrUserName
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
post.data.authors.push(authorObject);
|
|
63
|
+
debug(`Adding contributor to ${data.slug} post object`, authorObject);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (addPrimaryTag) {
|
|
68
|
+
let tagObject = {
|
|
69
|
+
url: `/tag/${slugify(addPrimaryTag)}`,
|
|
70
|
+
data: {
|
|
71
|
+
slug: slugify(addPrimaryTag),
|
|
72
|
+
name: addPrimaryTag
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
post.data.tags.push(tagObject);
|
|
76
|
+
debug(`Adding supplied primary tag to ${data.slug} post object`, tagObject);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (data?.source?.communityGroups) {
|
|
80
|
+
data.source.communityGroups.forEach((tag) => {
|
|
81
|
+
let tagSlug = slugify(tag.name);
|
|
82
|
+
let tagObject = {
|
|
83
|
+
url: `migrator-added-tag-${tagSlug}`,
|
|
84
|
+
data: {
|
|
85
|
+
slug: tagSlug,
|
|
86
|
+
name: tag.name
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
post.data.tags.push(tagObject);
|
|
90
|
+
debug(`Adding tag to ${data.slug} post object`, tagObject);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
post.data.tags.push({
|
|
95
|
+
url: `migrator-added-tag-hash-chorus`,
|
|
96
|
+
data: {
|
|
97
|
+
slug: 'hash-chorus',
|
|
98
|
+
name: '#chorus'
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Some HTML content needs to be modified so that our parser plugins can interpret it
|
|
103
|
+
post.data.html = processContent(data.source.body.components, options);
|
|
104
|
+
|
|
105
|
+
return post;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const processPosts = (posts, options) => {
|
|
109
|
+
return posts.map(post => processPost(post, options));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const all = ({result, options}) => {
|
|
113
|
+
const output = {
|
|
114
|
+
posts: processPosts(result.posts, options)
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return output;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export default {
|
|
121
|
+
processContent,
|
|
122
|
+
processPost,
|
|
123
|
+
processPosts,
|
|
124
|
+
all
|
|
125
|
+
};
|
package/lib/read-zip.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import fsUtils from '@tryghost/mg-fs-utils';
|
|
2
|
+
import {_base as debugFactory} from '@tryghost/debug';
|
|
3
|
+
|
|
4
|
+
const debug = debugFactory('migrate:chorus:lib:read-zip');
|
|
5
|
+
|
|
6
|
+
const readChorusZip = ({content, entries, options, skippedFileCount}) => {
|
|
7
|
+
fsUtils.zip.read(entries, (entryName, zipEntry) => {
|
|
8
|
+
// Catch all JSON files
|
|
9
|
+
if (/^Entry:.*\.json$/.test(entryName)) {
|
|
10
|
+
content.posts.push({
|
|
11
|
+
name: entryName,
|
|
12
|
+
source: JSON.parse(zipEntry.getData().toString('utf8'))
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// Skip if not matched above, and report skipped files if `--verbose`
|
|
16
|
+
} else {
|
|
17
|
+
if (options.verbose) {
|
|
18
|
+
debug(`Skipped: ${entryName}`);
|
|
19
|
+
}
|
|
20
|
+
skippedFileCount += 1;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
content,
|
|
26
|
+
skippedFileCount
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default (entries, options) => {
|
|
31
|
+
let content = {
|
|
32
|
+
posts: []
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
let skippedFileCount = 0;
|
|
36
|
+
|
|
37
|
+
// We only support the current Chorus export file structure:
|
|
38
|
+
// - entries.csv
|
|
39
|
+
// - Entry:0969db64-b8d7-11ed-afa1-0242ac120001.json
|
|
40
|
+
// - Entry:0969db64-b8d7-11ed-afa1-0242ac120002.json
|
|
41
|
+
|
|
42
|
+
const ifIsArray = Array.isArray(entries);
|
|
43
|
+
|
|
44
|
+
if (ifIsArray && entries.length > 1) {
|
|
45
|
+
entries.forEach((file) => {
|
|
46
|
+
const zipContent = readChorusZip({content, entries: file, options, skippedFileCount});
|
|
47
|
+
content = zipContent.content;
|
|
48
|
+
skippedFileCount = zipContent.skippedFileCount;
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
const zipContent = readChorusZip({content, entries: entries[0], options, skippedFileCount});
|
|
52
|
+
content = zipContent.content;
|
|
53
|
+
skippedFileCount = zipContent.skippedFileCount;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
debug(`Skipped files: ${skippedFileCount}`);
|
|
57
|
+
|
|
58
|
+
return content;
|
|
59
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tryghost/mg-chorus",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-chorus",
|
|
5
|
+
"author": "Ghost Foundation",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "echo \"Implement me!\"",
|
|
11
|
+
"test": "node --experimental-vm-modules $(yarn bin jest)",
|
|
12
|
+
"lint": "eslint . --ext .js --cache",
|
|
13
|
+
"posttest": "yarn lint"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.js",
|
|
17
|
+
"lib"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"eslint": "8.35.0",
|
|
24
|
+
"jest": "29.4.3",
|
|
25
|
+
"jest-extended": "3.2.4"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@tryghost/debug": "0.1.21",
|
|
29
|
+
"@tryghost/errors": "1.2.20",
|
|
30
|
+
"@tryghost/string": "^0.2.0"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "5425b18d5b6ffb6f0f7dc9d13a5c0341c6937945"
|
|
33
|
+
}
|