@nestjs/schematics
Version:
The generators behind the Nest CLI: scaffold NestJS applications, libraries, modules, controllers, services and CRUD resources.
9 lines (8 loc) • 419 B
JavaScript
import { basename, dirname, relative } from '@angular-devkit/core';
export class PathSolver {
relative(from, to) {
const placeholder = '/placeholder';
const relativeDir = relative(dirname((placeholder + from)), dirname((placeholder + to)));
return (relativeDir.startsWith('.') ? relativeDir : './' + relativeDir).concat(relativeDir.length === 0 ? basename(to) : '/' + basename(to));
}
}