Skip to content

Commit 034ae38

Browse files
committed
fix lint and typo
1 parent 9ae5780 commit 034ae38

File tree

3 files changed

+52
-55
lines changed

3 files changed

+52
-55
lines changed

demo/index.js

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Demo script to send an email using the Mailgun API.
44
* ==============================================================
55
* Instructions:
6-
*
6+
*
77
* 1. Create a file `mailgun.json` in the root directory with the
88
* following keys to configure the test script:
99
* ```
@@ -15,7 +15,7 @@
1515
* recipient: "xxx", // The email recipient.
1616
* }
1717
* ```
18-
*
18+
*
1919
* 2. Run this script with `node ./demo` to send the email.
2020
* ==============================================================
2121
*/
@@ -26,55 +26,54 @@ const mailgun = require('mailgun.js');
2626
const path = require('path');
2727

2828
const {
29-
key,
30-
domain,
31-
host,
32-
sender,
33-
recipient
29+
key,
30+
domain,
31+
sender,
32+
recipient
3433
} = require('./mailgun.json');
3534

3635
const mailgunClient = mailgun.client({ username: 'api', key: key });
3736
const filePath = (file) => path.resolve(__dirname, '../spec/templates/', file);
3837
const config = {
39-
sender: sender,
40-
templates: {
41-
passwordResetEmail: {
42-
subjectPath: filePath('password_reset_email_subject.txt'),
43-
textPath: filePath('password_reset_email.txt'),
44-
htmlPath: filePath('password_reset_email.html')
45-
},
46-
verificationEmail: {
47-
subjectPath: filePath('verification_email_subject.txt'),
48-
textPath: filePath('verification_email.txt'),
49-
htmlPath: filePath('verification_email.html')
50-
},
51-
customEmail: {
52-
subjectPath: filePath('custom_email_subject.txt'),
53-
textPath: filePath('custom_email.txt'),
54-
htmlPath: filePath('custom_email.html'),
55-
placeholders: {
56-
username: "DefaultUser",
57-
appName: "DefaultApp"
58-
},
59-
extra: {
60-
replyTo: '[email protected]'
61-
}
62-
}
38+
sender: sender,
39+
templates: {
40+
passwordResetEmail: {
41+
subjectPath: filePath('password_reset_email_subject.txt'),
42+
textPath: filePath('password_reset_email.txt'),
43+
htmlPath: filePath('password_reset_email.html')
6344
},
64-
apiCallback: async ({ payload }) => {
65-
const mailgunPayload = ApiPayloadConverter.mailgun(payload);
66-
await mailgunClient.messages.create(domain, mailgunPayload);
45+
verificationEmail: {
46+
subjectPath: filePath('verification_email_subject.txt'),
47+
textPath: filePath('verification_email.txt'),
48+
htmlPath: filePath('verification_email.html')
49+
},
50+
customEmail: {
51+
subjectPath: filePath('custom_email_subject.txt'),
52+
textPath: filePath('custom_email.txt'),
53+
htmlPath: filePath('custom_email.html'),
54+
placeholders: {
55+
username: "DefaultUser",
56+
appName: "DefaultApp"
57+
},
58+
extra: {
59+
replyTo: '[email protected]'
60+
}
6761
}
62+
},
63+
apiCallback: async ({ payload }) => {
64+
const mailgunPayload = ApiPayloadConverter.mailgun(payload);
65+
await mailgunClient.messages.create(domain, mailgunPayload);
66+
}
6867
};
6968

7069
const adapter = new ApiMailAdapter(config);
7170

7271
adapter.sendMail({
73-
templateName: 'customEmail',
74-
recipient: recipient,
75-
placeholders: {
76-
appName: "ExampleApp",
77-
username: "ExampleUser"
78-
},
79-
direct: true
80-
});
72+
templateName: 'customEmail',
73+
recipient: recipient,
74+
placeholders: {
75+
appName: "ExampleApp",
76+
username: "ExampleUser"
77+
},
78+
direct: true
79+
});

package.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
"version": "1.0.4",
44
"description": "API Mail Adapter for Parse Server",
55
"main": "./lib/index.js",
6-
"scripts": {
7-
"build:watch": "babel src --out-dir lib --source-maps --watch",
8-
"build": "babel src --out-dir lib --source-maps",
9-
"lint:src": "eslint 'src/**/*.js'",
10-
"lint:test": "eslint 'spec/**/*.js'",
11-
"lint:fix": "eslint 'src/**/*.js' --fix && eslint 'spec/**/*.js' --fix",
12-
"lint": "npm run lint:src && npm run lint:test",
13-
"test": "nyc --reporter=lcov jasmine",
14-
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json",
15-
"prepare": "npm run build && npm test",
16-
"demo": "node ./demo"
17-
},
186
"repository": {
197
"type": "git",
208
"url": "git+https://github.com/mtrezza/parse-server-api-mail-adapter.git"
@@ -54,5 +42,15 @@
5442
},
5543
"engines": {
5644
"node": ">=8"
45+
},
46+
"scripts": {
47+
"build:watch": "babel src --out-dir lib --source-maps --watch",
48+
"build": "babel src --out-dir lib --source-maps",
49+
"lint": "eslint '{src,spec,demo}/**/*.js'",
50+
"lint:fix": "eslint '{src,spec,demo}/**/*.js' --fix",
51+
"test": "nyc --reporter=lcov jasmine",
52+
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json",
53+
"prepare": "npm run build && npm test",
54+
"demo": "node ./demo"
5755
}
5856
}

spec/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
// Simluate Parse User class
3+
// Simulate Parse User class
44
const Parse = {
55
User: class User {
66
get(key) {

0 commit comments

Comments
 (0)