auth 1.2.0 → 1.2.2

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/commands/add.js CHANGED
@@ -38,19 +38,17 @@ const choices = Object.entries(providers)
38
38
  /** @param {string | undefined} providerId */
39
39
  export async function action(providerId) {
40
40
  try {
41
- const pid =
42
- providerId ??
43
- (await select({
44
- message: "What provider do you want to set up?",
45
- choices: choices,
46
- }))
47
-
48
- const provider = providers[pid]
41
+ providerId ??= await select({
42
+ message: "What provider do you want to set up?",
43
+ choices: choices,
44
+ })
45
+
46
+ const provider = providers[providerId]
49
47
  if (!provider?.setupUrl) {
50
48
  console.error(
51
49
  y.red(
52
50
  `Missing instructions for ${
53
- provider?.name ?? pid
51
+ provider?.name ?? providerId
54
52
  }.\nInstructions are available for: ${y.bold(
55
53
  choices.map((choice) => choice.name).join(", ")
56
54
  )}`
@@ -135,7 +133,7 @@ ${y.bold("Callback URL (copied to clipboard)")}: ${url}`
135
133
 
136
134
  console.log(y.dim("Updating environment variable file..."))
137
135
 
138
- const varPrefix = `AUTH_${pid.toUpperCase()}`
136
+ const varPrefix = `AUTH_${providerId.toUpperCase()}`
139
137
  await updateEnvFile({
140
138
  [`${varPrefix}_ID`]: clientId,
141
139
  [`${varPrefix}_SECRET`]: clientSecret,
@@ -48,7 +48,7 @@ export async function action(options) {
48
48
 
49
49
  try {
50
50
  await requireFramework(options.path)
51
- await updateEnvFile({ [key]: value }, options.path, true)
51
+ await updateEnvFile({ [key]: value }, options.path)
52
52
  } catch (error) {
53
53
  console.error(y.red(error))
54
54
  }
package/lib/write-env.js CHANGED
@@ -13,7 +13,7 @@ import { detectFramework } from "./detect.js"
13
13
  * @param {string|undefined} envPath
14
14
  * @param {boolean} comment
15
15
  */
16
- export async function updateEnvFile(env, envPath = "", comment = false) {
16
+ export async function updateEnvFile(env, envPath = "", comment = true) {
17
17
  const framework = await detectFramework(envPath)
18
18
  const dotEnvFile = frameworks[framework]?.envFile
19
19
  const file = join(process.cwd(), envPath, dotEnvFile)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "homepage": "https://cli.authjs.dev",
5
5
  "repository": {
6
6
  "type": "git",