publish 功能

This commit is contained in:
Cheney
2025-03-13 11:27:11 +08:00
parent 5f5e73e1c9
commit 5ff621c05b
5 changed files with 152 additions and 76 deletions
+19 -2
View File
@@ -82,7 +82,24 @@ async function main(){
}
});
parser.addCmdLine("publish", "发布到远程仓库;", async function () {
parser.addCmdLine("publish [localFile] [remotePath]", "发布到远程仓库;", async function (cli) {
const fs = require("fs");
let localFile = cli.getParamValue("localFile");
if ( ! fs.existsSync(localFile) ) {
$logger.error("本地文件不存在")
return
}
let remotePath = cli.getParamValue("remotePath");
if ( ! remotePath ) {
$logger.info("使用本地配置路径")
if ( ! fs.existsSync("meta.json") ) {
$logger.error("没有找到本地配置")
return
}
} else {
$logger.info("发布到远程路径" + remotePath)
}
let remote = await $context.get("remote")
if (!(await remote.check())) {
$logger.error("远程仓库不可用")
@@ -90,7 +107,7 @@ async function main(){
} else {
$logger.info("远程仓库可用")
}
remote.publish()
await remote.publish(localFile, remotePath)
});
parser.addCmdLine("install [module]", "安装/更新模块;", async function (cli) {
let remote = await $context.get("remote")