@mailmodo/cli 0.0.33-beta.pr35.58 → 0.0.33

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.
@@ -21,5 +21,7 @@ export default class Deploy extends BaseCommand {
21
21
  private logDiff;
22
22
  private logDeploySuccessInstructions;
23
23
  private runDomainSetup;
24
+ private collectDomainInputs;
25
+ private showDnsRecords;
24
26
  private verifyDomain;
25
27
  }
@@ -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 } from '../../lib/messages.js';
6
- import { loadTemplate, } from '../../lib/yaml-config.js';
5
+ import { ERRORS, INFO, PROMPTS, SEPARATOR, VALIDATION, } from '../../lib/messages.js';
6
+ import { loadTemplate, saveYaml, } 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,22 +220,72 @@ export default class Deploy extends BaseCommand {
220
220
  this.log(` ${SEPARATOR}\n`);
221
221
  }
222
222
  async runDomainSetup(yamlConfig, flags) {
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);
223
+ const { address, domain, senderEmail } = await this.collectDomainInputs(yamlConfig, flags);
224
+ const domainResponse = await this.withApiSpinner({ json: flags.json, text: ' Configuring domain...' }, () => this.apiClient.post(API_ENDPOINTS.DOMAIN, {
225
+ address,
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);
226
237
  if (flags.yes) {
227
- return this.verifyDomain(flags.json, inputs.domain);
238
+ return this.verifyDomain(flags.json, domain);
228
239
  }
229
240
  const action = await input({
230
241
  default: '',
231
- message: PROMPTS.ENTER_AFTER_RECORDS,
242
+ message: "Press Enter once you've added the records, or 'skip' to do this later.",
232
243
  });
233
244
  if (action.toLowerCase() === 'skip') {
234
245
  this.log(`\n ${INFO.SEQUENCES_NOT_DEPLOYED}`);
235
246
  this.log(` ${INFO.DOMAIN_NOT_DEPLOYED_HINT}\n`);
236
247
  return false;
237
248
  }
238
- return this.verifyDomain(flags.json, inputs.domain);
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`);
239
289
  }
240
290
  async verifyDomain(jsonOutput, domain) {
241
291
  const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
@@ -280,13 +280,13 @@
280
280
  "index.js"
281
281
  ]
282
282
  },
283
- "emails": {
283
+ "init": {
284
284
  "aliases": [],
285
285
  "args": {},
286
- "description": "List and view configured email sequences",
286
+ "description": "Analyze your product and generate email sequences",
287
287
  "examples": [
288
- "<%= config.bin %> emails",
289
- "<%= config.bin %> emails --json"
288
+ "<%= config.bin %> init",
289
+ "<%= config.bin %> init --url https://myapp.com --yes"
290
290
  ],
291
291
  "flags": {
292
292
  "json": {
@@ -301,11 +301,18 @@
301
301
  "name": "yes",
302
302
  "allowNo": false,
303
303
  "type": "boolean"
304
+ },
305
+ "url": {
306
+ "description": "Product URL to analyze",
307
+ "name": "url",
308
+ "hasDynamicHelp": false,
309
+ "multiple": false,
310
+ "type": "option"
304
311
  }
305
312
  },
306
313
  "hasDynamicHelp": false,
307
314
  "hiddenAliases": [],
308
- "id": "emails",
315
+ "id": "init",
309
316
  "pluginAlias": "@mailmodo/cli",
310
317
  "pluginName": "@mailmodo/cli",
311
318
  "pluginType": "core",
@@ -315,17 +322,17 @@
315
322
  "relativePath": [
316
323
  "dist",
317
324
  "commands",
318
- "emails",
325
+ "init",
319
326
  "index.js"
320
327
  ]
321
328
  },
322
- "init": {
329
+ "emails": {
323
330
  "aliases": [],
324
331
  "args": {},
325
- "description": "Analyze your product and generate email sequences",
332
+ "description": "List and view configured email sequences",
326
333
  "examples": [
327
- "<%= config.bin %> init",
328
- "<%= config.bin %> init --url https://myapp.com --yes"
334
+ "<%= config.bin %> emails",
335
+ "<%= config.bin %> emails --json"
329
336
  ],
330
337
  "flags": {
331
338
  "json": {
@@ -340,18 +347,11 @@
340
347
  "name": "yes",
341
348
  "allowNo": false,
342
349
  "type": "boolean"
343
- },
344
- "url": {
345
- "description": "Product URL to analyze",
346
- "name": "url",
347
- "hasDynamicHelp": false,
348
- "multiple": false,
349
- "type": "option"
350
350
  }
351
351
  },
352
352
  "hasDynamicHelp": false,
353
353
  "hiddenAliases": [],
354
- "id": "init",
354
+ "id": "emails",
355
355
  "pluginAlias": "@mailmodo/cli",
356
356
  "pluginName": "@mailmodo/cli",
357
357
  "pluginType": "core",
@@ -361,7 +361,7 @@
361
361
  "relativePath": [
362
362
  "dist",
363
363
  "commands",
364
- "init",
364
+ "emails",
365
365
  "index.js"
366
366
  ]
367
367
  },
@@ -657,5 +657,5 @@
657
657
  ]
658
658
  }
659
659
  },
660
- "version": "0.0.33-beta.pr35.58"
660
+ "version": "0.0.33"
661
661
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mailmodo/cli",
3
3
  "description": "Email lifecycle automation for the AI-native builder generation.",
4
- "version": "0.0.33-beta.pr35.58",
4
+ "version": "0.0.33",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"