@tryghost/mg-mailchimp-members 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 +85 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +6 -0
- package/build/index.js.map +1 -0
- package/build/lib/process.d.ts +16 -0
- package/build/lib/process.js +72 -0
- package/build/lib/process.js.map +1 -0
- package/build/test/process.test.d.ts +1 -0
- package/build/test/process.test.js +96 -0
- package/build/test/process.test.js.map +1 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013-2023 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,85 @@
|
|
|
1
|
+
# Migrate Mailchimp Members `csv` Export
|
|
2
|
+
|
|
3
|
+
Converts a Mailchimp members `csv` export and generates a `csv` 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-mailchimp-members --save`
|
|
17
|
+
|
|
18
|
+
or
|
|
19
|
+
|
|
20
|
+
`yarn add @tryghost/mg-mailchimp-members`
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
To run basic Mailchimp member migration, the required command is this:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
migrate mailchimp-members --pathToCsv /path/to/members.csv
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
A more complex command for a Mailchimp member migration looks like this:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
migrate mailchimp-members --pathToCsv /path/to/members.csv, /path/to/another-members.csv --addLabel 'Migrated' --includeUnsubscribed false --verbose true
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
It's possible to pass more options, in order to achieve a better migration file for Ghost:
|
|
38
|
+
|
|
39
|
+
- **`--pathToCsv`** (required)
|
|
40
|
+
- Path to members CSV file
|
|
41
|
+
- string - default: `null`
|
|
42
|
+
- **`--addLabel`**
|
|
43
|
+
- Label to add to all members
|
|
44
|
+
- string - default: `null`
|
|
45
|
+
- **`--includeUnsubscribed`**
|
|
46
|
+
- Include unsubscribed members in the migration, but set to not receive emails
|
|
47
|
+
- bool - default: `true`
|
|
48
|
+
- **`--cache`**
|
|
49
|
+
- Persist local cache after migration is complete (Only if `--zip` is `true`)
|
|
50
|
+
- bool - default: `true`
|
|
51
|
+
- **`-V` `--verbose`**
|
|
52
|
+
- Show verbose output
|
|
53
|
+
- bool - default: `false`
|
|
54
|
+
- **`--zip`**
|
|
55
|
+
- Create a zip file
|
|
56
|
+
- bool - default: `false`
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Develop
|
|
60
|
+
|
|
61
|
+
This is a mono repository, managed with [lerna](https://lerna.js.org).
|
|
62
|
+
|
|
63
|
+
Follow the instructions for the top-level repo.
|
|
64
|
+
1. `git clone` this repo & `cd` into it as usual
|
|
65
|
+
2. Run `yarn` to install top-level dependencies.
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Run
|
|
69
|
+
|
|
70
|
+
To run a local development copy, `cd` into this directory, and use `yarn dev` instead of `migrate` like so:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
yarn dev mailchimp-members <commands>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Test
|
|
78
|
+
|
|
79
|
+
- `yarn lint` run just eslint
|
|
80
|
+
- `yarn test` run lint and tests
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# Copyright & License
|
|
84
|
+
|
|
85
|
+
Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: (args: any, logger?: any) => Promise<{
|
|
2
|
+
email: string;
|
|
3
|
+
name: string | null;
|
|
4
|
+
note: string | null;
|
|
5
|
+
subscribed_to_emails: boolean;
|
|
6
|
+
stripe_customer_id: string | null;
|
|
7
|
+
complimentary_plan: boolean;
|
|
8
|
+
labels: string[];
|
|
9
|
+
created_at: Date;
|
|
10
|
+
}[]>;
|
|
11
|
+
export default _default;
|
package/build/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { processCsv } from './lib/process.js';
|
|
2
|
+
export default async (args, logger) => {
|
|
3
|
+
let result = await processCsv({ csvPath: args.csvPath, addLabel: args.addLabel, includeUnsubscribed: args.includeUnsubscribed });
|
|
4
|
+
return result;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE5C,eAAe,KAAK,EAAE,IAAS,EAAE,MAAY,EAAE,EAAE;IAC7C,IAAI,MAAM,GAAG,MAAM,UAAU,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAC,CAAC,CAAC;IAC/H,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type memberObject = {
|
|
2
|
+
email: string;
|
|
3
|
+
name: string | null;
|
|
4
|
+
note: string | null;
|
|
5
|
+
subscribed_to_emails: boolean;
|
|
6
|
+
stripe_customer_id: string | null;
|
|
7
|
+
complimentary_plan: boolean;
|
|
8
|
+
labels: string[];
|
|
9
|
+
created_at: Date;
|
|
10
|
+
};
|
|
11
|
+
declare const processCsv: ({ csvPath, addLabel, includeUnsubscribed }: {
|
|
12
|
+
csvPath: string | string[];
|
|
13
|
+
addLabel?: string | null | undefined;
|
|
14
|
+
includeUnsubscribed: boolean;
|
|
15
|
+
}) => Promise<memberObject[]>;
|
|
16
|
+
export { processCsv };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fsUtils from '@tryghost/mg-fs-utils';
|
|
2
|
+
const processData = async ({ csvPath, addLabel, includeUnsubscribed = true }) => {
|
|
3
|
+
const csvData = await fsUtils.csv.parseCSV(csvPath);
|
|
4
|
+
let theMembers = [];
|
|
5
|
+
csvData.forEach((member) => {
|
|
6
|
+
// Completely skip unsubscribed members
|
|
7
|
+
if (!includeUnsubscribed && member?.UNSUB_TIME) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const createdAt = new Date(member.created_at);
|
|
11
|
+
let newMember = {
|
|
12
|
+
email: member['Email Address'],
|
|
13
|
+
name: null,
|
|
14
|
+
note: null,
|
|
15
|
+
subscribed_to_emails: false,
|
|
16
|
+
stripe_customer_id: null,
|
|
17
|
+
complimentary_plan: false,
|
|
18
|
+
labels: [],
|
|
19
|
+
created_at: createdAt
|
|
20
|
+
};
|
|
21
|
+
if (member['First Name'] || member['Last Name']) {
|
|
22
|
+
let allNames = [];
|
|
23
|
+
if (member['First Name']) {
|
|
24
|
+
allNames.push(member['First Name'].trim());
|
|
25
|
+
}
|
|
26
|
+
if (member['Last Name']) {
|
|
27
|
+
allNames.push(member['Last Name'].trim());
|
|
28
|
+
}
|
|
29
|
+
newMember.name = allNames.join(' ');
|
|
30
|
+
}
|
|
31
|
+
if (addLabel) {
|
|
32
|
+
let labels = addLabel.replace(/"/g, '').split(',');
|
|
33
|
+
labels.forEach((label) => {
|
|
34
|
+
newMember.labels.push(label.trim());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (member?.TAGS) {
|
|
38
|
+
let tags = member.TAGS.replace(/"/g, '').split(',');
|
|
39
|
+
tags.forEach((tag) => {
|
|
40
|
+
newMember.labels.push(tag.trim());
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (member?.CONFIRM_TIME) {
|
|
44
|
+
newMember.created_at = new Date(member.CONFIRM_TIME);
|
|
45
|
+
}
|
|
46
|
+
if (member?.UNSUB_TIME) {
|
|
47
|
+
newMember.subscribed_to_emails = false;
|
|
48
|
+
newMember.labels.push(`mailchimp-unsubscribed`);
|
|
49
|
+
newMember.note = `Unsubscribed to emails on ${member.UNSUB_TIME}`;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
newMember.subscribed_to_emails = true;
|
|
53
|
+
}
|
|
54
|
+
theMembers.push(newMember);
|
|
55
|
+
});
|
|
56
|
+
return theMembers;
|
|
57
|
+
};
|
|
58
|
+
const processCsv = async ({ csvPath, addLabel, includeUnsubscribed = true }) => {
|
|
59
|
+
const newObj = [];
|
|
60
|
+
const paths = (typeof csvPath === 'string') ? [csvPath] : csvPath;
|
|
61
|
+
for (const list of paths) {
|
|
62
|
+
let processed = await processData({
|
|
63
|
+
csvPath: list,
|
|
64
|
+
addLabel,
|
|
65
|
+
includeUnsubscribed
|
|
66
|
+
});
|
|
67
|
+
newObj.push(...processed);
|
|
68
|
+
}
|
|
69
|
+
return newObj;
|
|
70
|
+
};
|
|
71
|
+
export { processCsv };
|
|
72
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/lib/process.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAa5C,MAAM,WAAW,GAAG,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,EAA4E,EAAE,EAAE;IACrJ,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEpD,IAAI,UAAU,GAAmB,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;QAC5B,uCAAuC;QACvC,IAAI,CAAC,mBAAmB,IAAI,MAAM,EAAE,UAAU,EAAE;YAC5C,OAAO;SACV;QAED,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,SAAS,GAAiB;YAC1B,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC;YAC9B,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,oBAAoB,EAAE,KAAK;YAC3B,kBAAkB,EAAE,IAAI;YACxB,kBAAkB,EAA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CAAC,YAAY,CAAC,CAAC;SACxD;QAED,IAAI,MAAM,EAAE,UAAU,EAAE;YACpB,SAAS,CAAC,oBAAoB,GAAG,KAAK,CAAC;YACvC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAChD,SAAS,CAAC,IAAI,GAAG,6BAA6B,MAAM,CAAC,UAAU,EAAE,CAAC;SACrE;aAAM;YACH,SAAS,CAAC,oBAAoB,GAAG,IAAI,CAAC;SACzC;QAED,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI,EAAuF,EAAE,EAAE;IAC/J,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,MAAM,KAAK,GAAa,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,SAAS,GAAQ,MAAM,WAAW,CAAC;YACnC,OAAO,EAAE,IAAI;YACb,QAAQ;YACR,mBAAmB;SACtB,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;KAC7B;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EACH,UAAU,EACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import processCsv from '../index.js';
|
|
4
|
+
const __dirname = new URL('.', import.meta.url).pathname;
|
|
5
|
+
const fixturesPath = join(__dirname, '../../src/test/fixtures');
|
|
6
|
+
describe('Mailchimp Members', () => {
|
|
7
|
+
it('Can parse single CSV', async () => {
|
|
8
|
+
const cleanedProcessed = await processCsv({
|
|
9
|
+
csvPath: join(fixturesPath, 'cleaned.csv')
|
|
10
|
+
});
|
|
11
|
+
assert.equal(cleanedProcessed.length, 5);
|
|
12
|
+
});
|
|
13
|
+
it('Can parse multiple CSVs', async () => {
|
|
14
|
+
const cleanedProcessed = await processCsv({
|
|
15
|
+
csvPath: [
|
|
16
|
+
join(fixturesPath, 'cleaned.csv'),
|
|
17
|
+
join(fixturesPath, 'subscribed.csv'),
|
|
18
|
+
join(fixturesPath, 'unsubscribed.csv')
|
|
19
|
+
]
|
|
20
|
+
});
|
|
21
|
+
assert.equal(cleanedProcessed.length, 15);
|
|
22
|
+
});
|
|
23
|
+
it('Can get subscribed member values', async () => {
|
|
24
|
+
const processed = await processCsv({
|
|
25
|
+
csvPath: join(fixturesPath, 'subscribed.csv')
|
|
26
|
+
});
|
|
27
|
+
const member = processed[4];
|
|
28
|
+
assert.equal(member.email, 's5@example.com');
|
|
29
|
+
assert.equal(member.name, 'Dolor Simet');
|
|
30
|
+
assert.equal(member.note, null);
|
|
31
|
+
assert.equal(member.subscribed_to_emails, true);
|
|
32
|
+
assert.equal(member.stripe_customer_id, null);
|
|
33
|
+
assert.equal(member.complimentary_plan, false);
|
|
34
|
+
assert.equal(member.labels.length, 1);
|
|
35
|
+
assert.equal(member.labels[0], 'Lorem Editors');
|
|
36
|
+
assert.deepEqual(member.created_at, new Date('2018-02-05T19:28:22.000Z'));
|
|
37
|
+
});
|
|
38
|
+
it('Can get unsubscribed member values', async () => {
|
|
39
|
+
const processed = await processCsv({
|
|
40
|
+
csvPath: join(fixturesPath, 'unsubscribed.csv')
|
|
41
|
+
});
|
|
42
|
+
const member = processed[2];
|
|
43
|
+
assert.equal(member.email, 'u3@example.com');
|
|
44
|
+
assert.equal(member.name, 'Lorem Ipsum');
|
|
45
|
+
assert.equal(member.note, 'Unsubscribed to emails on 2022-12-05 21:01:47');
|
|
46
|
+
assert.equal(member.subscribed_to_emails, false);
|
|
47
|
+
assert.equal(member.stripe_customer_id, null);
|
|
48
|
+
assert.equal(member.complimentary_plan, false);
|
|
49
|
+
assert.equal(member.labels.length, 2);
|
|
50
|
+
assert.equal(member.labels[0], 'Lorem Editors');
|
|
51
|
+
assert.equal(member.labels[1], 'mailchimp-unsubscribed');
|
|
52
|
+
assert.deepEqual(member.created_at, new Date('2020-12-25T13:35:34.000Z'));
|
|
53
|
+
});
|
|
54
|
+
it('Can count subscribed members', async () => {
|
|
55
|
+
const cleanedProcessed = await processCsv({
|
|
56
|
+
csvPath: [
|
|
57
|
+
join(fixturesPath, 'cleaned.csv'),
|
|
58
|
+
join(fixturesPath, 'subscribed.csv'),
|
|
59
|
+
join(fixturesPath, 'unsubscribed.csv')
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
const isSubscribed = cleanedProcessed.filter((member) => {
|
|
63
|
+
return member.subscribed_to_emails === true;
|
|
64
|
+
});
|
|
65
|
+
const notSubscribed = cleanedProcessed.filter((member) => {
|
|
66
|
+
return member.subscribed_to_emails === false;
|
|
67
|
+
});
|
|
68
|
+
assert.equal(isSubscribed.length, 10);
|
|
69
|
+
assert.equal(notSubscribed.length, 5);
|
|
70
|
+
assert.equal(notSubscribed[0].note, 'Unsubscribed to emails on 2018-07-23 12:19:27');
|
|
71
|
+
});
|
|
72
|
+
it('Can add member label', async () => {
|
|
73
|
+
const cleanedProcessed = await processCsv({
|
|
74
|
+
csvPath: join(fixturesPath, 'cleaned.csv'),
|
|
75
|
+
addLabel: 'Migrated Member, Old Site'
|
|
76
|
+
});
|
|
77
|
+
cleanedProcessed.forEach((member) => {
|
|
78
|
+
assert.equal(member.labels[0], 'Migrated Member');
|
|
79
|
+
assert.equal(member.labels[1], 'Old Site');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
it('Can exclude unsubscribed members', async () => {
|
|
83
|
+
const cleanedProcessed = await processCsv({
|
|
84
|
+
csvPath: [
|
|
85
|
+
join(fixturesPath, 'cleaned.csv'),
|
|
86
|
+
join(fixturesPath, 'subscribed.csv'),
|
|
87
|
+
join(fixturesPath, 'unsubscribed.csv')
|
|
88
|
+
],
|
|
89
|
+
includeUnsubscribed: false
|
|
90
|
+
});
|
|
91
|
+
cleanedProcessed.forEach((member) => {
|
|
92
|
+
assert.equal(member.subscribed_to_emails, true);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=process.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.test.js","sourceRoot":"","sources":["../../src/test/process.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AACzD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;AAEhE,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC;SAC7C,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC;YACtC,OAAO,EAAE;gBACL,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC;gBACjC,IAAI,CAAC,YAAY,EAA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ACjC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC;gBACpC,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC;aACzC;YACD,mBAAmB,EAAE,KAAK;SAC7B,CAAC,CAAC;QAEH,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAChC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tryghost/mg-mailchimp-members",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-mailchimp-members",
|
|
5
|
+
"author": "Ghost Foundation",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "build/index.js",
|
|
9
|
+
"types": "build/types.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "echo \"Implement me!\"",
|
|
12
|
+
"build:watch": "tsc --watch --preserveWatchOutput --sourceMap",
|
|
13
|
+
"build": "rm -rf build && rm -rf tsconfig.tsbuildinfo && tsc --build --sourceMap",
|
|
14
|
+
"prepare": "yarn build",
|
|
15
|
+
"lint": "eslint src/ --ext .ts --cache",
|
|
16
|
+
"posttest": "yarn lint",
|
|
17
|
+
"test": "rm -rf build && yarn build --force && NODE_OPTIONS=--experimental-vm-modules c8 --src src --all --check-coverage --100 --reporter text --reporter cobertura jest build/test"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"build"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/jest": "^29.5.3",
|
|
27
|
+
"@types/sinon": "^10.0.15",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
29
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
30
|
+
"c8": "8.0.1",
|
|
31
|
+
"eslint": "8.51.0",
|
|
32
|
+
"jest": "29.7.0",
|
|
33
|
+
"sinon": "^16.0.0",
|
|
34
|
+
"typescript": "5.2.2"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@tryghost/debug": "0.1.26",
|
|
38
|
+
"@tryghost/errors": "1.2.26",
|
|
39
|
+
"@tryghost/mg-fs-utils": "0.12.14"
|
|
40
|
+
},
|
|
41
|
+
"gitHead": "c865538e1d67fac4fc6f5b53fae5127d164365c8"
|
|
42
|
+
}
|