Skip to content

fix: when no framework detected generate secret instead of throwing error #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions commands/secret.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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()
Expand Down