mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
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.
25 lines
605 B
TypeScript
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),
|
|
};
|
|
}
|