@mailmodo/cli 0.0.32-beta.pr34.57 → 0.0.33-beta.pr35.58
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.
|
@@ -2,8 +2,8 @@ import { confirm, input } from '@inquirer/prompts';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
4
4
|
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
|
|
5
|
-
import { ERRORS, INFO, PROMPTS, SEPARATOR
|
|
6
|
-
import { loadTemplate,
|
|
5
|
+
import { ERRORS, INFO, PROMPTS, SEPARATOR } from '../../lib/messages.js';
|
|
6
|
+
import { loadTemplate, } from '../../lib/yaml-config.js';
|
|
7
7
|
export default class Deploy extends BaseCommand {
|
|
8
8
|
static description = 'Deploy email sequences and verify sending domain';
|
|
9
9
|
static examples = [
|
|
@@ -220,72 +220,22 @@ export default class Deploy extends BaseCommand {
|
|
|
220
220
|
this.log(` ${SEPARATOR}\n`);
|
|
221
221
|
}
|
|
222
222
|
async runDomainSetup(yamlConfig, flags) {
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
domain,
|
|
227
|
-
fromEmail: senderEmail,
|
|
228
|
-
}));
|
|
229
|
-
if (!domainResponse.ok) {
|
|
230
|
-
this.handleApiError(domainResponse);
|
|
231
|
-
}
|
|
232
|
-
yamlConfig.project.domain = domain;
|
|
233
|
-
yamlConfig.project.fromEmail = senderEmail;
|
|
234
|
-
yamlConfig.project.address = address;
|
|
235
|
-
await saveYaml(yamlConfig);
|
|
236
|
-
this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json, domainResponse.data?.dnsGuideUrl);
|
|
223
|
+
const inputs = await this.collectDomainSetupInputs(yamlConfig, flags.yes);
|
|
224
|
+
const { dnsRecords, dnsGuideUrl } = await this.registerDomain(yamlConfig, inputs, flags.json);
|
|
225
|
+
this.logDnsRecords(dnsRecords, dnsGuideUrl, flags.json);
|
|
237
226
|
if (flags.yes) {
|
|
238
|
-
return this.verifyDomain(flags.json, domain);
|
|
227
|
+
return this.verifyDomain(flags.json, inputs.domain);
|
|
239
228
|
}
|
|
240
229
|
const action = await input({
|
|
241
230
|
default: '',
|
|
242
|
-
message:
|
|
231
|
+
message: PROMPTS.ENTER_AFTER_RECORDS,
|
|
243
232
|
});
|
|
244
233
|
if (action.toLowerCase() === 'skip') {
|
|
245
234
|
this.log(`\n ${INFO.SEQUENCES_NOT_DEPLOYED}`);
|
|
246
235
|
this.log(` ${INFO.DOMAIN_NOT_DEPLOYED_HINT}\n`);
|
|
247
236
|
return false;
|
|
248
237
|
}
|
|
249
|
-
return this.verifyDomain(flags.json, domain);
|
|
250
|
-
}
|
|
251
|
-
async collectDomainInputs(yamlConfig, flags) {
|
|
252
|
-
if (flags.yes) {
|
|
253
|
-
return {
|
|
254
|
-
address: yamlConfig.project?.address || '',
|
|
255
|
-
domain: yamlConfig.project?.domain || '',
|
|
256
|
-
senderEmail: yamlConfig.project?.fromEmail || '',
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
this.log(`\n ${SEPARATOR}`);
|
|
260
|
-
this.log(` ${chalk.bold('DOMAIN SETUP')}`);
|
|
261
|
-
this.log(` ${SEPARATOR}\n`);
|
|
262
|
-
const domain = await input({
|
|
263
|
-
message: PROMPTS.DOMAIN,
|
|
264
|
-
validate: (v) => (v?.trim() ? true : VALIDATION.DOMAIN_REQUIRED),
|
|
265
|
-
});
|
|
266
|
-
const senderEmail = await input({
|
|
267
|
-
message: PROMPTS.SENDER_EMAIL,
|
|
268
|
-
validate: (v) => (v?.includes('@') ? true : VALIDATION.EMAIL_INVALID),
|
|
269
|
-
});
|
|
270
|
-
const address = await input({
|
|
271
|
-
message: PROMPTS.BUSINESS_ADDRESS,
|
|
272
|
-
validate: (v) => (v?.trim() ? true : VALIDATION.ADDRESS_REQUIRED),
|
|
273
|
-
});
|
|
274
|
-
return { address, domain, senderEmail };
|
|
275
|
-
}
|
|
276
|
-
showDnsRecords(dnsRecords, jsonOutput, dnsGuideUrl) {
|
|
277
|
-
if (jsonOutput)
|
|
278
|
-
return;
|
|
279
|
-
this.log(`\n Add these ${dnsRecords.length} DNS records to your domain provider:\n`);
|
|
280
|
-
for (const [i, record] of dnsRecords.entries()) {
|
|
281
|
-
this.log(` ${chalk.bold(`RECORD ${i + 1}`)}`);
|
|
282
|
-
this.log(` Type: ${record.type}`);
|
|
283
|
-
this.log(` Host: ${record.host}`);
|
|
284
|
-
this.log(` Value: ${record.value}\n`);
|
|
285
|
-
}
|
|
286
|
-
this.log(` ${INFO.DNS_PROPAGATION}`);
|
|
287
|
-
if (dnsGuideUrl)
|
|
288
|
-
this.log(` Full guide: ${chalk.cyan(dnsGuideUrl)}\n`);
|
|
238
|
+
return this.verifyDomain(flags.json, inputs.domain);
|
|
289
239
|
}
|
|
290
240
|
async verifyDomain(jsonOutput, domain) {
|
|
291
241
|
const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
|
package/oclif.manifest.json
CHANGED
|
@@ -228,6 +228,58 @@
|
|
|
228
228
|
"index.js"
|
|
229
229
|
]
|
|
230
230
|
},
|
|
231
|
+
"edit": {
|
|
232
|
+
"aliases": [],
|
|
233
|
+
"args": {
|
|
234
|
+
"id": {
|
|
235
|
+
"description": "Email template ID to edit",
|
|
236
|
+
"name": "id",
|
|
237
|
+
"required": true
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"description": "Edit an email using AI-assisted natural language changes",
|
|
241
|
+
"examples": [
|
|
242
|
+
"<%= config.bin %> edit welcome",
|
|
243
|
+
"<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
|
|
244
|
+
],
|
|
245
|
+
"flags": {
|
|
246
|
+
"json": {
|
|
247
|
+
"description": "Output as JSON",
|
|
248
|
+
"name": "json",
|
|
249
|
+
"allowNo": false,
|
|
250
|
+
"type": "boolean"
|
|
251
|
+
},
|
|
252
|
+
"yes": {
|
|
253
|
+
"char": "y",
|
|
254
|
+
"description": "Skip confirmation prompts",
|
|
255
|
+
"name": "yes",
|
|
256
|
+
"allowNo": false,
|
|
257
|
+
"type": "boolean"
|
|
258
|
+
},
|
|
259
|
+
"change": {
|
|
260
|
+
"description": "Natural language description of the change",
|
|
261
|
+
"name": "change",
|
|
262
|
+
"hasDynamicHelp": false,
|
|
263
|
+
"multiple": false,
|
|
264
|
+
"type": "option"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"hasDynamicHelp": false,
|
|
268
|
+
"hiddenAliases": [],
|
|
269
|
+
"id": "edit",
|
|
270
|
+
"pluginAlias": "@mailmodo/cli",
|
|
271
|
+
"pluginName": "@mailmodo/cli",
|
|
272
|
+
"pluginType": "core",
|
|
273
|
+
"strict": true,
|
|
274
|
+
"enableJsonFlag": false,
|
|
275
|
+
"isESM": true,
|
|
276
|
+
"relativePath": [
|
|
277
|
+
"dist",
|
|
278
|
+
"commands",
|
|
279
|
+
"edit",
|
|
280
|
+
"index.js"
|
|
281
|
+
]
|
|
282
|
+
},
|
|
231
283
|
"emails": {
|
|
232
284
|
"aliases": [],
|
|
233
285
|
"args": {},
|
|
@@ -603,59 +655,7 @@
|
|
|
603
655
|
"status",
|
|
604
656
|
"index.js"
|
|
605
657
|
]
|
|
606
|
-
},
|
|
607
|
-
"edit": {
|
|
608
|
-
"aliases": [],
|
|
609
|
-
"args": {
|
|
610
|
-
"id": {
|
|
611
|
-
"description": "Email template ID to edit",
|
|
612
|
-
"name": "id",
|
|
613
|
-
"required": true
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
"description": "Edit an email using AI-assisted natural language changes",
|
|
617
|
-
"examples": [
|
|
618
|
-
"<%= config.bin %> edit welcome",
|
|
619
|
-
"<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
|
|
620
|
-
],
|
|
621
|
-
"flags": {
|
|
622
|
-
"json": {
|
|
623
|
-
"description": "Output as JSON",
|
|
624
|
-
"name": "json",
|
|
625
|
-
"allowNo": false,
|
|
626
|
-
"type": "boolean"
|
|
627
|
-
},
|
|
628
|
-
"yes": {
|
|
629
|
-
"char": "y",
|
|
630
|
-
"description": "Skip confirmation prompts",
|
|
631
|
-
"name": "yes",
|
|
632
|
-
"allowNo": false,
|
|
633
|
-
"type": "boolean"
|
|
634
|
-
},
|
|
635
|
-
"change": {
|
|
636
|
-
"description": "Natural language description of the change",
|
|
637
|
-
"name": "change",
|
|
638
|
-
"hasDynamicHelp": false,
|
|
639
|
-
"multiple": false,
|
|
640
|
-
"type": "option"
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
"hasDynamicHelp": false,
|
|
644
|
-
"hiddenAliases": [],
|
|
645
|
-
"id": "edit",
|
|
646
|
-
"pluginAlias": "@mailmodo/cli",
|
|
647
|
-
"pluginName": "@mailmodo/cli",
|
|
648
|
-
"pluginType": "core",
|
|
649
|
-
"strict": true,
|
|
650
|
-
"enableJsonFlag": false,
|
|
651
|
-
"isESM": true,
|
|
652
|
-
"relativePath": [
|
|
653
|
-
"dist",
|
|
654
|
-
"commands",
|
|
655
|
-
"edit",
|
|
656
|
-
"index.js"
|
|
657
|
-
]
|
|
658
658
|
}
|
|
659
659
|
},
|
|
660
|
-
"version": "0.0.
|
|
660
|
+
"version": "0.0.33-beta.pr35.58"
|
|
661
661
|
}
|
package/package.json
CHANGED