feat(create-medusa-app): remove admin email prompt (#7417)
* feat(create-medusa-app): remove admin email prompt * change to constant
This commit is contained in:
@@ -29,7 +29,6 @@ import {
|
||||
} from "../utils/nextjs-utils.js"
|
||||
|
||||
const slugify = slugifyType.default
|
||||
const isEmail = isEmailImported.default
|
||||
|
||||
export type CreateOptions = {
|
||||
repoUrl?: string
|
||||
@@ -95,8 +94,6 @@ export default async ({
|
||||
|
||||
const projectName = await askForProjectName(directoryPath)
|
||||
const projectPath = getProjectPath(projectName, directoryPath)
|
||||
const adminEmail =
|
||||
!skipDb && migrations ? await askForAdminEmail(seed, boilerplate) : ""
|
||||
const installNextjs = withNextjsStarter || (await askForNextjsStarter())
|
||||
|
||||
let { client, dbConnectionString } = !skipDb
|
||||
@@ -178,9 +175,6 @@ export default async ({
|
||||
inviteToken = await prepareProject({
|
||||
directory: projectPath,
|
||||
dbConnectionString,
|
||||
admin: {
|
||||
email: adminEmail,
|
||||
},
|
||||
seed,
|
||||
boilerplate,
|
||||
spinner,
|
||||
@@ -286,27 +280,6 @@ async function askForProjectName(directoryPath?: string): Promise<string> {
|
||||
return projectName
|
||||
}
|
||||
|
||||
async function askForAdminEmail(
|
||||
seed?: boolean,
|
||||
boilerplate?: boolean
|
||||
): Promise<string> {
|
||||
const { adminEmail } = await inquirer.prompt([
|
||||
{
|
||||
type: "input",
|
||||
name: "adminEmail",
|
||||
message: "Enter an email for your admin dashboard user",
|
||||
default: !seed && boilerplate ? "admin@medusa-test.com" : undefined,
|
||||
validate: (input) => {
|
||||
return typeof input === "string" && input.length > 0 && isEmail(input)
|
||||
? true
|
||||
: "Please enter a valid email"
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
return adminEmail
|
||||
}
|
||||
|
||||
function showSuccessMessage(
|
||||
projectName: string,
|
||||
inviteToken?: string,
|
||||
|
||||
@@ -9,12 +9,11 @@ import ProcessManager from "./process-manager.js"
|
||||
import { clearProject } from "./clear-project.js"
|
||||
import type { Client } from "pg"
|
||||
|
||||
const ADMIN_EMAIL = "admin@medusa-test.com"
|
||||
|
||||
type PrepareOptions = {
|
||||
directory: string
|
||||
dbConnectionString: string
|
||||
admin?: {
|
||||
email: string
|
||||
}
|
||||
seed?: boolean
|
||||
boilerplate?: boolean
|
||||
spinner: Ora
|
||||
@@ -31,7 +30,6 @@ type PrepareOptions = {
|
||||
export default async ({
|
||||
directory,
|
||||
dbConnectionString,
|
||||
admin,
|
||||
seed,
|
||||
boilerplate,
|
||||
spinner,
|
||||
@@ -186,7 +184,7 @@ export default async ({
|
||||
})
|
||||
}
|
||||
|
||||
if (admin && !skipDb && migrations) {
|
||||
if (!skipDb && migrations) {
|
||||
// create admin user
|
||||
factBoxOptions.interval = displayFactBox({
|
||||
...factBoxOptions,
|
||||
@@ -197,7 +195,7 @@ export default async ({
|
||||
process: async () => {
|
||||
const proc = await execute(
|
||||
[
|
||||
`npx medusa user -e ${admin.email} --invite`,
|
||||
`npx medusa user -e ${ADMIN_EMAIL} --invite`,
|
||||
npxOptions,
|
||||
],
|
||||
{ verbose, needOutput: true }
|
||||
|
||||
Reference in New Issue
Block a user