@tryghost/mg-linkfixer 0.5.9 → 0.5.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2022 Ghost Foundation
3
+ Copyright (c) 2013-2023 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -36,4 +36,4 @@ Follow the instructions for the top-level repo.
36
36
 
37
37
  # Copyright & License
38
38
 
39
- Copyright (c) 2013-2022 Ghost Foundation - Released under the [MIT license](LICENSE).
39
+ Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
package/lib/LinkFixer.js CHANGED
@@ -7,7 +7,7 @@ const htmlFields = ['html'];
7
7
 
8
8
  const isHTMLField = field => _.includes(htmlFields, field);
9
9
 
10
- class LinkFixer {
10
+ export default class LinkFixer {
11
11
  constructor() {
12
12
  this.linkMap = {};
13
13
  }
@@ -44,6 +44,11 @@ class LinkFixer {
44
44
 
45
45
  // @TODO: support for custom taxonomies
46
46
  ctx.result.posts.forEach(({url, data}) => {
47
+ // Exit if no url or is empty string
48
+ if (!url || url.length === 0) {
49
+ return;
50
+ }
51
+
47
52
  // Parse the current post URL, so we can use its domain as a fallback
48
53
  const postURLDomain = new URL(url);
49
54
 
@@ -163,5 +168,3 @@ class LinkFixer {
163
168
  return tasks;
164
169
  }
165
170
  }
166
-
167
- export default LinkFixer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-linkfixer",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-linkfixer",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  "type": "module",
9
9
  "scripts": {
10
10
  "dev": "echo \"Implement me!\"",
11
- "test": "node --experimental-vm-modules $(yarn bin jest)",
11
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
12
12
  "lint": "eslint . --ext .js --cache",
13
13
  "posttest": "yarn lint"
14
14
  },
@@ -20,15 +20,15 @@
20
20
  "access": "public"
21
21
  },
22
22
  "devDependencies": {
23
- "@tryghost/listr-smart-renderer": "^0.5.8",
24
- "eslint": "8.44.0",
25
- "jest": "29.5.0",
26
- "jest-extended": "3.2.4",
23
+ "@tryghost/listr-smart-renderer": "^0.5.10",
24
+ "eslint": "8.48.0",
25
+ "jest": "29.6.4",
26
+ "jest-extended": "4.0.1",
27
27
  "listr": "0.14.3"
28
28
  },
29
29
  "dependencies": {
30
30
  "cheerio": "1.0.0-rc.3",
31
31
  "lodash": "4.17.21"
32
32
  },
33
- "gitHead": "858b985d1e54eaf41b3a53dbccdc074b57246f9c"
33
+ "gitHead": "05dbefe144850acde9a05b7e25fc84dbf766be88"
34
34
  }