t-comm
Version:
专业、稳定、纯粹的工具库
69 lines (68 loc) • 1.8 kB
TypeScript
import type { ReplaceContentOption } from './types';
/**
* 替换文件内容
* 批量替换目标项目中指定文件的内容
* @param replaceList - 替换配置列表
* @param targetProject - 目标项目路径
* @example
* ```ts
* replaceContent({
* replaceList: [
* {
* dirList: ['src/*.ts'],
* from: 'old-text',
* to: 'new-text'
* }
* ],
* targetProject: '/path/to/project'
* });
* ```
*/
export declare function replaceContent({ replaceList, targetProject, }: {
replaceList: ReplaceContentOption[];
targetProject: string;
}): void;
/**
* 在目标项目中执行命令
* @param command - 要执行的命令
* @param targetProject - 目标项目路径
* @example
* ```ts
* execCommandInTarget('npm install', '/path/to/project');
* ```
*/
export declare function execCommandInTarget(command: string, targetProject: string): void;
/**
* 替换单个内容
* 在指定目录列表中替换文件内容
* @param dirList - 目录列表
* @param to - 替换为的内容
* @param from - 要被替换的内容
* @param targetProject - 目标项目路径
* @example
* ```ts
* replaceEachContent({
* dirList: ['src', 'lib'],
* from: '@old/package',
* to: '@new/package',
* targetProject: '/path/to/project'
* });
* ```
*/
export declare function replaceEachContent({ dirList, to, from, targetProject, }: {
dirList: string[];
to: ReplaceContentOption['to'];
from: ReplaceContentOption['from'];
targetProject: string;
}): void;
/**
* 输出日志信息
* 带有信息图标的日志输出
* @param content - 日志内容
* @param args - 额外参数
* @example
* ```ts
* log('正在处理...', 'file.ts');
* ```
*/
export declare function log(content: string, ...args: string[]): void;