本文整理汇总了TypeScript中klaw-sync.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: klawSync
srcPaths.forEach(srcPath => {
klawSync(srcPath, {
nodir: false,
filter: item => {
if (config.hasSubDir && item.stats.isDirectory()) return true;
return (
path.extname(item.path) === '.md' &&
item.stats.size > 1 &&
!item.path.includes(`${path.sep}demo${path.sep}`)
);
},
}).filter(item => path.extname(item.path) === '.md').forEach(item => {
const key = path
.relative(
srcPath,
config.hasSubDir ? path.dirname(item.path) : item.path.split('.')[0],
)
.trim();
if (key.length === 0) return;
if (isSyncSpecific && key !== target) return;
if (config.ignores && ~config.ignores.indexOf(key)) return;
let sourceItem = files.find(w => w.key === key);
if (!sourceItem) {
sourceItem = {
key,
data: {},
};
files.push(sourceItem);
}
const langMatch = item.path.match(langRe);
sourceItem.data[langMatch ? langMatch[1] : siteConfig.defaultLang] =
item.path;
});
});
示例2: setupFixtureRepository
export function setupFixtureRepository(repositoryName: string): string {
const testRepoFixturePath = Path.join(__dirname, 'fixtures', repositoryName)
const testRepoPath = temp.mkdirSync('desktop-git-test-')
FSE.copySync(testRepoFixturePath, testRepoPath)
FSE.renameSync(
Path.join(testRepoPath, '_git'),
Path.join(testRepoPath, '.git')
)
const ignoreHiddenFiles = function(item: KlawEntry) {
const basename = Path.basename(item.path)
return basename === '.' || basename[0] !== '.'
}
const entries: ReadonlyArray<KlawEntry> = klawSync(testRepoPath)
const visiblePaths = entries.filter(ignoreHiddenFiles)
const submodules = visiblePaths.filter(
entry => Path.basename(entry.path) === '_git'
)
submodules.forEach(entry => {
const directory = Path.dirname(entry.path)
const newPath = Path.join(directory, '.git')
FSE.renameSync(entry.path, newPath)
})
return testRepoPath
}