Skip to content

Commit a7d4214

Browse files
fix: when no framework detected generate secret instead of throwing error (#23)
* when no framework detected generate secret instead of throwing error * Update secret.js --------- Co-authored-by: Balázs Orbán <[email protected]>
1 parent ec6cd7b commit a7d4214

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

commands/secret.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import * as y from "yoctocolors"
44
import clipboard from "clipboardy"
5-
import { requireFramework } from "../lib/detect.js"
5+
import { detectFramework } from "../lib/detect.js"
66
import { updateEnvFile } from "../lib/write-env.js"
77

88
/** Web compatible method to create a random string of a given length */
@@ -47,7 +47,10 @@ export async function action(options) {
4747
}
4848

4949
try {
50-
await requireFramework(options.path)
50+
const framework = await detectFramework(options.path)
51+
if (framework === "unknown") {
52+
return console.log(value)
53+
}
5154
await updateEnvFile({ [key]: value }, options.path)
5255
} catch (error) {
5356
console.error(y.red(error))

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// @ts-check
44

5-
import { Command, InvalidArgumentError } from "commander"
5+
import { Command } from "commander"
66
import * as y from "yoctocolors"
77
import { ask, init, secret, add } from "./commands/index.js"
88

@@ -55,7 +55,7 @@ program
5555
program
5656
.command("add")
5757
.argument("[provider]", "The authentication provider.")
58-
.description('Register a new authentication provider')
58+
.description("Register a new authentication provider")
5959
.action(add.action)
6060

6161
program.parse()

0 commit comments

Comments
 (0)