引入
ts
import { localPublish } from 't-comm';
// 不支持 tree-shaking 的项目
import { localPublish} from 't-comm/lib/publish/index';
// 只支持 ESM 的项目
import { localPublish} from 't-comm/es/publish/index';localPublish(options)
描述:本地发布模块到测试/生产环境 读取环境变量配置,打包并发布静态资源到指定路径
参数:
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| options | IPublishOptions | 发布配置选项 | |
| [options.publishEnv] | string | "'test'" | 发布环境,'test' 或 'prod' |
| [options.fileTar] | string | 自定义 tar 文件路径 | |
| [options.fileDir] | string | 自定义文件目录路径 |
示例
ts
await localPublish({
publishEnv: 'test',
});