本文整理匯總了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
}