本文整理汇总了TypeScript中path.relative函数的典型用法代码示例。如果您正苦于以下问题:TypeScript relative函数的具体用法?TypeScript relative怎么用?TypeScript relative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了relative函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor() {
super({
fileName: path.relative(BUILD_PUBLIC_DIR, ASSETS_MANIFEST),
cache,
});
}
示例2: relative
src.push(...Config.NPM_DEPENDENCIES.map(x => relative(Config.PROJECT_ROOT, x.src)));
示例3: constructor
constructor(path: string) {
this.path = resolve(path);
this.relativePath = relative(REPO_ROOT, this.path);
this.ext = extname(this.path);
}
示例4: promoteRelativePath
depWXSSList = buildDepComponentsResult.map(item => {
let wxss = item.wxss
wxss = wxss.replace(sourceDir, outputDir)
wxss = promoteRelativePath(path.relative(outputFilePath, wxss))
return wxss
})
示例5:
.map(file => {
return {
file: path.relative(process.cwd(), file),
size: chunk.modules[file].renderedLength
};
})
示例6:
const configPaths = projects.map(p => `"${relative(REPO_ROOT, p.tsConfigPath)}"`);
示例7: shouldInstrument
export default function shouldInstrument(
filename: Config.Path,
options: ShouldInstrumentOptions,
config: Config.ProjectConfig,
): boolean {
if (!options.collectCoverage) {
return false;
}
if (
config.forceCoverageMatch.length &&
micromatch.any(filename, config.forceCoverageMatch)
) {
return true;
}
if (
!config.testPathIgnorePatterns.some(pattern => !!filename.match(pattern))
) {
if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {
return false;
}
if (micromatch.some(replacePathSepForGlob(filename), config.testMatch)) {
return false;
}
}
if (
// This configuration field contains an object in the form of:
// {'path/to/file.js': true}
options.collectCoverageOnlyFrom &&
!options.collectCoverageOnlyFrom[filename]
) {
return false;
}
if (
// still cover if `only` is specified
!options.collectCoverageOnlyFrom &&
options.collectCoverageFrom &&
!micromatch.some(
replacePathSepForGlob(path.relative(config.rootDir, filename)),
options.collectCoverageFrom,
)
) {
return false;
}
if (
config.coveragePathIgnorePatterns.some(pattern => !!filename.match(pattern))
) {
return false;
}
if (config.globalSetup === filename) {
return false;
}
if (config.globalTeardown === filename) {
return false;
}
if (config.setupFiles.some(setupFile => setupFile === filename)) {
return false;
}
if (config.setupFilesAfterEnv.some(setupFile => setupFile === filename)) {
return false;
}
if (MOCKS_PATTERN.test(filename)) {
return false;
}
if (options.changedFiles && !options.changedFiles.has(filename)) {
return false;
}
return true;
}
示例8:
.filter(p => {
var relativePath = path.relative(this.inputPaths[0], p);
// TODO(alxhub): better detection of worker script.
return relativePath !== MANIFEST_NAME && relativePath !== 'vendor/@angular/service-worker/dist/worker.js';
})
示例9: resolveVersionedPath
function resolveVersionedPath(binPath: string, relativePath: string): string {
const appFolder = Path.resolve(process.execPath, '..')
return Path.relative(binPath, Path.join(appFolder, relativePath))
}
示例10: function
return function (relativePath: string): string {
return relative(path, relativePath);
};