From 763c1c49d70ce976612105e2728ab68cb7711110 Mon Sep 17 00:00:00 2001 From: odeta939 <odetapenikaite@gmail.com> Date: Wed, 5 Feb 2025 21:49:30 +0100 Subject: [PATCH 1/2] when no framework detected generate secret instead of throwing error --- commands/secret.js | 7 +++++-- index.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/commands/secret.js b/commands/secret.js index 2afa27d..11a48c8 100644 --- a/commands/secret.js +++ b/commands/secret.js @@ -2,7 +2,7 @@ import * as y from "yoctocolors" import clipboard from "clipboardy" -import { requireFramework } from "../lib/detect.js" +import { detectFramework, requireFramework } from "../lib/detect.js" import { updateEnvFile } from "../lib/write-env.js" /** Web compatible method to create a random string of a given length */ @@ -47,7 +47,10 @@ export async function action(options) { } try { - await requireFramework(options.path) + const framework = await detectFramework(options.path) + if (framework === "unknown") { + return console.log(value) + } await updateEnvFile({ [key]: value }, options.path) } catch (error) { console.error(y.red(error)) diff --git a/index.js b/index.js index f8b5338..2f3b9d8 100755 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ // @ts-check -import { Command, InvalidArgumentError } from "commander" +import { Command } from "commander" import * as y from "yoctocolors" import { ask, init, secret, add } from "./commands/index.js" @@ -55,7 +55,7 @@ program program .command("add") .argument("[provider]", "The authentication provider.") - .description('Register a new authentication provider') + .description("Register a new authentication provider") .action(add.action) program.parse() From 7bc3237296b7cb06f877d0fc57371cbce6ad745b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= <info@balazsorban.com> Date: Wed, 5 Feb 2025 20:58:09 +0000 Subject: [PATCH 2/2] Update secret.js --- commands/secret.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/secret.js b/commands/secret.js index 11a48c8..ee81de7 100644 --- a/commands/secret.js +++ b/commands/secret.js @@ -2,7 +2,7 @@ import * as y from "yoctocolors" import clipboard from "clipboardy" -import { detectFramework, requireFramework } from "../lib/detect.js" +import { detectFramework } from "../lib/detect.js" import { updateEnvFile } from "../lib/write-env.js" /** Web compatible method to create a random string of a given length */