only for @gem-mine/cli-service-remote
用于在线创建项目
``js`
const {
getTemplateList,
getPrompt,
createProject
} = require('@gem-mine/cli-api')
- function getTemplateList(query): Promise
获取模板信息,query可以是templateID,也是可以templateName
- function resetCache(): Promise
清除模板信息缓存
- function getPrompt(templateId): Promise
获取模板提问
- function createProject(templateId, answer): Promise
返回CDN zip压缩文件地址
预期错误对象应有error.code属性,对应ErrorCode中的键值
`js`
const { ErrorCode } = require('@gem-mine/cli-api')
错误信息列表参考如下
`js``
const ErrorCode = {
'SERVER_ERROR': 'SERVER_ERROR', // 服务器查询错误
'NO_FOUND_TEMPLATE': 'NO_FOUND_TEMPLATE', // 未找到模板
'GIT_CLONE_ERROR': 'GIT_CLONE_ERROR', // clone模板失败
'TEMPLATE_INSTALL_ERROR': 'TEMPLATE_INSTALL_ERROR', //安装模板失败
'UPLOAD_CDN_ERROR': 'UPLOAD_CDN_ERROR', // 上传CDN失败
'CLI_ERROR': 'CLI_ERROR' // CLI执行失败
}