@tryghost/mg-json 0.11.13 → 0.13.0
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
CHANGED
|
@@ -16,7 +16,7 @@ or
|
|
|
16
16
|
|
|
17
17
|
## Develop
|
|
18
18
|
|
|
19
|
-
This is a mono repository, managed with [
|
|
19
|
+
This is a mono repository, managed with [Nx](https://nx.dev/) and yarn workspaces.
|
|
20
20
|
|
|
21
21
|
Follow the instructions for the top-level repo.
|
|
22
22
|
1. `git clone` this repo & `cd` into it as usual
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import baseTemplate from './base-template.js';
|
|
2
|
-
import stripMeta from './meta-to-ghost.js';
|
|
2
|
+
import stripMeta, {resetSlugs} from './meta-to-ghost.js';
|
|
3
3
|
import processPostRelations from './process-post-relations.js';
|
|
4
4
|
import validate from './validate.js';
|
|
5
5
|
import reorderTags from './reorder-tags.js';
|
|
6
6
|
import {removeEmptyUsers} from './remove-empty.js';
|
|
7
7
|
|
|
8
8
|
export default async (input, options = {}, ctx) => {
|
|
9
|
+
// Reset module-level slug deduplication state so each call is independent
|
|
10
|
+
resetSlugs();
|
|
11
|
+
|
|
9
12
|
// Construct a basic Ghost JSON template
|
|
10
13
|
let output = baseTemplate();
|
|
11
14
|
|
|
@@ -23,6 +23,10 @@ const removeMeta = (resource) => {
|
|
|
23
23
|
|
|
24
24
|
let slugs = {};
|
|
25
25
|
|
|
26
|
+
export const resetSlugs = () => {
|
|
27
|
+
slugs = {};
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
// Ghost's post/tag slug max length (MySQL utf8mb4 index limit)
|
|
27
31
|
const GHOST_SLUG_MAX = 191;
|
|
28
32
|
const DEDUP_SUFFIX_LENGTH = 25; // '-' + 24-char ObjectID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-json",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-json",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "echo \"Implement me!\"",
|
|
11
|
-
"test": "
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"test": "node --test 'test/**/*.test.js'",
|
|
12
|
+
"posttest": "yarn lint",
|
|
13
|
+
"lint": "eslint . --ext .js --cache"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"index.js",
|
|
@@ -20,16 +20,13 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"eslint": "8.57.
|
|
24
|
-
"jest": "30.2.0",
|
|
25
|
-
"jest-extended": "7.0.0"
|
|
23
|
+
"eslint": "8.57.1"
|
|
26
24
|
},
|
|
27
25
|
"dependencies": {
|
|
28
|
-
"@tryghost/string": "0.
|
|
26
|
+
"@tryghost/string": "0.3.1",
|
|
29
27
|
"bson-objectid": "2.0.4",
|
|
30
28
|
"html-entities": "2.6.0",
|
|
31
29
|
"lodash": "4.17.23",
|
|
32
30
|
"node-email-verifier": "4.0.0"
|
|
33
|
-
}
|
|
34
|
-
"gitHead": "ac9a868976ef5963df7fc2426af9e298bd5d8666"
|
|
31
|
+
}
|
|
35
32
|
}
|