Charles Lyding ccd7e71a47 refactor(@schematics/angular): minor cleanup of unneeded @angular-devkit/core imports
Several imported types and values from `@angular-devkit/core` could be removed while still
maintaining the same functionality. This further reduces the schematics direct dependence
on the `@angular-devkit/core` package.
2022-04-22 11:31:53 -04:00

25 lines
605 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 { Path, basename, dirname, join, normalize } from '@angular-devkit/core';
export interface Location {
name: string;
path: Path;
}
export function parseName(path: string, name: string): Location {
const nameWithoutPath = basename(normalize(name));
const namePath = dirname(join(normalize(path), name));
return {
name: nameWithoutPath,
path: normalize('/' + namePath),
};
}