Skip to content

Commit a1e9530

Browse files
brandonrobertsMikeRyanDev
authored andcommitted
fix(Schematics): Update parsed path logic to split path and name
Closes #1064
1 parent d58ad9c commit a1e9530

File tree

33 files changed

+186
-1
lines changed

33 files changed

+186
-1
lines changed

modules/effects/schematics-core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ export const stringUtils = {
7070
};
7171

7272
export { updatePackage } from './utility/update';
73+
export { parseName } from './utility/parse-name';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
2+
3+
export interface Location {
4+
name: string;
5+
path: Path;
6+
}
7+
8+
export function parseName(path: string, name: string): Location {
9+
const nameWithoutPath = basename(name as Path);
10+
const namePath = dirname((path + '/' + name) as Path);
11+
12+
return {
13+
name: nameWithoutPath,
14+
path: normalize('/' + namePath),
15+
};
16+
}

modules/entity/schematics-core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ export const stringUtils = {
7070
};
7171

7272
export { updatePackage } from './utility/update';
73+
export { parseName } from './utility/parse-name';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
2+
3+
export interface Location {
4+
name: string;
5+
path: Path;
6+
}
7+
8+
export function parseName(path: string, name: string): Location {
9+
const nameWithoutPath = basename(name as Path);
10+
const namePath = dirname((path + '/' + name) as Path);
11+
12+
return {
13+
name: nameWithoutPath,
14+
path: normalize('/' + namePath),
15+
};
16+
}

modules/router-store/schematics-core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ export const stringUtils = {
7070
};
7171

7272
export { updatePackage } from './utility/update';
73+
export { parseName } from './utility/parse-name';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
2+
3+
export interface Location {
4+
name: string;
5+
path: Path;
6+
}
7+
8+
export function parseName(path: string, name: string): Location {
9+
const nameWithoutPath = basename(name as Path);
10+
const namePath = dirname((path + '/' + name) as Path);
11+
12+
return {
13+
name: nameWithoutPath,
14+
path: normalize('/' + namePath),
15+
};
16+
}

modules/schematics-core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ export const stringUtils = {
7070
};
7171

7272
export { updatePackage } from './utility/update';
73+
export { parseName } from './utility/parse-name';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
2+
3+
export interface Location {
4+
name: string;
5+
path: Path;
6+
}
7+
8+
export function parseName(path: string, name: string): Location {
9+
const nameWithoutPath = basename(name as Path);
10+
const namePath = dirname((path + '/' + name) as Path);
11+
12+
return {
13+
name: nameWithoutPath,
14+
path: normalize('/' + namePath),
15+
};
16+
}

modules/schematics/schematics-core/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ export const stringUtils = {
7070
};
7171

7272
export { updatePackage } from './utility/update';
73+
export { parseName } from './utility/parse-name';
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
2+
3+
export interface Location {
4+
name: string;
5+
path: Path;
6+
}
7+
8+
export function parseName(path: string, name: string): Location {
9+
const nameWithoutPath = basename(name as Path);
10+
const namePath = dirname((path + '/' + name) as Path);
11+
12+
return {
13+
name: nameWithoutPath,
14+
path: normalize('/' + namePath),
15+
};
16+
}

0 commit comments

Comments
 (0)