groundmail-cli 0.27.1 → 0.29.0
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/dist/cli.js +33 -19
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -790,6 +790,16 @@ async function runAddCommand(args, env = process.env) {
|
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
// src/commands/domains/apply.ts
|
|
793
|
+
var PROVIDERS = ["cloudflare", "vercel", "godaddy", "netlify", "digitalocean", "dnsimple"];
|
|
794
|
+
function hasLocalCredentials(provider, env) {
|
|
795
|
+
if (provider === "cloudflare") return Boolean(env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY);
|
|
796
|
+
if (provider === "vercel") return Boolean(env.VERCEL_API_TOKEN);
|
|
797
|
+
if (provider === "netlify") return Boolean(env.NETLIFY_AUTH_TOKEN);
|
|
798
|
+
if (provider === "digitalocean") return Boolean(env.DIGITALOCEAN_TOKEN || env.DIGITALOCEAN_ACCESS_TOKEN);
|
|
799
|
+
if (provider === "dnsimple") return Boolean(env.DNSIMPLE_TOKEN && env.DNSIMPLE_ACCOUNT_ID);
|
|
800
|
+
if (provider === "godaddy") return Boolean(env.GODADDY_PAT || env.GODADDY_API_KEY && env.GODADDY_API_SECRET);
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
793
803
|
async function runApplyCommand(args, env = process.env) {
|
|
794
804
|
const options = parseDomainsCommonArgs(args);
|
|
795
805
|
const apiKey = resolveApiKey3(options, env);
|
|
@@ -798,10 +808,10 @@ async function runApplyCommand(args, env = process.env) {
|
|
|
798
808
|
}
|
|
799
809
|
const providerFlag = args.includes("--provider") ? args[args.indexOf("--provider") + 1] : void 0;
|
|
800
810
|
const provider = (providerFlag || "").toLowerCase();
|
|
801
|
-
if (provider
|
|
811
|
+
if (!PROVIDERS.includes(provider)) {
|
|
802
812
|
return {
|
|
803
813
|
exitCode: 1,
|
|
804
|
-
error:
|
|
814
|
+
error: `Missing or invalid --provider. Use one of: ${PROVIDERS.join(", ")}.`
|
|
805
815
|
};
|
|
806
816
|
}
|
|
807
817
|
const idOrName = options.id || options.name || args.find((arg, i) => {
|
|
@@ -820,23 +830,26 @@ async function runApplyCommand(args, env = process.env) {
|
|
|
820
830
|
}
|
|
821
831
|
try {
|
|
822
832
|
const client2 = await createDomainsClient(apiKey, options.baseUrl);
|
|
823
|
-
const
|
|
824
|
-
const
|
|
825
|
-
const
|
|
826
|
-
const useStoredVercel = provider === "vercel" && !localVercel;
|
|
827
|
-
const result = useStoredCloudflare || useStoredVercel ? await client2.domains.apply(idOrName, { provider }) : await client2.domains.applyDns({
|
|
833
|
+
const dnsProvider = provider;
|
|
834
|
+
const useStored = !hasLocalCredentials(dnsProvider, env);
|
|
835
|
+
const result = useStored ? await client2.domains.apply(idOrName, { provider: dnsProvider }) : await client2.domains.applyDns({
|
|
828
836
|
idOrName,
|
|
829
|
-
provider,
|
|
830
|
-
cloudflareApiToken:
|
|
837
|
+
provider: dnsProvider,
|
|
838
|
+
cloudflareApiToken: env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY,
|
|
831
839
|
cloudflareZoneId: env.CLOUDFLARE_ZONE_ID,
|
|
840
|
+
godaddyApiToken: env.GODADDY_PAT,
|
|
832
841
|
godaddyApiKey: env.GODADDY_API_KEY,
|
|
833
842
|
godaddyApiSecret: env.GODADDY_API_SECRET,
|
|
834
|
-
vercelApiToken:
|
|
835
|
-
vercelTeamId: env.VERCEL_TEAM_ID
|
|
843
|
+
vercelApiToken: env.VERCEL_API_TOKEN,
|
|
844
|
+
vercelTeamId: env.VERCEL_TEAM_ID,
|
|
845
|
+
netlifyApiToken: env.NETLIFY_AUTH_TOKEN,
|
|
846
|
+
digitaloceanApiToken: env.DIGITALOCEAN_TOKEN || env.DIGITALOCEAN_ACCESS_TOKEN,
|
|
847
|
+
dnsimpleApiToken: env.DNSIMPLE_TOKEN,
|
|
848
|
+
dnsimpleAccountId: env.DNSIMPLE_ACCOUNT_ID
|
|
836
849
|
});
|
|
837
850
|
console.log(JSON.stringify(result));
|
|
838
851
|
console.error(
|
|
839
|
-
|
|
852
|
+
useStored ? `Applied ${result.results.length} DNS change(s) via your connected ${provider} account for ${result.domain}.` : `Applied ${result.results.length} DNS change(s) via ${result.provider} for ${result.domain}.`
|
|
840
853
|
);
|
|
841
854
|
for (const row of result.results) {
|
|
842
855
|
console.error(` ${row.action.padEnd(10)} ${row.purpose} \u2192 ${row.host}`);
|
|
@@ -1452,7 +1465,7 @@ function trimUrl(value) {
|
|
|
1452
1465
|
}
|
|
1453
1466
|
|
|
1454
1467
|
// package.json
|
|
1455
|
-
var version = "0.
|
|
1468
|
+
var version = "0.29.0";
|
|
1456
1469
|
|
|
1457
1470
|
// src/user-agent.ts
|
|
1458
1471
|
function buildUserAgent(own) {
|
|
@@ -3450,7 +3463,7 @@ async function switchWorkspace(argv, deps) {
|
|
|
3450
3463
|
}
|
|
3451
3464
|
|
|
3452
3465
|
// src/commands/migrate.ts
|
|
3453
|
-
var
|
|
3466
|
+
var PROVIDERS2 = ["sendgrid", "postmark", "mailgun"];
|
|
3454
3467
|
var RESOURCES = ["domains", "webhooks", "templates", "suppressions"];
|
|
3455
3468
|
var KEY_ENV = {
|
|
3456
3469
|
sendgrid: "SENDGRID_API_KEY",
|
|
@@ -3561,7 +3574,7 @@ async function runStoredCommand(sub, args, env) {
|
|
|
3561
3574
|
}
|
|
3562
3575
|
async function runMigrateCommand(provider, args, env = process.env) {
|
|
3563
3576
|
if (provider === "list" || provider === "report") return runStoredCommand(provider, args, env);
|
|
3564
|
-
if (!provider || !
|
|
3577
|
+
if (!provider || !PROVIDERS2.includes(provider)) {
|
|
3565
3578
|
return {
|
|
3566
3579
|
exitCode: 1,
|
|
3567
3580
|
error: "Usage: groundmail migrate <sendgrid|postmark|mailgun> [--dry-run] [--only templates,suppressions], groundmail migrate list, or groundmail migrate report <id> [--csv]"
|
|
@@ -3643,6 +3656,7 @@ async function runValidateCommand(args, env = process.env) {
|
|
|
3643
3656
|
}
|
|
3644
3657
|
|
|
3645
3658
|
// src/commands/dmarc/dmarc.ts
|
|
3659
|
+
var DMARC_APPLY_PROVIDERS = ["cloudflare", "vercel", "godaddy", "netlify", "digitalocean", "dnsimple"];
|
|
3646
3660
|
function readFlag23(args, flag) {
|
|
3647
3661
|
const index = args.indexOf(flag);
|
|
3648
3662
|
if (index === -1) return void 0;
|
|
@@ -3717,8 +3731,8 @@ async function runDmarcCommand(subcommand, args, env = process.env) {
|
|
|
3717
3731
|
}
|
|
3718
3732
|
if (subcommand === "enable") {
|
|
3719
3733
|
const apply = readFlag23(args, "--apply");
|
|
3720
|
-
if (apply && apply
|
|
3721
|
-
return { exitCode: 1, error:
|
|
3734
|
+
if (apply && !DMARC_APPLY_PROVIDERS.includes(apply)) {
|
|
3735
|
+
return { exitCode: 1, error: `--apply must be one of: ${DMARC_APPLY_PROVIDERS.join(", ")}` };
|
|
3722
3736
|
}
|
|
3723
3737
|
const result2 = await client2.dmarc.enable(domain, apply ? { apply } : {});
|
|
3724
3738
|
if (json) console.log(JSON.stringify(result2));
|
|
@@ -3837,7 +3851,7 @@ var USAGE_LINES = [
|
|
|
3837
3851
|
" groundmail domains verify example.com",
|
|
3838
3852
|
" groundmail domains delete example.com",
|
|
3839
3853
|
" groundmail dmarc status example.com [--json] DMARC monitoring: sources, pass rates, readiness",
|
|
3840
|
-
" groundmail dmarc enable example.com [--apply cloudflare|vercel|godaddy] report address and the record to publish",
|
|
3854
|
+
" groundmail dmarc enable example.com [--apply cloudflare|vercel|godaddy|netlify|digitalocean|dnsimple] report address and the record to publish",
|
|
3841
3855
|
" groundmail dmarc digest example.com --on|--off weekly digest email",
|
|
3842
3856
|
" groundmail dmarc disable example.com",
|
|
3843
3857
|
" groundmail received-emails list [--domain inbound.example.com]",
|
|
@@ -3917,7 +3931,7 @@ var FOOTER_LINES = [
|
|
|
3917
3931
|
" TWILIO_ACCOUNT_SID=AC\u2026 TWILIO_AUTH_TOKEN=\u2026 TWILIO_DEFAULT_FROM=+1\u2026 (integrations twilio connect)",
|
|
3918
3932
|
" CLOUDFLARE_API_TOKEN=\u2026 (optional local apply; else uses dashboard Integrations)",
|
|
3919
3933
|
" VERCEL_API_TOKEN=\u2026 VERCEL_TEAM_ID=\u2026 (optional local apply; else uses dashboard Integrations)",
|
|
3920
|
-
" GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)",
|
|
3934
|
+
" GODADDY_PAT=\u2026 or GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)",
|
|
3921
3935
|
" SENDGRID_API_KEY / POSTMARK_SERVER_TOKEN (+ POSTMARK_ACCOUNT_TOKEN) / MAILGUN_API_KEY (migrate; used once, never stored)",
|
|
3922
3936
|
"",
|
|
3923
3937
|
"Scopes: full, emails:send, emails:read, domains:read, domains:write, webhooks:write, templates:write,",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groundmail-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Groundmail CLI — send transactional email from the terminal",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"prepublishOnly": "npm run build"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"groundmail": "0.
|
|
41
|
+
"groundmail": "0.28.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.5.0",
|