1 #!/usr/bin/env node
2 import { Option, program } from "commander"
3 import create from "./commands/create.js"
4
5 program
6 .description("Create a new Medusa project or plugin")
7 .argument("[project-name]", "Name of the project to create.")
8 .option("--plugin", "Create a plugin instead of a project.")
9 .option("--repo-url <url>", "URL of repository to use to setup project.")
10 .option("--version <version>", "The version of Medusa packages to install.")
11 .option("--seed", "Seed the created database with demo data.")
12 .option(
13 "--skip-db",
14 "Skips creating the database, running migrations, and seeding, and subsequently skips opening the browser.",
15 false
16 )
17 .option(
18 "--db-url <url>",
19 "Skips database creation and sets the database URL to the provided URL. Throws an error if can't connect to the database. Will still run migrations and open the admin after project creation."
20 )
21 .option(
22 "--no-migrations",
23 "Skips running migrations, creating admin user, and seeding. If used, it's expected that you pass the --db-url option with a url of a database that has all necessary migrations. Otherwise, unexpected errors will occur.",
24 true
25 )
26 .option(
27 "--no-browser",
28 "Disables opening the browser at the end of the project creation and only shows success message.",
29 true
30 )
31 .option(
32 "--directory-path <path>",
33 "Specify the directory path to install the project in."
34 )
35 .option(
36 "--with-nextjs-starter",
37 "Install the storefront along with the Medusa backend",
38 false
39 )
40 .option(
41 "--verbose",
42 "Show all logs of underlying commands. Useful for debugging.",
43 false
44 )
45 .addOption(
46 new Option("--use-npm", "Use npm as the package manager").conflicts([
47 "usePnpm",
48 "useYarn",
49 ])
50 )
51 .addOption(
52 new Option("--use-yarn", "Use yarn as the package manager").conflicts([
53 "useNpm",
54 "usePnpm",
55 ])
56 )
57 .addOption(
58 new Option("--use-pnpm", "Use pnpm as the package manager").conflicts([
59 "useNpm",
60 "useYarn",
61 ])
62 )
63 .parse()
64
65 void create(program.args, program.opts())