UNPKG

@winner-fed/deploy-cli

Version:

CLI tool for deploy.

121 lines (112 loc) 3.66 kB
import { deployOptions, variables } from '@winner-fed/winner-deploy'; import { UserConfig as UserConfig$1 } from '@winner-fed/ftp-deploy'; /** * types * @Author: liwb (lwbhtml@163.com) * @Date: 2023-01-09 10:10 * @LastEditTime: 2023-01-09 10:10 * @Description: types */ interface SeeConfig extends deployOptions { /** * 自定义变量配置文件,主要是针对工程配置文件,比如 config.local.js/sysconfig.js */ configTemplate?: string | undefined; /** * deploy.xml模板变量, 可以动态配置 */ variables?: Array<variables> | undefined; /** * 是否支持生成 Docker 容器化包 * @default false */ isDocker?: boolean; /** * 构建版本 */ buildVersion: string; /** * 是否为生产包,默认为测试包 * * 测试包及生产包的主要区别在于 包名。 * 测试包:主要是提供给测试人员用的,包名是构建带时间串和gitcommitid的。如 hscs-company-web-V202101-00-000-20211201092557.ea48d3ef.zip * 生产包:主要是用于生产环境部署的,包名不带时间串和gitcommitid的。如 hscs-company-web-V202101-00-000.zip */ isProduction?: boolean; /** * 构建完 see 包的回调函数 */ cb?: () => {}; } interface UserConfig { source: string; /** * see config */ seeConfig: SeeConfig; /** * ftp config */ ftpConfig: UserConfig$1; /** * Use a custom config filename */ config?: string; } /** * cli * @Author: liwb (lwbhtml@163.com) * @Date: 2023-01-09 09:43 * @LastEditTime: 2023-01-09 09:43 * @Description: cli for deploy */ declare const cli: (defaultAppConfig: UserConfig) => void; /** * defineConfig * @Author: liwb (lwbhtml@163.com) * @Date: 2023-01-09 13:42 * @LastEditTime: 2023-01-09 13:42 * @Description: defineConfig */ declare const defineConfig: (config: Partial<UserConfig>) => Partial<UserConfig>; declare function generateGUID(): string; declare function formatDate(date: 'string' | number | Date, fmt: string): string; /** * util * @Author: liwb (lwbhtml@163.com) * @Date: 2023-01-09 10:18 * @LastEditTime: 2025-07-11 10:18 * @Description: util */ declare const isGitSync: (dir: string) => { isGit: boolean; gitRoot?: string | undefined; }; declare const getGitHash: (gitRoot?: string) => string; declare const transformTime: (cwd: string) => string; /** * 生成发布物的相关信息 * @param source * @param system * @param type * @param version * @param name * @param description * @param outputName * @param configName * @param isDocker * @param buildVersion * @param isProduction * @param variables * @param configTemplate * @returns {{seePackageName: string, seePackageOptions: {system, templateFunc: ((function(): (string|string))|*), variablesFunc: ((function(): (*|[]|undefined))|*), name, description: string, type, version}}} */ declare function generateSeePackageInfo(source: string, { system, type, version, name, description, outputName, configName, isDocker, buildVersion, isProduction, variables, configTemplate }: SeeConfig): any; /** * 构建 docker 包时,拷贝 dist 目录里的内容到 docker/html 目录 * 1. 先移除 docker/html 文件夹 * 2. 拷贝 dist 目录里的内容到 docker/html 目录下 * cp -r dist docker/html 命令的 js 版本 */ declare function copyDistToDocker(cwd: string, outputName?: string): void; export { type SeeConfig, type UserConfig, cli, copyDistToDocker, defineConfig, formatDate, generateGUID, generateSeePackageInfo, getGitHash, isGitSync, transformTime };