Comparing version 1.1.1 to 1.2.0
@@ -6,9 +6,30 @@ // @ts-check | ||
import clipboard from "clipboardy" | ||
import { select, input, password } from "@inquirer/prompts" | ||
import { select, input, password, number } from "@inquirer/prompts" | ||
import { requireFramework } from "../lib/detect.js" | ||
import { updateEnvFile } from "../lib/write-env.js" | ||
import { providers, frameworks } from "../lib/meta.js" | ||
import { secret } from "./index.js" | ||
import { link, markdownToAnsi } from "../lib/markdown.js" | ||
import { appleGenSecret } from "../lib/apple-gen-secret.js" | ||
/** | ||
* @param {string} label | ||
* @param {string} [defaultValue] | ||
*/ | ||
async function promptInput(label, defaultValue) { | ||
return input({ | ||
message: `Paste ${y.magenta(label)}:`, | ||
validate: (value) => !!value, | ||
default: defaultValue, | ||
}) | ||
} | ||
/** @param {string} label */ | ||
async function promptPassword(label) { | ||
return password({ | ||
message: `Paste ${y.magenta(label)}:`, | ||
mask: true, | ||
validate: (value) => !!value, | ||
}) | ||
} | ||
const choices = Object.entries(providers) | ||
@@ -21,10 +42,10 @@ .filter(([, { setupUrl }]) => !!setupUrl) | ||
try { | ||
if (!providerId) { | ||
providerId = await select({ | ||
const pid = | ||
providerId ?? | ||
(await select({ | ||
message: "What provider do you want to set up?", | ||
choices: choices, | ||
}) | ||
} | ||
})) | ||
const provider = providers[providerId] | ||
const provider = providers[pid] | ||
if (!provider?.setupUrl) { | ||
@@ -34,3 +55,3 @@ console.error( | ||
`Missing instructions for ${ | ||
provider?.name ?? providerId | ||
provider?.name ?? pid | ||
}.\nInstructions are available for: ${y.bold( | ||
@@ -84,32 +105,45 @@ choices.map((choice) => choice.name).join(", ") | ||
const clientId = await input({ | ||
message: `Paste ${y.magenta("Client ID")}:`, | ||
validate: (value) => !!value, | ||
}) | ||
const clientSecret = await password({ | ||
message: `Paste ${y.magenta("Client secret")}:`, | ||
mask: true, | ||
validate: (value) => !!value, | ||
}) | ||
if (providerId === "apple") { | ||
const clientId = await promptInput("Client ID") | ||
const keyId = await promptInput("Key ID") | ||
const teamId = await promptInput("Team ID") | ||
const privateKey = await input({ | ||
message: "Path to Private Key", | ||
validate: (value) => !!value, | ||
default: "./private-key.p8", | ||
}) | ||
console.log(y.dim(`Updating environment variable file...`)) | ||
const expiresInDays = | ||
(await number({ | ||
message: "Expires in days (default: 180)", | ||
required: false, | ||
default: 180, | ||
})) ?? 180 | ||
const varPrefix = `AUTH_${providerId.toUpperCase()}` | ||
console.log(y.dim("Updating environment variable file...")) | ||
await updateEnvFile({ | ||
[`${varPrefix}_ID`]: clientId, | ||
[`${varPrefix}_SECRET`]: clientSecret, | ||
}) | ||
await updateEnvFile({ AUTH_APPLE_ID: clientId }) | ||
console.log( | ||
y.dim( | ||
`\nEnsuring that ${link( | ||
"AUTH_SECRET", | ||
"https://authjs.dev/getting-started/installation#setup-environment" | ||
)} is set...` | ||
) | ||
) | ||
const secret = await appleGenSecret({ | ||
teamId, | ||
clientId, | ||
keyId, | ||
privateKey, | ||
expiresInDays, | ||
}) | ||
await secret.action({}) | ||
await updateEnvFile({ AUTH_APPLE_SECRET: secret }) | ||
} else { | ||
const clientId = await promptInput("Client ID") | ||
const clientSecret = await promptPassword("Client Secret") | ||
console.log(y.dim("Updating environment variable file...")) | ||
const varPrefix = `AUTH_${pid.toUpperCase()}` | ||
await updateEnvFile({ | ||
[`${varPrefix}_ID`]: clientId, | ||
[`${varPrefix}_SECRET`]: clientSecret, | ||
}) | ||
} | ||
console.log("\n🎉 Done! You can now use this provider in your app.") | ||
@@ -116,0 +150,0 @@ } catch (error) { |
@@ -59,3 +59,15 @@ // @ts-check | ||
descope: { name: "Descope", setupUrl: undefined }, | ||
discord: { name: "Discord", setupUrl: undefined }, | ||
discord: { | ||
name: "Discord", | ||
setupUrl: "https://discord.com/developers/applications", | ||
instructions: `\ | ||
1. Click on *New Application* | ||
2. Set *Application name* (can be anything) | ||
3. Click on *OAuth2* in the side menu | ||
4. Click on *Add Redirect* and paste the callback URI (on your clipboard) | ||
5. Click on *Save Changes* | ||
6. Copy and paste the *Client ID* | ||
7. Copy and paste the *Client Secret* | ||
`, | ||
}, | ||
dribbble: { name: "Dribbble", setupUrl: undefined }, | ||
@@ -102,3 +114,17 @@ dropbox: { name: "Dropbox", setupUrl: undefined }, | ||
line: { name: "Line", setupUrl: undefined }, | ||
linkedin: { name: "LinkedIn", setupUrl: undefined }, | ||
linkedin: { | ||
name: "LinkedIn", | ||
setupUrl: "https://linkedin.com/developers/apps", | ||
instructions: `\ | ||
1. Click on *Create app* | ||
2. Set *App name* (can be anything) | ||
3. Create a *LinkedIn page* | ||
4. Set *LinkedIn Page URL* (LinkedIn page you created) | ||
5. Set *App logo* (can be anything) | ||
6. Navigate to *Auth* in the top menu | ||
7. Set *Authorized redirect URLs for your app* (paste the callback URI on your clipboard) | ||
8. Copy and paste the *Client ID* | ||
9. Copy and paste the *Primary Client Secret* | ||
`, | ||
}, | ||
mailchimp: { name: "Mailchimp", setupUrl: undefined }, | ||
@@ -105,0 +131,0 @@ mailru: { name: "Mail.ru", setupUrl: undefined }, |
{ | ||
"name": "auth", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"homepage": "https://cli.authjs.dev", | ||
@@ -35,3 +35,3 @@ "repository": { | ||
"dependencies": { | ||
"@inkeep/ai-api": "0.7.2", | ||
"@inkeep/ai-api": "0.8.0", | ||
"@inquirer/prompts": "5.1.0", | ||
@@ -41,5 +41,6 @@ "clipboardy": "4.0.0", | ||
"open": "10.1.0", | ||
"ora": "8.0.1", | ||
"ora": "8.1.0", | ||
"prompts": "2.4.2", | ||
"yoctocolors": "2.1.0" | ||
"yoctocolors": "2.1.1", | ||
"zod": "3.23.8" | ||
}, | ||
@@ -50,3 +51,3 @@ "prettier": { | ||
"devDependencies": { | ||
"@types/node": "^20.14.9" | ||
"@types/node": "18" | ||
}, | ||
@@ -53,0 +54,0 @@ "engines": { |
@@ -71,3 +71,3 @@ <p align="center"> | ||
<a href="https://clerk.com?utm_source=sponsorship&utm_medium=github&utm_campaign=authjs&utm_content=sponsor" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/49538330?s=200&v=4" alt="Clerk Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/49538330?s=200&v=4" alt="Clerk Logo" /> | ||
</a><br /> | ||
@@ -78,4 +78,11 @@ <div>Clerk</div> | ||
<td align="center" valign="top"> | ||
<a href="https://a0.to/signup/nextauthjs" target="_blank"> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/2824157?v=4" alt="Auth0 Logo" /> | ||
</a><br /> | ||
<div>Auth0</div> | ||
<sub>💵</sub> | ||
</td> | ||
<td align="center" valign="top"> | ||
<a href="https://fusionauth.io" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/41974756?s=200&v=4" alt="FusionAuth Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/41974756?s=200&v=4" alt="FusionAuth Logo" /> | ||
</a><br /> | ||
@@ -87,3 +94,3 @@ <div>FusionAuth</div> | ||
<a href="https://www.beyondidentity.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/69811361?s=200&v=4" alt="Beyond Identity Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/69811361?s=200&v=4" alt="Beyond Identity Logo" /> | ||
</a><br /> | ||
@@ -95,3 +102,3 @@ <div>Beyond Identity</div> | ||
<a href="https://stytch.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/69983493?s=200&v=4" alt="Stytch Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/69983493?s=200&v=4" alt="Stytch Logo" /> | ||
</a><br /> | ||
@@ -103,3 +110,3 @@ <div>Stytch</div> | ||
<a href="https://prisma.io" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/17219288?s=200&v=4" alt="Prisma Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/17219288?s=200&v=4" alt="Prisma Logo" /> | ||
</a><br /> | ||
@@ -109,5 +116,7 @@ <div>Prisma</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<a href="https://lowdefy.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/47087496?s=200&v=4" alt="Lowdefy Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/47087496?s=200&v=4" alt="Lowdefy Logo" /> | ||
</a><br /> | ||
@@ -119,3 +128,3 @@ <div>Lowdefy</div> | ||
<a href="https://www.descope.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/97479186?s=200&v=4" alt="Descope Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/97479186?s=200&v=4" alt="Descope Logo" /> | ||
</a><br /> | ||
@@ -125,7 +134,5 @@ <div>Descope</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<a href="https://badass.dev" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/136839242?v=4" alt="Badass Courses Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/136839242?v=4" alt="Badass Courses Logo" /> | ||
</a><br /> | ||
@@ -137,3 +144,3 @@ <div>Badass Courses</div> | ||
<a href="https://github.com/encoredev/encore" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/50438175?v=4" alt="Encore Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/50438175?v=4" alt="Encore Logo" /> | ||
</a><br /> | ||
@@ -151,4 +158,13 @@ <div>Encore</div> | ||
<td align="center" valign="top"> | ||
<a href="https://www.netlight.com/" target="_blank"> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/1672348?s=200&v=4" alt="Netlight logo" /> | ||
</a><br /> | ||
<div>Netlight</div> | ||
<sub>☁️</sub> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="center" valign="top"> | ||
<a href="https://checklyhq.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/25982255?s=200&v=4" alt="Checkly Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/25982255?s=200&v=4" alt="Checkly Logo" /> | ||
</a><br /> | ||
@@ -160,3 +176,3 @@ <div>Checkly</div> | ||
<a href="https://superblog.ai/" target="_blank"> | ||
<img width="108" src="https://d33wubrfki0l68.cloudfront.net/cdc4a3833bd878933fcc131655878dbf226ac1c5/10cd6/images/logo_bolt_small.png" alt="superblog Logo" /> | ||
<img height="96" src="https://d33wubrfki0l68.cloudfront.net/cdc4a3833bd878933fcc131655878dbf226ac1c5/10cd6/images/logo_bolt_small.png" alt="superblog Logo" /> | ||
</a><br /> | ||
@@ -167,11 +183,4 @@ <div>superblog</div> | ||
<td align="center" valign="top"> | ||
<a href="https://www.netlight.com/" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/1672348?s=200&v=4" alt="Netlight logo" /> | ||
</a><br /> | ||
<div>Netlight</div> | ||
<sub>☁️</sub> | ||
</td> | ||
<td align="center" valign="top"> | ||
<a href="https://vercel.com" target="_blank"> | ||
<img width="108" src="https://avatars.githubusercontent.com/u/14985020?s=200&v=4" alt="Vercel Logo" /> | ||
<img height="96" src="https://avatars.githubusercontent.com/u/14985020?s=200&v=4" alt="Vercel Logo" /> | ||
</a><br /> | ||
@@ -178,0 +187,0 @@ <div>Vercel</div> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41633
16
959
196
9
+ Addedzod@3.23.8
+ Added@inkeep/ai-api@0.8.0(transitive)
+ Addedcli-cursor@5.0.0(transitive)
+ Addedmimic-function@5.0.1(transitive)
+ Addedonetime@7.0.0(transitive)
+ Addedora@8.1.0(transitive)
+ Addedrestore-cursor@5.1.0(transitive)
+ Addedyoctocolors@2.1.1(transitive)
+ Addedzod@3.23.8(transitive)
- Removed@inkeep/ai-api@0.7.2(transitive)
- Removedcli-cursor@4.0.0(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedonetime@5.1.2(transitive)
- Removedora@8.0.1(transitive)
- Removedrestore-cursor@4.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedyoctocolors@2.1.0(transitive)
- Removedzod@3.24.1(transitive)
Updated@inkeep/ai-api@0.8.0
Updatedora@8.1.0
Updatedyoctocolors@2.1.1