breaking: remove deprecated commands and code (#9521)
* breaking: remove deprecated commands * feat: remove deprecated code and usages * refactor: remove more logic around default relations * fix tests * remove log * fix: remove defaultFields usage * fix: add back accidentally removed code * refactor: implement feedback * feat: add --cluster flag to the start command * refactor: assign limit to defaultLimit property * fix: breaking code because of removed check --------- Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { sync as existsSync } from "fs-exists-cached"
|
||||
import { setTelemetryEnabled } from "medusa-telemetry"
|
||||
import path from "path"
|
||||
|
||||
import resolveCwd from "resolve-cwd"
|
||||
import { newStarter } from "./commands/new"
|
||||
import { didYouMean } from "./did-you-mean"
|
||||
@@ -278,66 +277,6 @@ function buildLocalCommands(cli, isLocalProject) {
|
||||
)
|
||||
}),
|
||||
})
|
||||
.command({
|
||||
command: `seed`,
|
||||
desc: `Migrates and populates the database with the provided file.`,
|
||||
builder: (_) =>
|
||||
_.option(`f`, {
|
||||
alias: `seed-file`,
|
||||
type: `string`,
|
||||
describe: `Path to the file where the seed is defined.`,
|
||||
required: true,
|
||||
}).option(`m`, {
|
||||
alias: `migrate`,
|
||||
type: `boolean`,
|
||||
default: true,
|
||||
describe: `Flag to indicate if migrations should be run prior to seeding the database`,
|
||||
}),
|
||||
handler: handlerP(
|
||||
getCommandHandler(`seed`, (args, cmd) => {
|
||||
process.env.NODE_ENV ??= `development`
|
||||
return cmd(args)
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `migrations [action] [modules...]`,
|
||||
desc: `Manage migrations from the core and your own project`,
|
||||
builder: {
|
||||
action: {
|
||||
demand: true,
|
||||
description: "The action to perform on migrations",
|
||||
choices: ["run", "revert", "show", "generate"],
|
||||
},
|
||||
modules: {
|
||||
description: "Modules for which to run the action (revert, generate)",
|
||||
demand: false,
|
||||
},
|
||||
},
|
||||
handler: handlerP(
|
||||
getCommandHandler(`migrate`, (args, cmd) => {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || `development`
|
||||
return cmd(args)
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `links [action]`,
|
||||
desc: `Manage migrations for the links from the core, your project and packages`,
|
||||
builder: {
|
||||
action: {
|
||||
demand: true,
|
||||
description: "The action to perform on links",
|
||||
choices: ["sync"],
|
||||
},
|
||||
},
|
||||
handler: handlerP(
|
||||
getCommandHandler(`links`, (args, cmd) => {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || `development`
|
||||
return cmd(args)
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `develop`,
|
||||
desc: `Start development server. Watches file and rebuilds when something changes`,
|
||||
@@ -397,6 +336,12 @@ function buildLocalCommands(cli, isLocalProject) {
|
||||
describe: process.env.PORT
|
||||
? `Set port. Defaults to ${process.env.PORT} (set by env.PORT) (otherwise defaults ${defaultPort})`
|
||||
: `Set port. Defaults to ${defaultPort}`,
|
||||
})
|
||||
.option(`cluster`, {
|
||||
type: `number`,
|
||||
default: process.env.CPUS,
|
||||
describe:
|
||||
"Start the Node.js server in cluster mode. You can specify the number of cpus to use, which defaults to (env.CPUS)",
|
||||
}),
|
||||
handler: handlerP(
|
||||
getCommandHandler(`start`, (args, cmd) => {
|
||||
@@ -422,42 +367,6 @@ function buildLocalCommands(cli, isLocalProject) {
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `start-cluster`,
|
||||
desc: `Start development server in cluster mode (beta).`,
|
||||
builder: (_) =>
|
||||
_.option(`H`, {
|
||||
alias: `host`,
|
||||
type: `string`,
|
||||
default: defaultHost,
|
||||
describe: `Set host. Defaults to ${defaultHost}`,
|
||||
})
|
||||
.option(`p`, {
|
||||
alias: `port`,
|
||||
type: `string`,
|
||||
default: process.env.PORT || defaultPort,
|
||||
describe: process.env.PORT
|
||||
? `Set port. Defaults to ${process.env.PORT} (set by env.PORT) (otherwise defaults ${defaultPort})`
|
||||
: `Set port. Defaults to ${defaultPort}`,
|
||||
})
|
||||
.option(`c`, {
|
||||
alias: `cpus`,
|
||||
type: `number`,
|
||||
default: process.env.CPUS,
|
||||
describe:
|
||||
"Set number of cpus to use. Defaults to max number of cpus available on the system (set by env.CPUS)",
|
||||
}),
|
||||
handler: handlerP(
|
||||
getCommandHandler(`start-cluster`, (args, cmd) => {
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || `development`
|
||||
cmd(args)
|
||||
// Return an empty promise to prevent handlerP from exiting early.
|
||||
// The development server shouldn't ever exit until the user directly
|
||||
// kills it so this is fine.
|
||||
return new Promise((resolve) => {})
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `user`,
|
||||
desc: `Create a user`,
|
||||
|
||||
Reference in New Issue
Block a user