diff --git a/src/command/deploy.ts b/src/command/deploy.ts index dbe134c..831a62f 100644 --- a/src/command/deploy.ts +++ b/src/command/deploy.ts @@ -46,7 +46,7 @@ const command = new Command('deploy') .option('-u, --update', 'load current app. set current version in product。 redis 缓存更新') .option('-s, --showBackend', 'show backend url, 部署的后端应用,显示执行的cli命令') .option('-d, --dot', '是否上传隐藏文件') - .option('--dir, --directory ', '上传的默认路径') + .option('--dir, --directory ', '上传的prefix路径,默认为空,例如设置为static,则会上传到/${username}/resources/${key}/${version}/static/路径下') .action(async (filePath, options) => { try { let { version, key, yes, update, org, showBackend } = options; @@ -169,7 +169,7 @@ type UploadFileOptions = { }; export const uploadFilesV2 = async (files: string[], directory: string, opts: UploadFileOptions): Promise => { - const { key, version, username } = opts || {}; + const { key, version, username, directory: prefix } = opts || {}; for (let i = 0; i < files.length; i++) { const file = files[i]; @@ -184,7 +184,7 @@ export const uploadFilesV2 = async (files: string[], directory: string, opts: Up filepath: file, }); const _baseURL = getBaseURL(); - const url = new URL(`/${username}/resources/${key}/${version}/${file}`, _baseURL); + const url = new URL(`/${username}/resources/${key}/${version}/${prefix ? prefix + '/' : ''}${file}`, _baseURL); // console.log('upload file', file, filePath); const token = await storage.getItem('token'); const check = () => {