fix(create-medusa-app): ensure the same package manager is used consistently (#12714)
* fix(create-medusa-app): ensure the same package manager is used consistently * fix verbose not working as expected * improvements * remove legacy peer deps * format
This commit is contained in:
@@ -3,6 +3,7 @@ import path from "path"
|
||||
import createAbortController from "../create-abort-controller.js"
|
||||
import { FactBoxOptions } from "../facts.js"
|
||||
import ProcessManager from "../process-manager.js"
|
||||
import PackageManager from "../package-manager.js"
|
||||
|
||||
export interface ProjectOptions {
|
||||
repoUrl?: string
|
||||
@@ -25,6 +26,7 @@ export interface ProjectCreator {
|
||||
export abstract class BaseProjectCreator {
|
||||
protected spinner: Ora
|
||||
protected processManager: ProcessManager
|
||||
protected packageManager: PackageManager
|
||||
protected abortController: AbortController
|
||||
protected factBoxOptions: FactBoxOptions
|
||||
protected projectName: string
|
||||
@@ -39,6 +41,7 @@ export abstract class BaseProjectCreator {
|
||||
) {
|
||||
this.spinner = ora()
|
||||
this.processManager = new ProcessManager()
|
||||
this.packageManager = new PackageManager(this.processManager)
|
||||
this.abortController = createAbortController(this.processManager)
|
||||
this.projectName = projectName
|
||||
const basePath =
|
||||
|
||||
@@ -72,6 +72,7 @@ export class PluginProjectCreator
|
||||
processManager: this.processManager,
|
||||
abortController: this.abortController,
|
||||
verbose: this.options.verbose,
|
||||
packageManager: this.packageManager,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ export class MedusaProjectCreator
|
||||
nextjsDirectory: this.nextjsDirectory,
|
||||
client: this.client,
|
||||
verbose: this.options.verbose,
|
||||
packageManager: this.packageManager,
|
||||
})
|
||||
} finally {
|
||||
await this.client?.end()
|
||||
@@ -214,18 +215,19 @@ export class MedusaProjectCreator
|
||||
}
|
||||
|
||||
protected showSuccessMessage(): void {
|
||||
const commandStr = this.packageManager.getCommandStr(`dev`)
|
||||
logMessage({
|
||||
message: boxen(
|
||||
chalk.green(
|
||||
`Change to the \`${
|
||||
this.projectName
|
||||
}\` directory to explore your Medusa project.${EOL}${EOL}Start your Medusa application again with the following command:${EOL}${EOL}yarn dev${EOL}${EOL}${
|
||||
}\` directory to explore your Medusa project.${EOL}${EOL}Start your Medusa application again with the following command:${EOL}${EOL}${commandStr}${EOL}${EOL}${
|
||||
this.inviteToken
|
||||
? `After you start the Medusa application, you can create an admin user with the URL http://localhost:9000/app/invite?token=${this.inviteToken}&first_run=true${EOL}${EOL}`
|
||||
: ""
|
||||
}${
|
||||
this.nextjsDirectory?.length
|
||||
? `The Next.js Starter Storefront was installed in the \`${this.nextjsDirectory}\` directory. Change to that directory and start it with the following command:${EOL}${EOL}npm run dev${EOL}${EOL}`
|
||||
? `The Next.js Starter Storefront was installed in the \`${this.nextjsDirectory}\` directory. Change to that directory and start it with the following command:${EOL}${EOL}${commandStr}${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`
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user