del: node modle

This commit is contained in:
wwweww
2026-02-21 23:19:15 +08:00
parent 55e8053e07
commit 2021a6a782
1004 changed files with 143 additions and 96231 deletions
+21 -3
View File
@@ -13,8 +13,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const { values } = parseArgs({
args: process.argv.slice(3),
options: {
server: { type: "string", short: "s", multiple: true },
type: { type: "string", short: "t" },
server: { type: "string", short: "s", multiple: true }, // 服务名称
type: { type: "string", short: "t" }, // 生成类型:api, rpc, docker
imageName: { type: "string", short: "i" }, // 镜像名字
}
})
@@ -145,7 +146,7 @@ async function searchSelector(chooses, message) {
async function generateHandle() {
const type = values.type;
if (!type || !GenerateConfig[type]) {
console.log("Please specify valid -t <api|rpc|docker>");
console.error("Please specify valid -t <api|rpc|docker>");
return;
}
const config = GenerateConfig[type];
@@ -157,6 +158,10 @@ async function generateHandle() {
await config.generate(input);
}
async function buildImage(imageName) {
await run("docker", ["build", "-t", imageName, "."])
}
export const init = task({
name: "init",
@@ -174,6 +179,19 @@ export const tidy = task({
})
export const build = task({
name: "build",
desc: "build docker image",
run: async () => {
if (values.imageName) {
buildImage(values.imageName);
} else {
console.error("Please specify image name with -i <imageName>");
}
}
})
export const gen = task({
name: "gen",
desc: "generate API/RPC service code",