diff --git a/src/commands/init.js b/src/commands/init.js index c6d5cb9..0cafce5 100644 --- a/src/commands/init.js +++ b/src/commands/init.js @@ -28,6 +28,21 @@ export async function runInit() { initial: false, }); if (!overwrite) { + console.log(chalk.yellow("ℹ Keeping existing apidrift.config.json")); + console.log(""); + console.log(" Your current config was not modified. Next steps:"); + console.log( + ` 1. Make sure you have a ${chalk.cyan(".env")} file or environment variables set for your tokens:` + ); + console.log(` ${chalk.gray("STAGING_TOKEN=your_token_here")}`); + console.log(` ${chalk.gray("PROD_TOKEN=your_token_here")}`); + console.log( + ` 2. Add ${chalk.cyan(".env")} to your ${chalk.cyan(".gitignore")} to keep tokens out of git` + ); + console.log( + ` 3. Run: ${chalk.cyan("apidrift snapshot --tag v1.0 --env staging")}` + ); + console.log(""); return; } } diff --git a/src/storage/snapshotStore.js b/src/storage/snapshotStore.js index 0af020d..b04c95f 100644 --- a/src/storage/snapshotStore.js +++ b/src/storage/snapshotStore.js @@ -26,5 +26,6 @@ export function listSnapshots() { return fs .readdirSync(SNAP_DIR) .filter((f) => f.endsWith(".json")) - .map((f) => f.replace(".json", "")); + .map((f) => f.replace(/\.json$/, "")) + .sort(); }