@mailmodo/cli 0.0.29-beta.pr31.48 → 0.0.29
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirm, input } from '@inquirer/prompts';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
4
|
-
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
|
|
4
|
+
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, DNS_GUIDE_URL, } from '../../lib/constants.js';
|
|
5
5
|
import { loadTemplate, saveYaml, } from '../../lib/yaml-config.js';
|
|
6
6
|
export default class Deploy extends BaseCommand {
|
|
7
7
|
static description = 'Deploy email sequences and verify sending domain';
|
|
@@ -232,7 +232,7 @@ export default class Deploy extends BaseCommand {
|
|
|
232
232
|
yamlConfig.project.fromEmail = senderEmail;
|
|
233
233
|
yamlConfig.project.address = address;
|
|
234
234
|
await saveYaml(yamlConfig);
|
|
235
|
-
this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json
|
|
235
|
+
this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json);
|
|
236
236
|
if (flags.yes) {
|
|
237
237
|
return this.verifyDomain(flags.json, domain);
|
|
238
238
|
}
|
|
@@ -273,7 +273,7 @@ export default class Deploy extends BaseCommand {
|
|
|
273
273
|
});
|
|
274
274
|
return { address, domain, senderEmail };
|
|
275
275
|
}
|
|
276
|
-
showDnsRecords(dnsRecords, jsonOutput
|
|
276
|
+
showDnsRecords(dnsRecords, jsonOutput) {
|
|
277
277
|
if (jsonOutput)
|
|
278
278
|
return;
|
|
279
279
|
this.log(`\n Add these ${dnsRecords.length} DNS records to your domain provider:\n`);
|
|
@@ -284,8 +284,7 @@ export default class Deploy extends BaseCommand {
|
|
|
284
284
|
this.log(` Value: ${record.value}\n`);
|
|
285
285
|
}
|
|
286
286
|
this.log(` DNS changes take 5–30 minutes to propagate.`);
|
|
287
|
-
|
|
288
|
-
this.log(` Full guide: ${chalk.cyan(dnsGuideUrl)}\n`);
|
|
287
|
+
this.log(` Full guide: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
289
288
|
}
|
|
290
289
|
async verifyDomain(jsonOutput, domain) {
|
|
291
290
|
const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
|
|
@@ -294,7 +293,7 @@ export default class Deploy extends BaseCommand {
|
|
|
294
293
|
if (!verify.ok) {
|
|
295
294
|
this.handleApiError(verify);
|
|
296
295
|
}
|
|
297
|
-
const { dkim, dmarc,
|
|
296
|
+
const { dkim, dmarc, domainStatus, returnPath } = verify.data;
|
|
298
297
|
const allPassed = domainStatus === 'VERIFIED';
|
|
299
298
|
if (!jsonOutput) {
|
|
300
299
|
this.log(` DKIM ${dkim ? chalk.green('✓') : chalk.red('✗')}`);
|
|
@@ -305,8 +304,7 @@ export default class Deploy extends BaseCommand {
|
|
|
305
304
|
}
|
|
306
305
|
else {
|
|
307
306
|
this.log(`\n ${chalk.yellow('Some records failed.')} Fix them and run ${chalk.cyan('mailmodo domain --verify')}.`);
|
|
308
|
-
|
|
309
|
-
this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
|
|
307
|
+
this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
310
|
return allPassed;
|
|
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { input } from '@inquirer/prompts';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
5
|
-
import { API_ENDPOINTS } from '../../lib/constants.js';
|
|
5
|
+
import { API_ENDPOINTS, DNS_GUIDE_URL } from '../../lib/constants.js';
|
|
6
6
|
import { saveConfig } from '../../lib/config.js';
|
|
7
7
|
import { saveYaml } from '../../lib/yaml-config.js';
|
|
8
8
|
export default class Domain extends BaseCommand {
|
|
@@ -69,7 +69,7 @@ export default class Domain extends BaseCommand {
|
|
|
69
69
|
await saveYaml(yamlConfig);
|
|
70
70
|
await saveConfig({ ...config, domain });
|
|
71
71
|
const records = response.data?.dnsRecords || [];
|
|
72
|
-
const guideUrl = response.data?.dnsGuideUrl;
|
|
72
|
+
const guideUrl = response.data?.dnsGuideUrl ?? DNS_GUIDE_URL;
|
|
73
73
|
if (flags.json) {
|
|
74
74
|
this.log(JSON.stringify({ dnsRecords: records, domain }, null, 2));
|
|
75
75
|
return;
|
|
@@ -82,8 +82,7 @@ export default class Domain extends BaseCommand {
|
|
|
82
82
|
this.log(` Value: ${record.value}\n`);
|
|
83
83
|
}
|
|
84
84
|
this.log(` DNS changes take 5–30 minutes to propagate.`);
|
|
85
|
-
|
|
86
|
-
this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
|
|
85
|
+
this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
|
|
87
86
|
if (!flags.yes) {
|
|
88
87
|
const action = await input({
|
|
89
88
|
default: '',
|
|
@@ -108,7 +107,7 @@ export default class Domain extends BaseCommand {
|
|
|
108
107
|
if (!response.ok) {
|
|
109
108
|
this.handleApiError(response);
|
|
110
109
|
}
|
|
111
|
-
const { dkim, dmarc,
|
|
110
|
+
const { dkim, dmarc, returnPath, domainStatus } = response.data;
|
|
112
111
|
if (jsonOutput) {
|
|
113
112
|
this.log(JSON.stringify({ dkim, dmarc, returnPath, domainStatus }, null, 2));
|
|
114
113
|
return;
|
|
@@ -134,8 +133,7 @@ export default class Domain extends BaseCommand {
|
|
|
134
133
|
this.log(` - Cloudflare: proxy must be OFF (grey cloud, not orange)`);
|
|
135
134
|
}
|
|
136
135
|
this.log(`\n Fix the records and run ${chalk.cyan('mailmodo domain --verify')} again.`);
|
|
137
|
-
|
|
138
|
-
this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
|
|
136
|
+
this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
139
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { editor, input, select } from '@inquirer/prompts';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
5
5
|
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
|
|
6
|
-
import {
|
|
6
|
+
import { saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
|
|
7
7
|
function isValidUrl(value) {
|
|
8
8
|
try {
|
|
9
9
|
return Boolean(new URL(value));
|
|
@@ -42,8 +42,6 @@ export default class Init extends BaseCommand {
|
|
|
42
42
|
async run() {
|
|
43
43
|
const { flags } = await this.parse(Init);
|
|
44
44
|
await this.ensureAuth();
|
|
45
|
-
if (!(await this.confirmOverwriteIfNeeded(flags)))
|
|
46
|
-
return;
|
|
47
45
|
let productUrl = flags.url;
|
|
48
46
|
if (!productUrl) {
|
|
49
47
|
productUrl = await input({
|
|
@@ -179,21 +177,4 @@ export default class Init extends BaseCommand {
|
|
|
179
177
|
this.log(` Created ${chalk.green('mailmodo.yaml')} + ${chalk.green(String(emailConfigs.length))} email templates in ${chalk.green('/mailmodo')}\n`);
|
|
180
178
|
this.log(` Run ${chalk.cyan("'mailmodo emails'")} to review.\n`);
|
|
181
179
|
}
|
|
182
|
-
async confirmOverwriteIfNeeded(flags) {
|
|
183
|
-
const existing = await loadYaml();
|
|
184
|
-
if (!existing)
|
|
185
|
-
return true;
|
|
186
|
-
if (flags.yes)
|
|
187
|
-
return true;
|
|
188
|
-
this.log(`\n ${chalk.yellow('⚠')} ${chalk.bold('mailmodo.yaml already exists.')}`);
|
|
189
|
-
this.log(` Running init will overwrite your current project configuration and all email templates.\n`);
|
|
190
|
-
const proceed = await confirm({
|
|
191
|
-
default: false,
|
|
192
|
-
message: 'Overwrite existing configuration and templates?',
|
|
193
|
-
});
|
|
194
|
-
if (!proceed) {
|
|
195
|
-
this.log(`\n Init cancelled. Run ${chalk.cyan('mailmodo edit')} to modify individual emails.\n`);
|
|
196
|
-
}
|
|
197
|
-
return proceed;
|
|
198
|
-
}
|
|
199
180
|
}
|
|
@@ -5,7 +5,7 @@ import { existsSync } from 'node:fs';
|
|
|
5
5
|
import { readFile } from 'node:fs/promises';
|
|
6
6
|
import { resolve } from 'node:path';
|
|
7
7
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
8
|
-
import { API_ENDPOINTS } from '../../lib/constants.js';
|
|
8
|
+
import { API_ENDPOINTS, DNS_GUIDE_URL } from '../../lib/constants.js';
|
|
9
9
|
import { saveYaml } from '../../lib/yaml-config.js';
|
|
10
10
|
const SETTINGS_GROUPS = Object.freeze({
|
|
11
11
|
billing: ['monthly_cap'],
|
|
@@ -232,7 +232,6 @@ export default class Settings extends BaseCommand {
|
|
|
232
232
|
this.handleApiError(response);
|
|
233
233
|
}
|
|
234
234
|
const records = response.data?.dnsRecords || [];
|
|
235
|
-
const dnsGuideUrl = response.data?.dnsGuideUrl;
|
|
236
235
|
yamlConfig.project.domain = newDomain;
|
|
237
236
|
yamlConfig.project.fromEmail = newFromEmail;
|
|
238
237
|
yamlConfig.project.address = newAddress;
|
|
@@ -247,8 +246,7 @@ export default class Settings extends BaseCommand {
|
|
|
247
246
|
}
|
|
248
247
|
this.log(` Run ${chalk.cyan("'mailmodo domain --verify'")} once records are added.`);
|
|
249
248
|
this.log(` Emails will not send until the new domain is verified.`);
|
|
250
|
-
|
|
251
|
-
this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
|
|
249
|
+
this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
252
250
|
}
|
|
253
251
|
recordLabel(index) {
|
|
254
252
|
const labels = ['DKIM', 'DMARC', 'Return Path'];
|
package/oclif.manifest.json
CHANGED
|
@@ -76,6 +76,67 @@
|
|
|
76
76
|
"index.js"
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
|
+
"contacts": {
|
|
80
|
+
"aliases": [],
|
|
81
|
+
"args": {},
|
|
82
|
+
"description": "Manage contacts — search, export, or delete",
|
|
83
|
+
"examples": [
|
|
84
|
+
"<%= config.bin %> contacts",
|
|
85
|
+
"<%= config.bin %> contacts --search sarah@example.com",
|
|
86
|
+
"<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
|
|
87
|
+
"<%= config.bin %> contacts --delete sarah@example.com"
|
|
88
|
+
],
|
|
89
|
+
"flags": {
|
|
90
|
+
"json": {
|
|
91
|
+
"description": "Output as JSON",
|
|
92
|
+
"name": "json",
|
|
93
|
+
"allowNo": false,
|
|
94
|
+
"type": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"yes": {
|
|
97
|
+
"char": "y",
|
|
98
|
+
"description": "Skip confirmation prompts",
|
|
99
|
+
"name": "yes",
|
|
100
|
+
"allowNo": false,
|
|
101
|
+
"type": "boolean"
|
|
102
|
+
},
|
|
103
|
+
"delete": {
|
|
104
|
+
"description": "GDPR hard delete a contact by email",
|
|
105
|
+
"name": "delete",
|
|
106
|
+
"hasDynamicHelp": false,
|
|
107
|
+
"multiple": false,
|
|
108
|
+
"type": "option"
|
|
109
|
+
},
|
|
110
|
+
"export": {
|
|
111
|
+
"description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
|
|
112
|
+
"name": "export",
|
|
113
|
+
"allowNo": false,
|
|
114
|
+
"type": "boolean"
|
|
115
|
+
},
|
|
116
|
+
"search": {
|
|
117
|
+
"description": "Search for a contact by email",
|
|
118
|
+
"name": "search",
|
|
119
|
+
"hasDynamicHelp": false,
|
|
120
|
+
"multiple": false,
|
|
121
|
+
"type": "option"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"hasDynamicHelp": false,
|
|
125
|
+
"hiddenAliases": [],
|
|
126
|
+
"id": "contacts",
|
|
127
|
+
"pluginAlias": "@mailmodo/cli",
|
|
128
|
+
"pluginName": "@mailmodo/cli",
|
|
129
|
+
"pluginType": "core",
|
|
130
|
+
"strict": true,
|
|
131
|
+
"enableJsonFlag": false,
|
|
132
|
+
"isESM": true,
|
|
133
|
+
"relativePath": [
|
|
134
|
+
"dist",
|
|
135
|
+
"commands",
|
|
136
|
+
"contacts",
|
|
137
|
+
"index.js"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
79
140
|
"deploy": {
|
|
80
141
|
"aliases": [],
|
|
81
142
|
"args": {},
|
|
@@ -304,67 +365,6 @@
|
|
|
304
365
|
"index.js"
|
|
305
366
|
]
|
|
306
367
|
},
|
|
307
|
-
"contacts": {
|
|
308
|
-
"aliases": [],
|
|
309
|
-
"args": {},
|
|
310
|
-
"description": "Manage contacts — search, export, or delete",
|
|
311
|
-
"examples": [
|
|
312
|
-
"<%= config.bin %> contacts",
|
|
313
|
-
"<%= config.bin %> contacts --search sarah@example.com",
|
|
314
|
-
"<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
|
|
315
|
-
"<%= config.bin %> contacts --delete sarah@example.com"
|
|
316
|
-
],
|
|
317
|
-
"flags": {
|
|
318
|
-
"json": {
|
|
319
|
-
"description": "Output as JSON",
|
|
320
|
-
"name": "json",
|
|
321
|
-
"allowNo": false,
|
|
322
|
-
"type": "boolean"
|
|
323
|
-
},
|
|
324
|
-
"yes": {
|
|
325
|
-
"char": "y",
|
|
326
|
-
"description": "Skip confirmation prompts",
|
|
327
|
-
"name": "yes",
|
|
328
|
-
"allowNo": false,
|
|
329
|
-
"type": "boolean"
|
|
330
|
-
},
|
|
331
|
-
"delete": {
|
|
332
|
-
"description": "GDPR hard delete a contact by email",
|
|
333
|
-
"name": "delete",
|
|
334
|
-
"hasDynamicHelp": false,
|
|
335
|
-
"multiple": false,
|
|
336
|
-
"type": "option"
|
|
337
|
-
},
|
|
338
|
-
"export": {
|
|
339
|
-
"description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
|
|
340
|
-
"name": "export",
|
|
341
|
-
"allowNo": false,
|
|
342
|
-
"type": "boolean"
|
|
343
|
-
},
|
|
344
|
-
"search": {
|
|
345
|
-
"description": "Search for a contact by email",
|
|
346
|
-
"name": "search",
|
|
347
|
-
"hasDynamicHelp": false,
|
|
348
|
-
"multiple": false,
|
|
349
|
-
"type": "option"
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
"hasDynamicHelp": false,
|
|
353
|
-
"hiddenAliases": [],
|
|
354
|
-
"id": "contacts",
|
|
355
|
-
"pluginAlias": "@mailmodo/cli",
|
|
356
|
-
"pluginName": "@mailmodo/cli",
|
|
357
|
-
"pluginType": "core",
|
|
358
|
-
"strict": true,
|
|
359
|
-
"enableJsonFlag": false,
|
|
360
|
-
"isESM": true,
|
|
361
|
-
"relativePath": [
|
|
362
|
-
"dist",
|
|
363
|
-
"commands",
|
|
364
|
-
"contacts",
|
|
365
|
-
"index.js"
|
|
366
|
-
]
|
|
367
|
-
},
|
|
368
368
|
"login": {
|
|
369
369
|
"aliases": [],
|
|
370
370
|
"args": {},
|
|
@@ -657,5 +657,5 @@
|
|
|
657
657
|
]
|
|
658
658
|
}
|
|
659
659
|
},
|
|
660
|
-
"version": "0.0.29
|
|
660
|
+
"version": "0.0.29"
|
|
661
661
|
}
|