supersendtx-cli 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/dist/cli.js +8 -4
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -174,16 +174,20 @@ async function runApplyCommand(args, env = process.env) {
174
174
  }
175
175
  try {
176
176
  const client = await createDomainsClient(apiKey, options.baseUrl);
177
- const result = await client.domains.applyDns({
177
+ const localCloudflare = env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY;
178
+ const useStoredCloudflare = provider === "cloudflare" && !localCloudflare;
179
+ const result = useStoredCloudflare ? await client.domains.apply(idOrName, { provider: "cloudflare" }) : await client.domains.applyDns({
178
180
  idOrName,
179
181
  provider,
180
- cloudflareApiToken: env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY,
182
+ cloudflareApiToken: localCloudflare,
181
183
  cloudflareZoneId: env.CLOUDFLARE_ZONE_ID,
182
184
  godaddyApiKey: env.GODADDY_API_KEY,
183
185
  godaddyApiSecret: env.GODADDY_API_SECRET
184
186
  });
185
187
  console.log(JSON.stringify(result));
186
- console.error(`Applied ${result.results.length} DNS change(s) via ${result.provider} for ${result.domain}.`);
188
+ console.error(
189
+ useStoredCloudflare ? `Applied ${result.results.length} DNS change(s) via stored Cloudflare credentials for ${result.domain}.` : `Applied ${result.results.length} DNS change(s) via ${result.provider} for ${result.domain}.`
190
+ );
187
191
  for (const row of result.results) {
188
192
  console.error(` ${row.action.padEnd(10)} ${row.purpose} \u2192 ${row.host}`);
189
193
  }
@@ -335,7 +339,7 @@ function printUsage() {
335
339
  console.error("");
336
340
  console.error("Environment:");
337
341
  console.error(" SUPERSENDTX_API_KEY=stx_\u2026");
338
- console.error(" CLOUDFLARE_API_TOKEN=\u2026 (domains apply --provider cloudflare)");
342
+ console.error(" CLOUDFLARE_API_TOKEN=\u2026 (optional local apply; else uses dashboard Integrations)");
339
343
  console.error(" GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)");
340
344
  }
341
345
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supersendtx-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "SuperSend TX CLI — send transactional email from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,7 +39,7 @@
39
39
  "prepublishOnly": "npm run build"
40
40
  },
41
41
  "dependencies": {
42
- "supersendtx": "^0.2.0"
42
+ "supersendtx": "^0.3.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsup": "^8.5.0",