Charles Lyding 45964c7aea refactor(@schematics/angular): update internal schematics utilities to use built-in POSIX path utilities
The use of the custom path functions from `@angular-devkit/core` have been
removed in favor of the built-in functions from Node.js. These provide
equivalent functionality with an improvement in performance. The amount
of custom code executed has also been reduced.
2024-03-11 10:05:28 -04:00

18 lines
441 B
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { join, relative } from 'node:path/posix';
export function relativePathToWorkspaceRoot(projectRoot: string | undefined): string {
if (!projectRoot) {
return '.';
}
return relative(join('/', projectRoot), '/') || '.';
}