feat(create-medusa-app): install v2 by default (#7381)

- Remove `v2` option and install V2 starter branch by default.
- Use new `exec` command to seed data
- Install v2 branch of next.js starter if the option is provided.
- Change the opened browser to `localhost:9000/app`.
- Added a bunch of todos for onboarding flows once we have that
This commit is contained in:
Shahed Nasser
2024-05-21 22:45:43 +03:00
committed by GitHub
parent 1f43290cec
commit e443a7be3f
8 changed files with 82 additions and 105 deletions

View File

@@ -34,7 +34,6 @@ const isEmail = isEmailImported.default
export type CreateOptions = {
repoUrl?: string
seed?: boolean
// commander passed --no-boilerplate as boilerplate
boilerplate?: boolean
skipDb?: boolean
dbUrl?: string
@@ -43,7 +42,6 @@ export type CreateOptions = {
directoryPath?: string
withNextjsStarter?: boolean
verbose?: boolean
v2?: boolean
}
export default async ({
@@ -57,7 +55,6 @@ export default async ({
directoryPath,
withNextjsStarter = false,
verbose = false,
v2 = false,
}: CreateOptions) => {
track("CREATE_CLI_CMA")
@@ -142,7 +139,6 @@ export default async ({
abortController,
spinner,
verbose,
v2,
})
} catch {
return
@@ -159,6 +155,7 @@ export default async ({
abortController,
factBoxOptions,
verbose,
processManager
})
: ""
@@ -195,7 +192,6 @@ export default async ({
nextjsDirectory,
client,
verbose,
v2,
})
} catch (e: any) {
if (isAbortError(e)) {
@@ -257,14 +253,10 @@ export default async ({
await waitOn({
resources: ["http://localhost:9000/health"],
}).then(async () => {
if (v2) {
return
}
open(
inviteToken
? `http://localhost:7001/invite?token=${inviteToken}&first_run=true`
: "http://localhost:7001"
? `http://localhost:9000/app/invite?token=${inviteToken}&first_run=true`
: "http://localhost:9000/app"
)
})
}
@@ -324,7 +316,7 @@ function showSuccessMessage(
message: boxen(
chalk.green(
// eslint-disable-next-line prettier/prettier
`Change to the \`${projectName}\` directory to explore your Medusa project.${EOL}${EOL}Start your Medusa app again with the following command:${EOL}${EOL}npx @medusajs/medusa-cli develop${EOL}${EOL}${inviteToken ? `After you start the Medusa app, you can set a password for your admin user with the URL ${getInviteUrl(inviteToken)}${EOL}${EOL}` : ""}${nextjsDirectory?.length ? `The Next.js Starter storefront was installed in the \`${nextjsDirectory}\` directory. Change to that directory and start it with the following command:${EOL}${EOL}npm run dev${EOL}${EOL}` : ""}Check out the Medusa documentation to start your development:${EOL}${EOL}https://docs.medusajs.com/${EOL}${EOL}Star us on GitHub if you like what we're building:${EOL}${EOL}https://github.com/medusajs/medusa/stargazers`
`Change to the \`${projectName}\` directory to explore your Medusa project.${EOL}${EOL}Start your Medusa app again with the following command:${EOL}${EOL}yarn dev${EOL}${EOL}${inviteToken ? `After you start the Medusa app, you can set a password for your admin user with the URL ${getInviteUrl(inviteToken)}${EOL}${EOL}` : ""}${nextjsDirectory?.length ? `The Next.js Starter storefront was installed in the \`${nextjsDirectory}\` directory. Change to that directory and start it with the following command:${EOL}${EOL}npm run dev${EOL}${EOL}` : ""}Check out the Medusa documentation to start your development:${EOL}${EOL}https://docs.medusajs.com/${EOL}${EOL}Star us on GitHub if you like what we're building:${EOL}${EOL}https://github.com/medusajs/medusa/stargazers`
),
{
titleAlignment: "center",