Skip to content

引入

ts
import { getCopyTargetDirs } from 't-comm';

// 不支持 tree-shaking 的项目
import { getCopyTargetDirs} from 't-comm/lib/sync-cos/index';

// 只支持 ESM 的项目
import { getCopyTargetDirs} from 't-comm/es/sync-cos/index';

getCopyTargetDirs(copySourceDir, domainDir)

描述:获取复制目标路径

参数

参数名描述
copySourceDir复制源目录,注意,这里是绝对路径
domainDir域名目录,注意,这里是绝对路径

返回: 要复制的列表,注意,这里是相对路径,如 ['os-x/en', 'os-x/zh-hant']

示例

ts
// 假设 /tmp/dist/os-x 下有 en、zh-hans、zh-hant 三个语言目录
getCopyTargetDirs(
  '/tmp/dist/os-x/zh-hans',
  '/tmp/dist',
);
// ['os-x/en', 'os-x/zh-hant']

// 仅保留指定前缀
getCopyTargetDirs(
  '/tmp/dist/os-x/zh-hans',
  '/tmp/dist',
  { copyTargetPrefix: 'os-x/zh-' },
);
// ['os-x/zh-hant']