publish 功能
This commit is contained in:
+19
-2
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user