@tryghost/mg-tinynews-members 0.10.1 → 0.10.3

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
@@ -58,8 +58,8 @@ pnpm dev tinynews-members --pathToFile /path/to/emails.csv
58
58
 
59
59
  ## Test
60
60
 
61
- - `pnpm lint` run just eslint
62
- - `pnpm test` run lint and tests
61
+ - `pnpm test` runs the package tests
62
+ - Linting and formatting are run from the repo root (`pnpm lint`, `pnpm format`)
63
63
 
64
64
 
65
65
  # Copyright & License
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import parse from './lib/parse-members-csv.js';
2
2
  import process from './lib/process.js';
3
3
 
4
- export default async (ctx) => {
4
+ export default async ctx => {
5
5
  const parsed = await parse(ctx);
6
6
  const normalized = await process(parsed, ctx);
7
7
 
@@ -2,7 +2,7 @@ import fsUtils from '@tryghost/mg-fs-utils';
2
2
 
3
3
  const parseCSV = fsUtils.csv.parseCSV;
4
4
 
5
- export default async (ctx) => {
5
+ export default async ctx => {
6
6
  const {options} = ctx;
7
7
 
8
8
  let parsed = await parseCSV(options.pathToFile);
package/lib/process.js CHANGED
@@ -9,7 +9,7 @@ const colMapper = (opts, obj) => {
9
9
 
10
10
  let useThis;
11
11
 
12
- opts.forEach((opt) => {
12
+ opts.forEach(opt => {
13
13
  if (keys.includes(opt)) {
14
14
  useThis = obj[opt];
15
15
  }
@@ -18,7 +18,7 @@ const colMapper = (opts, obj) => {
18
18
  return useThis;
19
19
  };
20
20
 
21
- const processMember = (tMember) => {
21
+ const processMember = tMember => {
22
22
  const email = colMapper(emailFields, tMember);
23
23
  const firstName = colMapper(firstNameFields, tMember);
24
24
  const lastName = colMapper(lastNameFields, tMember);
@@ -27,7 +27,10 @@ const processMember = (tMember) => {
27
27
 
28
28
  let member = {
29
29
  email: email,
30
- name: [firstName, lastName].map(e => e.trim()).join(' ').trim(),
30
+ name: [firstName, lastName]
31
+ .map(e => e.trim())
32
+ .join(' ')
33
+ .trim(),
31
34
  complimentary_plan: false,
32
35
  created_at: new Date(createdAt).toISOString(), // Given values are UTC
33
36
  labels: ['tinynews'],
@@ -35,7 +38,12 @@ const processMember = (tMember) => {
35
38
  };
36
39
 
37
40
  if (tMember?.Tags) {
38
- member.labels = member.labels.concat(tMember.Tags.replace(/\|/gm, ',').split(',').filter(e => e).map(e => e.trim()));
41
+ member.labels = member.labels.concat(
42
+ tMember.Tags.replace(/\|/gm, ',')
43
+ .split(',')
44
+ .filter(e => e)
45
+ .map(e => e.trim())
46
+ );
39
47
  }
40
48
 
41
49
  if (status === 'Subscribed' || status === '1' || status === 1 || status === '2' || status === 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-tinynews-members",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TryGhost/migrate.git",
@@ -17,16 +17,12 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
- "devDependencies": {
21
- "eslint": "8.57.1"
22
- },
20
+ "devDependencies": {},
23
21
  "dependencies": {
24
- "@tryghost/mg-fs-utils": "0.26.1"
22
+ "@tryghost/mg-fs-utils": "0.26.3"
25
23
  },
26
24
  "scripts": {
27
25
  "dev": "echo \"Implement me!\"",
28
- "test": "TZ=utc node --test 'test/**/*.test.js'",
29
- "posttest": "pnpm lint",
30
- "lint": "eslint . --ext .js --cache"
26
+ "test": "TZ=utc node --test 'test/**/*.test.js'"
31
27
  }
32
28
  }