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:
1 parent
b0209e1114
commit
9cbe0085d0
2 files changed
+4
-33
No files matched your search
@@ -29,7 +29,6 @@ import {
|
|||||||
} from "../utils/nextjs-utils.js"
|
} from "../utils/nextjs-utils.js"
|
||||||
|
|
||||||
const slugify = slugifyType.default
|
const slugify = slugifyType.default
|
||||||
const isEmail = isEmailImported.default
|
|
||||||
|
|
||||||
export type CreateOptions = {
|
export type CreateOptions = {
|
||||||
repoUrl?: string
|
repoUrl?: string
|
||||||
@@ -95,8 +94,6 @@ export default async ({
|
|||||||
|
|
||||||
const projectName = await askForProjectName(directoryPath)
|
const projectName = await askForProjectName(directoryPath)
|
||||||
const projectPath = getProjectPath(projectName, directoryPath)
|
const projectPath = getProjectPath(projectName, directoryPath)
|
||||||
const adminEmail =
|
|
||||||
!skipDb && migrations ? await askForAdminEmail(seed, boilerplate) : ""
|
|
||||||
const installNextjs = withNextjsStarter || (await askForNextjsStarter())
|
const installNextjs = withNextjsStarter || (await askForNextjsStarter())
|
||||||
|
|
||||||
let { client, dbConnectionString } = !skipDb
|
let { client, dbConnectionString } = !skipDb
|
||||||
@@ -178,9 +175,6 @@ export default async ({
|
|||||||
inviteToken = await prepareProject({
|
inviteToken = await prepareProject({
|
||||||
directory: projectPath,
|
directory: projectPath,
|
||||||
dbConnectionString,
|
dbConnectionString,
|
||||||
admin: {
|
|
||||||
email: adminEmail,
|
|
||||||
},
|
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
boilerplate,
|
||||||
spinner,
|
spinner,
|
||||||
@@ -286,27 +280,6 @@ async function askForProjectName(directoryPath?: string): Promise<string> {
|
|||||||
return projectName
|
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(
|
function showSuccessMessage(
|
||||||
projectName: string,
|
projectName: string,
|
||||||
inviteToken?: string,
|
inviteToken?: string,
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ import ProcessManager from "./process-manager.js"
|
|||||||
import { clearProject } from "./clear-project.js"
|
import { clearProject } from "./clear-project.js"
|
||||||
import type { Client } from "pg"
|
import type { Client } from "pg"
|
||||||
|
|
||||||
|
const ADMIN_EMAIL = "admin@medusa-test.com"
|
||||||
|
|
||||||
type PrepareOptions = {
|
type PrepareOptions = {
|
||||||
directory: string
|
directory: string
|
||||||
dbConnectionString: string
|
dbConnectionString: string
|
||||||
admin?: {
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
seed?: boolean
|
seed?: boolean
|
||||||
boilerplate?: boolean
|
boilerplate?: boolean
|
||||||
spinner: Ora
|
spinner: Ora
|
||||||
@@ -31,7 +30,6 @@ type PrepareOptions = {
|
|||||||
export default async ({
|
export default async ({
|
||||||
directory,
|
directory,
|
||||||
dbConnectionString,
|
dbConnectionString,
|
||||||
admin,
|
|
||||||
seed,
|
seed,
|
||||||
boilerplate,
|
boilerplate,
|
||||||
spinner,
|
spinner,
|
||||||
@@ -186,7 +184,7 @@ export default async ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (admin && !skipDb && migrations) {
|
if (!skipDb && migrations) {
|
||||||
// create admin user
|
// create admin user
|
||||||
factBoxOptions.interval = displayFactBox({
|
factBoxOptions.interval = displayFactBox({
|
||||||
...factBoxOptions,
|
...factBoxOptions,
|
||||||
@@ -197,7 +195,7 @@ export default async ({
|
|||||||
process: async () => {
|
process: async () => {
|
||||||
const proc = await execute(
|
const proc = await execute(
|
||||||
[
|
[
|
||||||
`npx medusa user -e ${admin.email} --invite`,
|
`npx medusa user -e ${ADMIN_EMAIL} --invite`,
|
||||||
npxOptions,
|
npxOptions,
|
||||||
],
|
],
|
||||||
{ verbose, needOutput: true }
|
{ verbose, needOutput: true }
|
||||||
|
|||||||
Reference in new issue
Block a user