@vocoder/cli 0.1.24 → 0.1.26

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/bin.mjs CHANGED
@@ -2769,6 +2769,7 @@ Translations won't run automatically until you grant access.
2769
2769
  return 1;
2770
2770
  }
2771
2771
  p5.log.error(`Error: ${error.message}`);
2772
+ p5.log.info(error.stack ?? "");
2772
2773
  } else {
2773
2774
  p5.log.error("Unknown setup error");
2774
2775
  }
@@ -3294,15 +3295,25 @@ async function sync(options = {}) {
3294
3295
  const startTime = Date.now();
3295
3296
  const projectRoot = process.cwd();
3296
3297
  p8.intro("Vocoder Sync");
3298
+ const mergedConfig = await getMergedConfig(options, options.verbose);
3299
+ if (!mergedConfig.apiKey) {
3300
+ p8.log.warn("No API key found. Run init to get started:");
3301
+ p8.log.info(" npx @vocoder/cli init");
3302
+ p8.log.info("");
3303
+ p8.log.info(
3304
+ " Or add your key to .env: VOCODER_API_KEY=vcp_..."
3305
+ );
3306
+ p8.outro("Run `npx @vocoder/cli init` to set up your project.");
3307
+ return 1;
3308
+ }
3297
3309
  const spinner4 = p8.spinner();
3298
3310
  try {
3299
3311
  spinner4.start("Detecting branch");
3300
3312
  const branch = detectBranch(options.branch);
3301
3313
  spinner4.stop(`Branch: ${chalk8.cyan(branch)}`);
3302
3314
  spinner4.start("Loading project configuration");
3303
- const mergedConfig = await getMergedConfig(options, options.verbose);
3304
3315
  const localConfig = {
3305
- apiKey: mergedConfig.apiKey || "",
3316
+ apiKey: mergedConfig.apiKey,
3306
3317
  apiUrl: mergedConfig.apiUrl || "https://vocoder.app"
3307
3318
  };
3308
3319
  validateLocalConfig(localConfig);
@@ -3608,14 +3619,6 @@ async function sync(options = {}) {
3608
3619
  p8.log.info(
3609
3620
  " Run `npx @vocoder/cli init` to create a new project and key."
3610
3621
  );
3611
- } else if (error.message.includes("VOCODER_API_KEY")) {
3612
- p8.log.info(" Get an API key at: https://vocoder.app/dashboard");
3613
- p8.log.info(' Then add to .env: VOCODER_API_KEY="vcp_..."');
3614
- p8.log.info("");
3615
- p8.log.info(
3616
- " Note: if you use @vocoder/unplugin, `vocoder sync` is optional \u2014"
3617
- );
3618
- p8.log.info(" translations are fetched automatically at build time.");
3619
3622
  } else if (error.message.includes("git branch")) {
3620
3623
  p8.log.warn("Run from a git repository, or use:");
3621
3624
  p8.log.info(" vocoder sync --branch main");