UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

61 lines (60 loc) 1.92 kB
/** * 从 package.json 中解析需要打包的文件列表 * @param {object} options 配置 * @param {string} [options.root] 项目根目录,默认为 process.cwd() * @returns {Array<string>} 文件列表 * @example * ```ts * // 使用当前工作目录的 package.json * const files = resolveFiles(); * // ['dist', 'README.md', '.env.local'] * * // 指定项目根目录 * const files2 = resolveFiles({ root: '/path/to/project' }); * ``` */ export declare function resolveFiles({ root, }?: { root?: string; }): any; export declare function build({ files, root, bundleName, outputDir, }: { files?: Array<string>; root?: string; bundleName: string; outputDir?: string; }): Promise<unknown>; export declare function upload({ root, bundleName, hostName, hostPwd, hostTargetDir, wrapHostPwd, outputDir, }: { root: string; bundleName: string; hostName: string; hostPwd: string; hostTargetDir?: string; wrapHostPwd?: boolean; outputDir?: string; }): void; /** * 打包并上传到服务器 * @param {object} options 配置 * @param {string} options.hostName 服务器名称 * @param {string} options.hostPwd 服务器密码 * @param {string} [options.root] 项目根目录 * @param {string} [options.bundleName] 打包文件名称 * @param {boolean} [options.wrapHostPwd=true] 是否用双引号包裹密码,默认为 true * @param {string} [options.outputDir='dist'] 打包输出目录,默认为 'dist' * @example * * await buildAndUpload({ * hostName: '9.9.9.9', * hostPwd: 'xxxx', * bundleName: 'cron-job-svr', * }); * */ export declare function buildAndUpload({ root, bundleName, hostName, hostPwd, hostTargetDir, wrapHostPwd, outputDir, }: { root?: string; bundleName?: string; hostName: string; hostPwd: string; hostTargetDir: string; wrapHostPwd?: boolean; outputDir?: string; }): Promise<any>;