-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix(schematics): fix for angular 12 and align schematics #437
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ import { ComponentOptions, DirectiveOptions, ServiceOptions } from './schema'; | |
export function spectatorComponentSchematic(options: ComponentOptions): Rule { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'component', { | ||
...options, | ||
..._omit(options, ['jest', 'withHost', 'withCustomHost']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Angular 12 complains about options that are passed but not known |
||
skipTests: true, | ||
spec: false | ||
}), | ||
|
@@ -52,7 +52,7 @@ export function spectatorComponentSchematic(options: ComponentOptions): Rule { | |
export function spectatorServiceSchematic(options: ServiceOptions): Rule { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'service', { | ||
...options, | ||
..._omit(options, ['jest']), | ||
skipTests: true, | ||
spec: false | ||
}), | ||
|
@@ -79,7 +79,7 @@ export function spectatorServiceSchematic(options: ServiceOptions): Rule { | |
export function spectatorDirectiveSchematic(options: DirectiveOptions): Rule { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'directive', { | ||
...options, | ||
..._omit(options, ['jest']), | ||
skipTests: true, | ||
spec: false | ||
}), | ||
|
@@ -106,7 +106,7 @@ export function spectatorDirectiveSchematic(options: DirectiveOptions): Rule { | |
export function spectatorPipeSchematic(options: DirectiveOptions): Rule { | ||
return chain([ | ||
externalSchematic('@schematics/angular', 'pipe', { | ||
...options, | ||
..._omit(options, ['jest']), | ||
skipTests: true, | ||
spec: false | ||
}), | ||
|
@@ -147,3 +147,18 @@ async function _ensurePath(tree: Tree, options: any): Promise<void> { | |
options.name = parsedPath.name; | ||
options.path = parsedPath.path; | ||
} | ||
|
||
/** | ||
* create a new object without given keys | ||
* @param raw initial object | ||
* @param keys list of keys to remove from object | ||
*/ | ||
function _omit<T extends Record<string, any>>(raw: T, keys: (keyof T)[]): any { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the PR. I think this function is doing the opposite of what you want it to! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benelliott is right. Check your filter logic. |
||
return Object.keys(raw) | ||
.filter(key => !keys.includes(key)) | ||
.reduce((obj: any, key) => { | ||
obj[key] = raw[key]; | ||
|
||
return obj; | ||
}, {}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wenn I tried to run this as a linked package it complained that @angular-devkit/core was not found although it was installed in the project.