mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
fork refine
This commit is contained in:
36
packages/cli/src/commands/create-resource/index.ts
Normal file
36
packages/cli/src/commands/create-resource/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Command } from "commander";
|
||||
import { getProjectType } from "@utils/project";
|
||||
import { getResourcePath } from "@utils/resource";
|
||||
import { createResources } from "@commands/add/create-resource";
|
||||
|
||||
const load = (program: Command) => {
|
||||
const projectType = getProjectType();
|
||||
const { path } = getResourcePath(projectType);
|
||||
|
||||
return program
|
||||
.command("create-resource")
|
||||
.allowExcessArguments(true)
|
||||
.description(
|
||||
`Create a new resource files (deprecated, please use "add resource" command)`,
|
||||
)
|
||||
.option(
|
||||
"-a, --actions [actions]",
|
||||
"Only generate the specified actions. (ex: list,create,edit,show)",
|
||||
"list,create,edit,show",
|
||||
)
|
||||
.option(
|
||||
"-p, --path [path]",
|
||||
"Path to generate the resource files",
|
||||
path,
|
||||
)
|
||||
.action(action);
|
||||
};
|
||||
|
||||
const action = async (
|
||||
params: { actions: string; path: string },
|
||||
options: Command,
|
||||
) => {
|
||||
createResources(params, options.args);
|
||||
};
|
||||
|
||||
export default load;
|
||||
Reference in New Issue
Block a user