Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/schematics/angular/class/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ import { generateFromFiles } from '../utility/generate-from-files';
import { Schema as ClassOptions } from './schema';

export default function (options: ClassOptions): Rule {
options.type = options.type ? `.${options.type}` : '';

return generateFromFiles(options);
}
3 changes: 0 additions & 3 deletions packages/schematics/angular/directive/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ export default function (options: DirectiveOptions): Rule {

options.module = findModuleFromOptions(host, options);

// Schematic templates require a defined type value
options.type ??= '';

const parsedPath = parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
Expand Down
2 changes: 0 additions & 2 deletions packages/schematics/angular/interface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ import { generateFromFiles } from '../utility/generate-from-files';
import { Schema as InterfaceOptions } from './schema';

export default function (options: InterfaceOptions): Rule {
options.type = options.type ? `.${options.type}` : '';

return generateFromFiles(options);
}
11 changes: 1 addition & 10 deletions packages/schematics/angular/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,5 @@ import { generateFromFiles } from '../utility/generate-from-files';
import { Schema as ServiceOptions } from './schema';

export default function (options: ServiceOptions): Rule {
// This schematic uses an older method to implement the flat option
const flat = options.flat;
options.flat = true;

// Schematic templates require a defined type value
options.type ??= '';

return generateFromFiles(options, {
'if-flat': (s: string) => (flat ? '' : s),
});
return generateFromFiles(options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export function addDeclarationToNgModule(options: DeclarationToNgModuleOptions):
`/${options.path}/` +
(options.flat ? '' : strings.dasherize(options.name) + '/') +
strings.dasherize(options.name) +
(options.type ? '.' : '') +
strings.dasherize(options.type);
(options.type ? '.' + strings.dasherize(options.type) : '');

const importPath = buildRelativePath(modulePath, filePath);
const classifiedName = strings.classify(options.name) + strings.classify(options.type);
const classifiedName =
strings.classify(options.name) + (options.type ? strings.classify(options.type) : '');
const changes = addDeclarationToModule(source, modulePath, classifiedName, importPath);

if (options.export) {
Expand Down
3 changes: 3 additions & 0 deletions packages/schematics/angular/utility/generate-from-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export function generateFromFiles(
options.prefix ??= '';
options.flat ??= true;

// Schematic templates require a defined type value
options.type ??= '';

const parsedPath = parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;
Expand Down