@tryghost/mg-json 0.19.3 → 0.21.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.
@@ -19,7 +19,8 @@ const {startCase, kebabCase} = stringUtils;
19
19
  */
20
20
  const fakeName = 'Example User';
21
21
  const fakeEmailDomain = `example.com`;
22
- const fakeEmail = (nameSlug, domain) => `${nameSlug}@${domain}`;
22
+ // The local part (before the @) must be 50 chars or fewer to pass Ghost's email validation
23
+ const fakeEmail = (nameSlug, domain) => `${nameSlug.slice(0, 50).replace(/-+$/, '')}@${domain}`;
23
24
 
24
25
  const hydrateUser = (input, options) => {
25
26
  // Handle the case where we have a slug but no name
@@ -68,7 +68,8 @@ export default async (json) => {
68
68
  }
69
69
 
70
70
  if (!isEmailValid) {
71
- item.data.email = `${slugify(item?.data?.slug || item?.data?.name || 'author')}@example.com`;
71
+ // The local part (before the @) must be 50 chars or fewer to pass Ghost's email validation
72
+ item.data.email = `${slugify(item?.data?.slug || item?.data?.name || 'author').slice(0, 50).replace(/-+$/, '')}@example.com`;
72
73
  }
73
74
 
74
75
  json.users[index] = item;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-json",
3
- "version": "0.19.3",
3
+ "version": "0.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TryGhost/migrate.git",
@@ -25,7 +25,7 @@
25
25
  "bson-objectid": "2.0.4",
26
26
  "html-entities": "2.6.0",
27
27
  "node-email-verifier": "4.0.0",
28
- "@tryghost/mg-utils": "0.8.3"
28
+ "@tryghost/mg-utils": "0.10.0"
29
29
  },
30
30
  "scripts": {
31
31
  "dev": "echo \"Implement me!\"",